blob: f407fb232752a92415d076b621c483f68da92dcb [file] [log] [blame]
Mike Frysinger84a9dda2008-10-12 21:32:52 -04001/*
Bin Menga1875592016-02-05 19:30:11 -08002 * U-Boot - u-boot.lds.S
Mike Frysinger84a9dda2008-10-12 21:32:52 -04003 *
Mike Frysingera3c08362010-03-23 16:23:39 -04004 * Copyright (c) 2005-2010 Analog Device Inc.
Mike Frysinger84a9dda2008-10-12 21:32:52 -04005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Mike Frysinger84a9dda2008-10-12 21:32:52 -040010 */
11
12#include <config.h>
13#include <asm/blackfin.h>
14#undef ALIGN
15#undef ENTRY
Mike Frysinger84a9dda2008-10-12 21:32:52 -040016
Mike Frysinger9ff67e52009-06-14 06:29:07 -040017#ifndef LDS_BOARD_TEXT
18# define LDS_BOARD_TEXT
19#endif
20
Mike Frysinger84a9dda2008-10-12 21:32:52 -040021/* If we don't actually load anything into L1 data, this will avoid
22 * a syntax error. If we do actually load something into L1 data,
23 * we'll get a linker memory load error (which is what we'd want).
24 * This is here in the first place so we can quickly test building
25 * for different CPU's which may lack non-cache L1 data.
26 */
Mike Frysinger105be902010-12-24 19:31:55 -050027#ifndef L1_DATA_A_SRAM
28# define L1_DATA_A_SRAM 0
29# define L1_DATA_A_SRAM_SIZE 0
30#endif
Mike Frysinger84a9dda2008-10-12 21:32:52 -040031#ifndef L1_DATA_B_SRAM
Mike Frysinger105be902010-12-24 19:31:55 -050032# define L1_DATA_B_SRAM L1_DATA_A_SRAM
33# define L1_DATA_B_SRAM_SIZE L1_DATA_A_SRAM_SIZE
Mike Frysinger84a9dda2008-10-12 21:32:52 -040034#endif
35
Mike Frysingerf51e0012009-07-23 16:26:58 -040036/* The 0xC offset is so we don't clobber the tiny LDR jump block. */
37#ifdef CONFIG_BFIN_BOOTROM_USES_EVT1
38# define L1_CODE_ORIGIN L1_INST_SRAM
39#else
40# define L1_CODE_ORIGIN L1_INST_SRAM + 0xC
41#endif
42
Mike Frysinger84a9dda2008-10-12 21:32:52 -040043OUTPUT_ARCH(bfin)
44
45MEMORY
46{
Mike Frysinger7527fee2009-11-09 19:38:23 -050047#if CONFIG_MEM_SIZE
Mike Frysinger84a9dda2008-10-12 21:32:52 -040048 ram : ORIGIN = CONFIG_SYS_MONITOR_BASE, LENGTH = CONFIG_SYS_MONITOR_LEN
Mike Frysinger7527fee2009-11-09 19:38:23 -050049# define ram_code ram
50# define ram_data ram
51#else
52# define ram_code l1_code
53# define ram_data l1_data
54#endif
Mike Frysingerf51e0012009-07-23 16:26:58 -040055 l1_code : ORIGIN = L1_CODE_ORIGIN, LENGTH = L1_INST_SRAM_SIZE
Mike Frysinger84a9dda2008-10-12 21:32:52 -040056 l1_data : ORIGIN = L1_DATA_B_SRAM, LENGTH = L1_DATA_B_SRAM_SIZE
57}
58
59ENTRY(_start)
60SECTIONS
61{
Mike Frysingerb1e2c552009-11-03 06:11:31 -050062 .text.pre :
Mike Frysinger84a9dda2008-10-12 21:32:52 -040063 {
Peter Tyserc6fb83d2010-04-12 22:28:13 -050064 arch/blackfin/cpu/start.o (.text .text.*)
Mike Frysinger9ff67e52009-06-14 06:29:07 -040065
66 LDS_BOARD_TEXT
Mike Frysingerb1e2c552009-11-03 06:11:31 -050067 } >ram_code
Mike Frysinger9ff67e52009-06-14 06:29:07 -040068
Mike Frysingerb1e2c552009-11-03 06:11:31 -050069 .text.init :
70 {
Peter Tyserc6fb83d2010-04-12 22:28:13 -050071 arch/blackfin/cpu/initcode.o (.text .text.*)
Mike Frysingerb1e2c552009-11-03 06:11:31 -050072 } >ram_code
73 __initcode_lma = LOADADDR(.text.init);
74 __initcode_len = SIZEOF(.text.init);
Mike Frysinger9ff67e52009-06-14 06:29:07 -040075
Mike Frysingerb1e2c552009-11-03 06:11:31 -050076 .text :
77 {
Mike Frysinger84a9dda2008-10-12 21:32:52 -040078 *(.text .text.*)
Mike Frysinger7527fee2009-11-09 19:38:23 -050079 } >ram_code
Mike Frysinger84a9dda2008-10-12 21:32:52 -040080
81 .rodata :
82 {
83 . = ALIGN(4);
Mike Frysingered912d42010-01-15 04:47:06 -050084 *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
Mike Frysinger84a9dda2008-10-12 21:32:52 -040085 . = ALIGN(4);
Mike Frysinger7527fee2009-11-09 19:38:23 -050086 } >ram_data
Mike Frysinger84a9dda2008-10-12 21:32:52 -040087
88 .data :
89 {
Mike Frysinger38b9b742010-01-19 21:02:00 -050090 . = ALIGN(4);
Mike Frysinger84a9dda2008-10-12 21:32:52 -040091 *(.data .data.*)
92 *(.data1)
93 *(.sdata)
94 *(.sdata2)
95 *(.dynamic)
96 CONSTRUCTORS
Mike Frysinger7527fee2009-11-09 19:38:23 -050097 } >ram_data
Mike Frysinger84a9dda2008-10-12 21:32:52 -040098
Mike Frysinger84a9dda2008-10-12 21:32:52 -040099
Marek Vasut55675142012-10-12 10:27:03 +0000100 .u_boot_list : {
Albert ARIBAUDef123c52013-02-25 00:59:00 +0000101 KEEP(*(SORT(.u_boot_list*)));
Marek Vasut55675142012-10-12 10:27:03 +0000102 } >ram_data
103
Mike Frysinger84a9dda2008-10-12 21:32:52 -0400104 .text_l1 :
105 {
106 . = ALIGN(4);
107 __stext_l1 = .;
108 *(.l1.text)
109 . = ALIGN(4);
110 __etext_l1 = .;
Mike Frysinger7527fee2009-11-09 19:38:23 -0500111 } >l1_code AT>ram_code
Mike Frysingerb1e2c552009-11-03 06:11:31 -0500112 __text_l1_lma = LOADADDR(.text_l1);
113 __text_l1_len = SIZEOF(.text_l1);
114 ASSERT (__text_l1_len <= L1_INST_SRAM_SIZE, "L1 text overflow!")
Mike Frysinger84a9dda2008-10-12 21:32:52 -0400115
116 .data_l1 :
117 {
118 . = ALIGN(4);
119 __sdata_l1 = .;
120 *(.l1.data)
121 *(.l1.bss)
122 . = ALIGN(4);
123 __edata_l1 = .;
Mike Frysinger7527fee2009-11-09 19:38:23 -0500124 } >l1_data AT>ram_data
Mike Frysingerb1e2c552009-11-03 06:11:31 -0500125 __data_l1_lma = LOADADDR(.data_l1);
126 __data_l1_len = SIZEOF(.data_l1);
Mike Frysinger105be902010-12-24 19:31:55 -0500127 ASSERT (__data_l1_len <= L1_DATA_B_SRAM_SIZE, "L1 data overflow!")
Mike Frysinger84a9dda2008-10-12 21:32:52 -0400128
129 .bss :
130 {
131 . = ALIGN(4);
Mike Frysinger84a9dda2008-10-12 21:32:52 -0400132 *(.sbss) *(.scommon)
133 *(.dynbss)
134 *(.bss .bss.*)
135 *(COMMON)
Mike Frysinger49508d42010-11-15 08:16:19 -0500136 . = ALIGN(4);
Mike Frysinger7527fee2009-11-09 19:38:23 -0500137 } >ram_data
Sonic Zhangc49eabe2014-07-17 19:00:29 +0800138 __bss_end = .;
139 __bss_start = ADDR(.bss);
Mike Frysingerb1e2c552009-11-03 06:11:31 -0500140 __bss_len = SIZEOF(.bss);
Sonic Zhangc49eabe2014-07-17 19:00:29 +0800141 __init_end = .;
Mike Frysinger84a9dda2008-10-12 21:32:52 -0400142}