linker.x 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. /*
  2. * linker.x - Linker script
  3. *
  4. * Machine generated for CPU 'nios2' in SOPC Builder design 'nios2_uc'
  5. * SOPC Builder design path: ../../nios2_uc.sopcinfo
  6. *
  7. * Generated: Thu Dec 03 15:55:47 CET 2020
  8. */
  9. /*
  10. * DO NOT MODIFY THIS FILE
  11. *
  12. * Changing this file will have subtle consequences
  13. * which will almost certainly lead to a nonfunctioning
  14. * system. If you do modify this file, be aware that your
  15. * changes will be overwritten and lost when this file
  16. * is generated again.
  17. *
  18. * DO NOT MODIFY THIS FILE
  19. */
  20. /*
  21. * License Agreement
  22. *
  23. * Copyright (c) 2008
  24. * Altera Corporation, San Jose, California, USA.
  25. * All rights reserved.
  26. *
  27. * Permission is hereby granted, free of charge, to any person obtaining a
  28. * copy of this software and associated documentation files (the "Software"),
  29. * to deal in the Software without restriction, including without limitation
  30. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  31. * and/or sell copies of the Software, and to permit persons to whom the
  32. * Software is furnished to do so, subject to the following conditions:
  33. *
  34. * The above copyright notice and this permission notice shall be included in
  35. * all copies or substantial portions of the Software.
  36. *
  37. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  39. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  42. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  43. * DEALINGS IN THE SOFTWARE.
  44. *
  45. * This agreement shall be governed in all respects by the laws of the State
  46. * of California and by the laws of the United States of America.
  47. */
  48. MEMORY
  49. {
  50. reset : ORIGIN = 0x40000, LENGTH = 32
  51. onchip_memory2 : ORIGIN = 0x40020, LENGTH = 204768
  52. }
  53. /* Define symbols for each memory base-address */
  54. __alt_mem_onchip_memory2 = 0x40000;
  55. OUTPUT_FORMAT( "elf32-littlenios2",
  56. "elf32-littlenios2",
  57. "elf32-littlenios2" )
  58. OUTPUT_ARCH( nios2 )
  59. ENTRY( _start )
  60. /*
  61. * The alt_load() facility is enabled. This typically happens when there isn't
  62. * an external bootloader (e.g. flash bootloader).
  63. * The LMA (aka physical address) of each loaded section is
  64. * set to the .text memory device.
  65. * The HAL alt_load() routine called from crt0 copies sections from
  66. * the .text memory to RAM as needed.
  67. */
  68. SECTIONS
  69. {
  70. /*
  71. * Output sections associated with reset and exceptions (they have to be first)
  72. */
  73. .entry :
  74. {
  75. KEEP (*(.entry))
  76. } > reset
  77. .exceptions :
  78. {
  79. PROVIDE (__ram_exceptions_start = ABSOLUTE(.));
  80. . = ALIGN(0x20);
  81. KEEP (*(.irq));
  82. KEEP (*(.exceptions.entry.label));
  83. KEEP (*(.exceptions.entry.user));
  84. KEEP (*(.exceptions.entry.ecc_fatal));
  85. KEEP (*(.exceptions.entry));
  86. KEEP (*(.exceptions.irqtest.user));
  87. KEEP (*(.exceptions.irqtest));
  88. KEEP (*(.exceptions.irqhandler.user));
  89. KEEP (*(.exceptions.irqhandler));
  90. KEEP (*(.exceptions.irqreturn.user));
  91. KEEP (*(.exceptions.irqreturn));
  92. KEEP (*(.exceptions.notirq.label));
  93. KEEP (*(.exceptions.notirq.user));
  94. KEEP (*(.exceptions.notirq));
  95. KEEP (*(.exceptions.soft.user));
  96. KEEP (*(.exceptions.soft));
  97. KEEP (*(.exceptions.unknown.user));
  98. KEEP (*(.exceptions.unknown));
  99. KEEP (*(.exceptions.exit.label));
  100. KEEP (*(.exceptions.exit.user));
  101. KEEP (*(.exceptions.exit));
  102. KEEP (*(.exceptions));
  103. PROVIDE (__ram_exceptions_end = ABSOLUTE(.));
  104. } > onchip_memory2
  105. PROVIDE (__flash_exceptions_start = LOADADDR(.exceptions));
  106. .text :
  107. {
  108. /*
  109. * All code sections are merged into the text output section, along with
  110. * the read only data sections.
  111. *
  112. */
  113. PROVIDE (stext = ABSOLUTE(.));
  114. *(.interp)
  115. *(.hash)
  116. *(.dynsym)
  117. *(.dynstr)
  118. *(.gnu.version)
  119. *(.gnu.version_d)
  120. *(.gnu.version_r)
  121. *(.rel.init)
  122. *(.rela.init)
  123. *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*)
  124. *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*)
  125. *(.rel.fini)
  126. *(.rela.fini)
  127. *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*)
  128. *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*)
  129. *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*)
  130. *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*)
  131. *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*)
  132. *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*)
  133. *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*)
  134. *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*)
  135. *(.rel.ctors)
  136. *(.rela.ctors)
  137. *(.rel.dtors)
  138. *(.rela.dtors)
  139. *(.rel.got)
  140. *(.rela.got)
  141. *(.rel.sdata .rel.sdata.* .rel.gnu.linkonce.s.*)
  142. *(.rela.sdata .rela.sdata.* .rela.gnu.linkonce.s.*)
  143. *(.rel.sbss .rel.sbss.* .rel.gnu.linkonce.sb.*)
  144. *(.rela.sbss .rela.sbss.* .rela.gnu.linkonce.sb.*)
  145. *(.rel.sdata2 .rel.sdata2.* .rel.gnu.linkonce.s2.*)
  146. *(.rela.sdata2 .rela.sdata2.* .rela.gnu.linkonce.s2.*)
  147. *(.rel.sbss2 .rel.sbss2.* .rel.gnu.linkonce.sb2.*)
  148. *(.rela.sbss2 .rela.sbss2.* .rela.gnu.linkonce.sb2.*)
  149. *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*)
  150. *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*)
  151. *(.rel.plt)
  152. *(.rela.plt)
  153. *(.rel.dyn)
  154. KEEP (*(.init))
  155. *(.plt)
  156. *(.text .stub .text.* .gnu.linkonce.t.*)
  157. /* .gnu.warning sections are handled specially by elf32.em. */
  158. *(.gnu.warning.*)
  159. KEEP (*(.fini))
  160. PROVIDE (__etext = ABSOLUTE(.));
  161. PROVIDE (_etext = ABSOLUTE(.));
  162. PROVIDE (etext = ABSOLUTE(.));
  163. *(.eh_frame_hdr)
  164. /* Ensure the __preinit_array_start label is properly aligned. We
  165. could instead move the label definition inside the section, but
  166. the linker would then create the section even if it turns out to
  167. be empty, which isn't pretty. */
  168. . = ALIGN(4);
  169. PROVIDE (__preinit_array_start = ABSOLUTE(.));
  170. *(.preinit_array)
  171. PROVIDE (__preinit_array_end = ABSOLUTE(.));
  172. PROVIDE (__init_array_start = ABSOLUTE(.));
  173. *(.init_array)
  174. PROVIDE (__init_array_end = ABSOLUTE(.));
  175. PROVIDE (__fini_array_start = ABSOLUTE(.));
  176. *(.fini_array)
  177. PROVIDE (__fini_array_end = ABSOLUTE(.));
  178. SORT(CONSTRUCTORS)
  179. KEEP (*(.eh_frame))
  180. *(.gcc_except_table .gcc_except_table.*)
  181. *(.dynamic)
  182. PROVIDE (__CTOR_LIST__ = ABSOLUTE(.));
  183. KEEP (*(.ctors))
  184. KEEP (*(SORT(.ctors.*)))
  185. PROVIDE (__CTOR_END__ = ABSOLUTE(.));
  186. PROVIDE (__DTOR_LIST__ = ABSOLUTE(.));
  187. KEEP (*(.dtors))
  188. KEEP (*(SORT(.dtors.*)))
  189. PROVIDE (__DTOR_END__ = ABSOLUTE(.));
  190. KEEP (*(.jcr))
  191. . = ALIGN(4);
  192. } > onchip_memory2 = 0x3a880100 /* NOP instruction (always in big-endian byte ordering) */
  193. .rodata :
  194. {
  195. PROVIDE (__ram_rodata_start = ABSOLUTE(.));
  196. . = ALIGN(4);
  197. *(.rodata .rodata.* .gnu.linkonce.r.*)
  198. *(.rodata1)
  199. . = ALIGN(4);
  200. PROVIDE (__ram_rodata_end = ABSOLUTE(.));
  201. } > onchip_memory2
  202. PROVIDE (__flash_rodata_start = LOADADDR(.rodata));
  203. /*
  204. *
  205. * This section's LMA is set to the .text region.
  206. * crt0 will copy to this section's specified mapped region virtual memory address (VMA)
  207. *
  208. * .rwdata region equals the .text region, and is set to be loaded into .text region.
  209. * This requires two copies of .rwdata in the .text region. One read writable at VMA.
  210. * and one read-only at LMA. crt0 will copy from LMA to VMA on reset
  211. *
  212. */
  213. .rwdata LOADADDR (.rodata) + SIZEOF (.rodata) : AT ( LOADADDR (.rodata) + SIZEOF (.rodata)+ SIZEOF (.rwdata) )
  214. {
  215. PROVIDE (__ram_rwdata_start = ABSOLUTE(.));
  216. . = ALIGN(4);
  217. *(.got.plt) *(.got)
  218. *(.data1)
  219. *(.data .data.* .gnu.linkonce.d.*)
  220. _gp = ABSOLUTE(. + 0x8000);
  221. PROVIDE(gp = _gp);
  222. *(.rwdata .rwdata.*)
  223. *(.sdata .sdata.* .gnu.linkonce.s.*)
  224. *(.sdata2 .sdata2.* .gnu.linkonce.s2.*)
  225. . = ALIGN(4);
  226. _edata = ABSOLUTE(.);
  227. PROVIDE (edata = ABSOLUTE(.));
  228. PROVIDE (__ram_rwdata_end = ABSOLUTE(.));
  229. } > onchip_memory2
  230. PROVIDE (__flash_rwdata_start = LOADADDR(.rwdata));
  231. /*
  232. *
  233. * This section's LMA is set to the .text region.
  234. * crt0 will copy to this section's specified mapped region virtual memory address (VMA)
  235. *
  236. */
  237. .bss LOADADDR (.rwdata) + SIZEOF (.rwdata) : AT ( LOADADDR (.rwdata) + SIZEOF (.rwdata) )
  238. {
  239. __bss_start = ABSOLUTE(.);
  240. PROVIDE (__sbss_start = ABSOLUTE(.));
  241. PROVIDE (___sbss_start = ABSOLUTE(.));
  242. *(.dynsbss)
  243. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  244. *(.sbss2 .sbss2.* .gnu.linkonce.sb2.*)
  245. *(.scommon)
  246. PROVIDE (__sbss_end = ABSOLUTE(.));
  247. PROVIDE (___sbss_end = ABSOLUTE(.));
  248. *(.dynbss)
  249. *(.bss .bss.* .gnu.linkonce.b.*)
  250. *(COMMON)
  251. . = ALIGN(4);
  252. __bss_end = ABSOLUTE(.);
  253. } > onchip_memory2
  254. /*
  255. *
  256. * One output section mapped to the associated memory device for each of
  257. * the available memory devices. These are not used by default, but can
  258. * be used by user applications by using the .section directive.
  259. *
  260. * The output section used for the heap is treated in a special way,
  261. * i.e. the symbols "end" and "_end" are added to point to the heap start.
  262. *
  263. * Because alt_load() is enabled, these sections have
  264. * their LMA set to be loaded into the .text memory region.
  265. * However, the alt_load() code will NOT automatically copy
  266. * these sections into their mapped memory region.
  267. *
  268. */
  269. /*
  270. *
  271. * This section's LMA is set to the .text region.
  272. * crt0 will copy to this section's specified mapped region virtual memory address (VMA)
  273. *
  274. */
  275. .onchip_memory2 LOADADDR (.bss) + SIZEOF (.bss) : AT ( LOADADDR (.bss) + SIZEOF (.bss) )
  276. {
  277. PROVIDE (_alt_partition_onchip_memory2_start = ABSOLUTE(.));
  278. *(.onchip_memory2 .onchip_memory2. onchip_memory2.*)
  279. . = ALIGN(4);
  280. PROVIDE (_alt_partition_onchip_memory2_end = ABSOLUTE(.));
  281. _end = ABSOLUTE(.);
  282. end = ABSOLUTE(.);
  283. __alt_stack_base = ABSOLUTE(.);
  284. } > onchip_memory2
  285. PROVIDE (_alt_partition_onchip_memory2_load_addr = LOADADDR(.onchip_memory2));
  286. /*
  287. * Stabs debugging sections.
  288. *
  289. */
  290. .stab 0 : { *(.stab) }
  291. .stabstr 0 : { *(.stabstr) }
  292. .stab.excl 0 : { *(.stab.excl) }
  293. .stab.exclstr 0 : { *(.stab.exclstr) }
  294. .stab.index 0 : { *(.stab.index) }
  295. .stab.indexstr 0 : { *(.stab.indexstr) }
  296. .comment 0 : { *(.comment) }
  297. /* DWARF debug sections.
  298. Symbols in the DWARF debugging sections are relative to the beginning
  299. of the section so we begin them at 0. */
  300. /* DWARF 1 */
  301. .debug 0 : { *(.debug) }
  302. .line 0 : { *(.line) }
  303. /* GNU DWARF 1 extensions */
  304. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  305. .debug_sfnames 0 : { *(.debug_sfnames) }
  306. /* DWARF 1.1 and DWARF 2 */
  307. .debug_aranges 0 : { *(.debug_aranges) }
  308. .debug_pubnames 0 : { *(.debug_pubnames) }
  309. /* DWARF 2 */
  310. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  311. .debug_abbrev 0 : { *(.debug_abbrev) }
  312. .debug_line 0 : { *(.debug_line) }
  313. .debug_frame 0 : { *(.debug_frame) }
  314. .debug_str 0 : { *(.debug_str) }
  315. .debug_loc 0 : { *(.debug_loc) }
  316. .debug_macinfo 0 : { *(.debug_macinfo) }
  317. /* SGI/MIPS DWARF 2 extensions */
  318. .debug_weaknames 0 : { *(.debug_weaknames) }
  319. .debug_funcnames 0 : { *(.debug_funcnames) }
  320. .debug_typenames 0 : { *(.debug_typenames) }
  321. .debug_varnames 0 : { *(.debug_varnames) }
  322. /* Altera debug extensions */
  323. .debug_alt_sim_info 0 : { *(.debug_alt_sim_info) }
  324. }
  325. /* provide a pointer for the stack */
  326. /*
  327. * Don't override this, override the __alt_stack_* symbols instead.
  328. */
  329. __alt_data_end = 0x72000;
  330. /*
  331. * The next two symbols define the location of the default stack. You can
  332. * override them to move the stack to a different memory.
  333. */
  334. PROVIDE( __alt_stack_pointer = __alt_data_end );
  335. PROVIDE( __alt_stack_limit = __alt_stack_base );
  336. /*
  337. * This symbol controls where the start of the heap is. If the stack is
  338. * contiguous with the heap then the stack will contract as memory is
  339. * allocated to the heap.
  340. * Override this symbol to put the heap in a different memory.
  341. */
  342. PROVIDE( __alt_heap_start = end );
  343. PROVIDE( __alt_heap_limit = 0x72000 );