1 | MEMORY
|
---|
2 | {
|
---|
3 | reset : ORIGIN = 0x00000000, LENGTH = 32
|
---|
4 | ext_flash : ORIGIN = 0x00000020, LENGTH = 8388576
|
---|
5 | ext_ram : ORIGIN = 0x09000000, LENGTH = 1048576
|
---|
6 | onchip_ram_64_kbytes : ORIGIN = 0x02100000, LENGTH = 65536
|
---|
7 | /* sram_UNUSED : ORIGIN = 0x0a000000, LENGTH = 32
|
---|
8 | sram : ORIGIN = 0x05000020, LENGTH = 1M-0x20
|
---|
9 | */
|
---|
10 | sdram_UNUSED : ORIGIN = 0x0a000000, LENGTH = 32
|
---|
11 | sdram : ORIGIN = 0x0a000020, LENGTH = 33554368
|
---|
12 | }
|
---|
13 |
|
---|
14 | /* Define symbols for each memory base-address */
|
---|
15 | __alt_mem_ext_flash = 0x00000000 ;
|
---|
16 | __alt_mem_ext_ram = 0x00800000 ;
|
---|
17 | __alt_mem_onchip_ram_64_kbytes = 0x00900000 ;
|
---|
18 | __alt_mem_sdram = 0x05000000 ;
|
---|
19 |
|
---|
20 |
|
---|
21 | PROVIDE(_hardware_init_hook = 0);
|
---|
22 | PROVIDE(_software_init_hook = 0);
|
---|
23 | PROVIDE(software_term_hook = 0);
|
---|
24 | PROVIDE( __alt_data_end = 0x02000000 );
|
---|
25 |
|
---|
26 | OUTPUT_FORMAT( "elf32-littlenios2",
|
---|
27 | "elf32-littlenios2",
|
---|
28 | "elf32-littlenios2" )
|
---|
29 | OUTPUT_ARCH( nios2 )
|
---|
30 | STARTUP(start.o)
|
---|
31 | ENTRY(start)
|
---|
32 |
|
---|
33 | /* Do we need any of these for elf?
|
---|
34 | __DYNAMIC = 0;
|
---|
35 | */
|
---|
36 |
|
---|
37 | SECTIONS
|
---|
38 | {
|
---|
39 | .entry :
|
---|
40 | {
|
---|
41 | KEEP (*(.entry))
|
---|
42 | } > reset
|
---|
43 |
|
---|
44 | .exceptions :
|
---|
45 | {
|
---|
46 | . = ALIGN(0x20);
|
---|
47 | *(.irq)
|
---|
48 | KEEP (*(.exceptions));
|
---|
49 | } > sdram
|
---|
50 |
|
---|
51 | .text :
|
---|
52 | {
|
---|
53 | /*
|
---|
54 | * All code sections are merged into the text output section, along with
|
---|
55 | * the read only data sections.
|
---|
56 | *
|
---|
57 | */
|
---|
58 |
|
---|
59 | PROVIDE (stext = ABSOLUTE(.));
|
---|
60 |
|
---|
61 | *(.interp)
|
---|
62 | *(.hash)
|
---|
63 | *(.dynsym)
|
---|
64 | *(.dynstr)
|
---|
65 | *(.gnu.version)
|
---|
66 | *(.gnu.version_d)
|
---|
67 | *(.gnu.version_r)
|
---|
68 | *(.rel.init)
|
---|
69 | *(.rela.init)
|
---|
70 | *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
|
---|
71 | *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
|
---|
72 | *(.rel.fini)
|
---|
73 | *(.rela.fini)
|
---|
74 | *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
|
---|
75 | *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
|
---|
76 | *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
|
---|
77 | *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
|
---|
78 | *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
|
---|
79 | *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
|
---|
80 | *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
|
---|
81 | *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
|
---|
82 | *(.rel.ctors)
|
---|
83 | *(.rela.ctors)
|
---|
84 | *(.rel.dtors)
|
---|
85 | *(.rela.dtors)
|
---|
86 | *(.rel.got)
|
---|
87 | *(.rela.got)
|
---|
88 | *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
|
---|
89 | *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
|
---|
90 | *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
|
---|
91 | *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
|
---|
92 | *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
|
---|
93 | *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
|
---|
94 | *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
|
---|
95 | *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
|
---|
96 | *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
|
---|
97 | *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
|
---|
98 | *(.rel.plt)
|
---|
99 | *(.rela.plt)
|
---|
100 |
|
---|
101 | KEEP (*(.init))
|
---|
102 | *(.plt)
|
---|
103 | *(.text .stub .text.* .gnu.linkonce.t.*)
|
---|
104 |
|
---|
105 | /* .gnu.warning sections are handled specially by elf32.em. */
|
---|
106 |
|
---|
107 | *(.gnu.warning.*)
|
---|
108 | KEEP (*(.fini))
|
---|
109 | PROVIDE (__etext = ABSOLUTE(.));
|
---|
110 | PROVIDE (_etext = ABSOLUTE(.));
|
---|
111 | PROVIDE (etext = ABSOLUTE(.));
|
---|
112 |
|
---|
113 | *(.eh_frame_hdr)
|
---|
114 | /* Ensure the __preinit_array_start label is properly aligned. We
|
---|
115 | could instead move the label definition inside the section, but
|
---|
116 | the linker would then create the section even if it turns out to
|
---|
117 | be empty, which isn't pretty. */
|
---|
118 | . = ALIGN(32 / 8);
|
---|
119 | PROVIDE (__preinit_array_start = ABSOLUTE(.));
|
---|
120 | *(.preinit_array)
|
---|
121 | PROVIDE (__preinit_array_end = ABSOLUTE(.));
|
---|
122 | PROVIDE (__init_array_start = ABSOLUTE(.));
|
---|
123 | *(.init_array)
|
---|
124 | PROVIDE (__init_array_end = ABSOLUTE(.));
|
---|
125 | PROVIDE (__fini_array_start = ABSOLUTE(.));
|
---|
126 | *(.fini_array)
|
---|
127 | PROVIDE (__fini_array_end = ABSOLUTE(.));
|
---|
128 | SORT(CONSTRUCTORS)
|
---|
129 | KEEP (*(.eh_frame))
|
---|
130 | *(.gcc_except_table)
|
---|
131 | *(.dynamic)
|
---|
132 |
|
---|
133 | /* gcc normally uses crtbegin.o to find the start of
|
---|
134 | the constructors instead nios2 use crtdotors.o,
|
---|
135 | so we make sure it is
|
---|
136 | first. Because this is a wildcard, it
|
---|
137 | doesn't matter if the user does not
|
---|
138 | actually link against crtdotors.o; the
|
---|
139 | linker won't look for a file to match a
|
---|
140 | wildcard. The wildcard also means that it
|
---|
141 | doesn't matter which directory crtdotors.o
|
---|
142 | is in. */
|
---|
143 | KEEP (*crtdotors.o(.ctors))
|
---|
144 | /* We don't want to include the .ctor section from
|
---|
145 | from the crtendtors (gcc normally uses crtend.o)
|
---|
146 | file until after the sorted ctors.
|
---|
147 | The .ctor section from the crtendtors file contains the
|
---|
148 | end of ctors marker and it must be last */
|
---|
149 | KEEP (*(EXCLUDE_FILE (*crtendtors.o ) .ctors))
|
---|
150 | KEEP (*(SORT(.ctors.*)))
|
---|
151 | KEEP (*(.ctors))
|
---|
152 | KEEP (*crtdotors.o(.dtors))
|
---|
153 | KEEP (*(EXCLUDE_FILE (*crtendtors.o ) .dtors))
|
---|
154 | KEEP (*(SORT(.dtors.*)))
|
---|
155 | KEEP (*(.dtors))
|
---|
156 | KEEP (*(.jcr))
|
---|
157 | } > sdram
|
---|
158 |
|
---|
159 | .rodata :
|
---|
160 | {
|
---|
161 | . = ALIGN(32 / 8);
|
---|
162 | *(.rodata .rodata.* .gnu.linkonce.r.*)
|
---|
163 | *(.rodata1)
|
---|
164 | } > sdram
|
---|
165 |
|
---|
166 | .rwdata :
|
---|
167 | {
|
---|
168 | . = ALIGN(32 / 8);
|
---|
169 | *(.got.plt) *(.got)
|
---|
170 | *(.data1)
|
---|
171 | *(.data .data.* .gnu.linkonce.d.*)
|
---|
172 |
|
---|
173 | _gp = ABSOLUTE(. + 0x7ff0);
|
---|
174 | PROVIDE(gp = _gp);
|
---|
175 |
|
---|
176 | *(.sdata .sdata.* .gnu.linkonce.s.*)
|
---|
177 | *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
|
---|
178 |
|
---|
179 | . = ALIGN(32 / 8);
|
---|
180 | _edata = ABSOLUTE(.);
|
---|
181 | PROVIDE (edata = ABSOLUTE(.));
|
---|
182 | } > sdram
|
---|
183 |
|
---|
184 | .bss :
|
---|
185 | {
|
---|
186 | __bss_start = ABSOLUTE(.);
|
---|
187 | PROVIDE (__sbss_start = ABSOLUTE(.));
|
---|
188 | PROVIDE (___sbss_start = ABSOLUTE(.));
|
---|
189 |
|
---|
190 | *(.dynsbss)
|
---|
191 | *(.sbss .sbss.* .gnu.linkonce.sb.*)
|
---|
192 | *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
|
---|
193 | *(.scommon)
|
---|
194 |
|
---|
195 | PROVIDE (__sbss_end = ABSOLUTE(.));
|
---|
196 | PROVIDE (___sbss_end = ABSOLUTE(.));
|
---|
197 |
|
---|
198 | *(.dynbss)
|
---|
199 | *(.bss .bss.* .gnu.linkonce.b.*)
|
---|
200 | *(COMMON)
|
---|
201 |
|
---|
202 | . = ALIGN(32 / 8);
|
---|
203 | __bss_end = ABSOLUTE(.);
|
---|
204 | } > sdram
|
---|
205 |
|
---|
206 | /*
|
---|
207 | * One output section for each of the available partitions. These are not
|
---|
208 | * used by default, but can be used by users applications using the .section
|
---|
209 | * directive.
|
---|
210 | *
|
---|
211 | * The memory partition used for the heap is treated in special way, i.e. a
|
---|
212 | * symbol is added to point to the heap start.
|
---|
213 | *
|
---|
214 | */
|
---|
215 |
|
---|
216 | .ext_flash :
|
---|
217 | {
|
---|
218 | PROVIDE (_alt_partition_ext_flash_start = ABSOLUTE(.));
|
---|
219 | *(.ext_flash)
|
---|
220 | . = ALIGN(32 / 8);
|
---|
221 | PROVIDE (_alt_partition_ext_flash_end = ABSOLUTE(.));
|
---|
222 | } > ext_flash
|
---|
223 | /*
|
---|
224 | .sram :
|
---|
225 | {
|
---|
226 | PROVIDE (_alt_partition_sram_start = ABSOLUTE(.));
|
---|
227 | *(.sram)
|
---|
228 | . = ALIGN(32 / 8);
|
---|
229 | PROVIDE (_alt_partition_sram_end = ABSOLUTE(.));
|
---|
230 | _end = ABSOLUTE(.);
|
---|
231 | PROVIDE (end = ABSOLUTE(.));
|
---|
232 | } > sram
|
---|
233 | */
|
---|
234 | .onchip_ram_64_kbytes :
|
---|
235 | {
|
---|
236 | PROVIDE (_alt_partition_onchip_ram_64_kbytes_start = ABSOLUTE(.));
|
---|
237 | *(.onchip_ram_64_kbytes)
|
---|
238 | . = ALIGN(32 / 8);
|
---|
239 | PROVIDE (_alt_partition_onchip_ram_64_kbytes_end = ABSOLUTE(.));
|
---|
240 | } > onchip_ram_64_kbytes
|
---|
241 |
|
---|
242 | .sdram :
|
---|
243 | {
|
---|
244 | PROVIDE (_alt_partition_sdram_start = ABSOLUTE(.));
|
---|
245 | *(.sdram)
|
---|
246 | . = ALIGN(32 / 8);
|
---|
247 | PROVIDE (_alt_partition_sdram_end = ABSOLUTE(.));
|
---|
248 | _end = ABSOLUTE(.);
|
---|
249 | PROVIDE (end = ABSOLUTE(.));
|
---|
250 | } > sdram
|
---|
251 |
|
---|
252 | .nlsdram (NOLOAD):
|
---|
253 | {
|
---|
254 | PROVIDE (_alt_partition_nlsdram_start = ABSOLUTE(.));
|
---|
255 | *(.nlsdram)
|
---|
256 | . = ALIGN(32 / 8);
|
---|
257 | PROVIDE (_alt_partition_nlsdram_end = ABSOLUTE(.));
|
---|
258 | _end = ABSOLUTE(.);
|
---|
259 | PROVIDE (end = ABSOLUTE(.));
|
---|
260 | } > sdram
|
---|
261 |
|
---|
262 | /*
|
---|
263 | * Stabs debugging sections.
|
---|
264 | *
|
---|
265 | */
|
---|
266 |
|
---|
267 | .stab 0 : { *(.stab) }
|
---|
268 | .stabstr 0 : { *(.stabstr) }
|
---|
269 | .stab.excl 0 : { *(.stab.excl) }
|
---|
270 | .stab.exclstr 0 : { *(.stab.exclstr) }
|
---|
271 | .stab.index 0 : { *(.stab.index) }
|
---|
272 | .stab.indexstr 0 : { *(.stab.indexstr) }
|
---|
273 | .comment 0 : { *(.comment) }
|
---|
274 | /* DWARF debug sections.
|
---|
275 | Symbols in the DWARF debugging sections are relative to the beginning
|
---|
276 | of the section so we begin them at 0. */
|
---|
277 | /* DWARF 1 */
|
---|
278 | .debug 0 : { *(.debug) }
|
---|
279 | .line 0 : { *(.line) }
|
---|
280 | /* GNU DWARF 1 extensions */
|
---|
281 | .debug_srcinfo 0 : { *(.debug_srcinfo) }
|
---|
282 | .debug_sfnames 0 : { *(.debug_sfnames) }
|
---|
283 | /* DWARF 1.1 and DWARF 2 */
|
---|
284 | .debug_aranges 0 : { *(.debug_aranges) }
|
---|
285 | .debug_pubnames 0 : { *(.debug_pubnames) }
|
---|
286 | /* DWARF 2 */
|
---|
287 | .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
|
---|
288 | .debug_abbrev 0 : { *(.debug_abbrev) }
|
---|
289 | .debug_line 0 : { *(.debug_line) }
|
---|
290 | .debug_frame 0 : { *(.debug_frame) }
|
---|
291 | .debug_str 0 : { *(.debug_str) }
|
---|
292 | .debug_loc 0 : { *(.debug_loc) }
|
---|
293 | .debug_macinfo 0 : { *(.debug_macinfo) }
|
---|
294 | /* SGI/MIPS DWARF 2 extensions */
|
---|
295 | .debug_weaknames 0 : { *(.debug_weaknames) }
|
---|
296 | .debug_funcnames 0 : { *(.debug_funcnames) }
|
---|
297 | .debug_typenames 0 : { *(.debug_typenames) }
|
---|
298 | .debug_varnames 0 : { *(.debug_varnames) }
|
---|
299 | }
|
---|
300 | /* provide a pointer for the stack */
|
---|