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