uc3b0256_rom.ld 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /******************************************************************************
  2. * AVR32 AT32UC3B0256 GNU LD script file.
  3. *
  4. * - Compiler: GNU GCC for AVR32
  5. * - Supported devices: AVR32 AT32UC3B0256
  6. *
  7. * - author Atmel Corporation: http://www.atmel.com \n
  8. * Support and FAQ: http://support.atmel.no/
  9. *
  10. ******************************************************************************/
  11. /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions are met:
  15. *
  16. * 1. Redistributions of source code must retain the above copyright notice, this
  17. * list of conditions and the following disclaimer.
  18. *
  19. * 2. Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. *
  23. * 3. The name of Atmel may not be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * 4. This software may only be redistributed and used in connection with an Atmel
  27. * AVR product.
  28. *
  29. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  30. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  31. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  32. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  33. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  34. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  35. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  36. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  37. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
  39. *
  40. */
  41. OUTPUT_FORMAT("elf32-avr32", "elf32-avr32", "elf32-avr32")
  42. OUTPUT_ARCH(avr32:uc)
  43. ENTRY(_start)
  44. STARTUP(crtavr32.o)
  45. SEARCH_DIR(.)
  46. MEMORY
  47. {
  48. FLASH (rxai!w) : ORIGIN = 0x80000000, LENGTH = 0x00040000
  49. INTRAM (wxa!ri) : ORIGIN = 0x00000004, LENGTH = 0x00007FFC
  50. USERPAGE : ORIGIN = 0x80800000, LENGTH = 0x00000200
  51. }
  52. PHDRS
  53. {
  54. FLASH PT_LOAD;
  55. INTRAM_ALIGN PT_NULL;
  56. INTRAM_AT_FLASH PT_LOAD;
  57. INTRAM PT_NULL;
  58. USERPAGE PT_LOAD;
  59. }
  60. SECTIONS
  61. {
  62. __ram_start__ = ORIGIN(INTRAM);
  63. __ram_size__ = LENGTH(INTRAM);
  64. /* If this heap size is selected, all the INTRAM space from the end of the
  65. data area to the beginning of the stack will be allocated for the heap. */
  66. __max_heap_size__ = -1;
  67. /* Use a default heap size if heap size was not defined. */
  68. __heap_size__ = DEFINED(__heap_size__) ? __heap_size__ : __max_heap_size__;
  69. /* Use a default stack size if stack size was not defined. */
  70. __stack_size__ = DEFINED(__stack_size__) ? __stack_size__ : 4K;
  71. /* Read-only sections, merged into text segment: */
  72. PROVIDE (__executable_start = 0x80000000); . = 0x80000000;
  73. .interp : { *(.interp) } >FLASH AT>FLASH :FLASH
  74. .reset : { *(.reset) } >FLASH AT>FLASH :FLASH
  75. .hash : { *(.hash) } >FLASH AT>FLASH :FLASH
  76. .dynsym : { *(.dynsym) } >FLASH AT>FLASH :FLASH
  77. .dynstr : { *(.dynstr) } >FLASH AT>FLASH :FLASH
  78. .gnu.version : { *(.gnu.version) } >FLASH AT>FLASH :FLASH
  79. .gnu.version_d : { *(.gnu.version_d) } >FLASH AT>FLASH :FLASH
  80. .gnu.version_r : { *(.gnu.version_r) } >FLASH AT>FLASH :FLASH
  81. .rel.init : { *(.rel.init) } >FLASH AT>FLASH :FLASH
  82. .rela.init : { *(.rela.init) } >FLASH AT>FLASH :FLASH
  83. .rel.text : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) } >FLASH AT>FLASH :FLASH
  84. .rela.text : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) } >FLASH AT>FLASH :FLASH
  85. .rel.fini : { *(.rel.fini) } >FLASH AT>FLASH :FLASH
  86. .rela.fini : { *(.rela.fini) } >FLASH AT>FLASH :FLASH
  87. .rel.rodata : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) } >FLASH AT>FLASH :FLASH
  88. .rela.rodata : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) } >FLASH AT>FLASH :FLASH
  89. .rel.data.rel.ro : { *(.rel.data.rel.ro*) } >FLASH AT>FLASH :FLASH
  90. .rela.data.rel.ro : { *(.rel.data.rel.ro*) } >FLASH AT>FLASH :FLASH
  91. .rel.data : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) } >FLASH AT>FLASH :FLASH
  92. .rela.data : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) } >FLASH AT>FLASH :FLASH
  93. .rel.tdata : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) } >FLASH AT>FLASH :FLASH
  94. .rela.tdata : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) } >FLASH AT>FLASH :FLASH
  95. .rel.tbss : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) } >FLASH AT>FLASH :FLASH
  96. .rela.tbss : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) } >FLASH AT>FLASH :FLASH
  97. .rel.ctors : { *(.rel.ctors) } >FLASH AT>FLASH :FLASH
  98. .rela.ctors : { *(.rela.ctors) } >FLASH AT>FLASH :FLASH
  99. .rel.dtors : { *(.rel.dtors) } >FLASH AT>FLASH :FLASH
  100. .rela.dtors : { *(.rela.dtors) } >FLASH AT>FLASH :FLASH
  101. .rel.got : { *(.rel.got) } >FLASH AT>FLASH :FLASH
  102. .rela.got : { *(.rela.got) } >FLASH AT>FLASH :FLASH
  103. .rel.bss : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) } >FLASH AT>FLASH :FLASH
  104. .rela.bss : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) } >FLASH AT>FLASH :FLASH
  105. .rel.plt : { *(.rel.plt) } >FLASH AT>FLASH :FLASH
  106. .rela.plt : { *(.rela.plt) } >FLASH AT>FLASH :FLASH
  107. .init :
  108. {
  109. KEEP (*(.init))
  110. } >FLASH AT>FLASH :FLASH =0xd703d703
  111. .plt : { *(.plt) } >FLASH AT>FLASH :FLASH
  112. .text :
  113. {
  114. *(.text .stub .text.* .gnu.linkonce.t.*)
  115. KEEP (*(.text.*personality*))
  116. /* .gnu.warning sections are handled specially by elf32.em. */
  117. *(.gnu.warning)
  118. } >FLASH AT>FLASH :FLASH =0xd703d703
  119. .fini :
  120. {
  121. KEEP (*(.fini))
  122. } >FLASH AT>FLASH :FLASH =0xd703d703
  123. PROVIDE (__etext = .);
  124. PROVIDE (_etext = .);
  125. PROVIDE (etext = .);
  126. .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } >FLASH AT>FLASH :FLASH
  127. .rodata1 : { *(.rodata1) } >FLASH AT>FLASH :FLASH
  128. .eh_frame_hdr : { *(.eh_frame_hdr) } >FLASH AT>FLASH :FLASH
  129. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } >FLASH AT>FLASH :FLASH
  130. .gcc_except_table : ONLY_IF_RO { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >FLASH AT>FLASH :FLASH
  131. .lalign : { . = ALIGN(8); PROVIDE(_data_lma = .); } >FLASH AT>FLASH :FLASH
  132. . = ORIGIN(INTRAM);
  133. .dalign : { . = ALIGN(8); PROVIDE(_data = .); } >INTRAM AT>INTRAM :INTRAM_ALIGN
  134. /* Exception handling */
  135. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  136. .gcc_except_table : ONLY_IF_RW { KEEP (*(.gcc_except_table)) *(.gcc_except_table.*) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  137. /* Thread Local Storage sections */
  138. .tdata : { *(.tdata .tdata.* .gnu.linkonce.td.*) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  139. .tbss : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  140. /* Ensure the __preinit_array_start label is properly aligned. We
  141. could instead move the label definition inside the section, but
  142. the linker would then create the section even if it turns out to
  143. be empty, which isn't pretty. */
  144. PROVIDE (__preinit_array_start = ALIGN(32 / 8));
  145. .preinit_array : { KEEP (*(.preinit_array)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  146. PROVIDE (__preinit_array_end = .);
  147. PROVIDE (__init_array_start = .);
  148. .init_array : { KEEP (*(.init_array)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  149. PROVIDE (__init_array_end = .);
  150. PROVIDE (__fini_array_start = .);
  151. .fini_array : { KEEP (*(.fini_array)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  152. PROVIDE (__fini_array_end = .);
  153. .ctors :
  154. {
  155. /* gcc uses crtbegin.o to find the start of
  156. the constructors, so we make sure it is
  157. first. Because this is a wildcard, it
  158. doesn't matter if the user does not
  159. actually link against crtbegin.o; the
  160. linker won't look for a file to match a
  161. wildcard. The wildcard also means that it
  162. doesn't matter which directory crtbegin.o
  163. is in. */
  164. KEEP (*crtbegin*.o(.ctors))
  165. /* We don't want to include the .ctor section from
  166. from the crtend.o file until after the sorted ctors.
  167. The .ctor section from the crtend file contains the
  168. end of ctors marker and it must be last */
  169. KEEP (*(EXCLUDE_FILE (*crtend*.o ) .ctors))
  170. KEEP (*(SORT(.ctors.*)))
  171. KEEP (*(.ctors))
  172. } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  173. .dtors :
  174. {
  175. KEEP (*crtbegin*.o(.dtors))
  176. KEEP (*(EXCLUDE_FILE (*crtend*.o ) .dtors))
  177. KEEP (*(SORT(.dtors.*)))
  178. KEEP (*(.dtors))
  179. } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  180. .jcr : { KEEP (*(.jcr)) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  181. .data.rel.ro : { *(.data.rel.ro.local) *(.data.rel.ro*) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  182. .dynamic : { *(.dynamic) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  183. .got : { *(.got.plt) *(.got) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  184. .ramtext : { *(.ramtext .ramtext.*) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  185. .ddalign : { . = ALIGN(8); } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  186. .data :
  187. {
  188. *(.data .data.* .gnu.linkonce.d.*)
  189. KEEP (*(.gnu.linkonce.d.*personality*))
  190. SORT(CONSTRUCTORS)
  191. } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  192. .data1 : { *(.data1) } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  193. .balign : { . = ALIGN(8); PROVIDE(_edata = .); } >INTRAM AT>FLASH :INTRAM_AT_FLASH
  194. PROVIDE (edata = .);
  195. __bss_start = .;
  196. .bss :
  197. {
  198. *(.dynbss)
  199. *(.bss .bss.* .gnu.linkonce.b.*)
  200. *(COMMON)
  201. /* Align here to ensure that the .bss section occupies space up to
  202. _end. Align after .bss to ensure correct alignment even if the
  203. .bss section disappears because there are no input sections. */
  204. . = ALIGN(8);
  205. } >INTRAM AT>INTRAM :INTRAM
  206. . = ALIGN(8);
  207. _end = .;
  208. PROVIDE (end = .);
  209. PROVIDE (__bss_end = .);
  210. __heap_start__ = ALIGN(8);
  211. PROVIDE (__heap_start = .);
  212. .heap :
  213. {
  214. *(.heap)
  215. . = (__heap_size__ == __max_heap_size__) ?
  216. ORIGIN(INTRAM) + LENGTH(INTRAM) - __stack_size__ - ABSOLUTE(.) :
  217. __heap_size__;
  218. } >INTRAM AT>INTRAM :INTRAM
  219. __heap_end__ = .;
  220. /* Stabs debugging sections. */
  221. .stab 0 : { *(.stab) }
  222. .stabstr 0 : { *(.stabstr) }
  223. .stab.excl 0 : { *(.stab.excl) }
  224. .stab.exclstr 0 : { *(.stab.exclstr) }
  225. .stab.index 0 : { *(.stab.index) }
  226. .stab.indexstr 0 : { *(.stab.indexstr) }
  227. .comment 0 : { *(.comment) }
  228. /* DWARF debug sections.
  229. Symbols in the DWARF debugging sections are relative to the beginning
  230. of the section so we begin them at 0. */
  231. /* DWARF 1 */
  232. .debug 0 : { *(.debug) }
  233. .line 0 : { *(.line) }
  234. /* GNU DWARF 1 extensions */
  235. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  236. .debug_sfnames 0 : { *(.debug_sfnames) }
  237. /* DWARF 1.1 and DWARF 2 */
  238. .debug_aranges 0 : { *(.debug_aranges) }
  239. .debug_pubnames 0 : { *(.debug_pubnames) }
  240. /* DWARF 2 */
  241. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  242. .debug_abbrev 0 : { *(.debug_abbrev) }
  243. .debug_line 0 : { *(.debug_line) }
  244. .debug_frame 0 : { *(.debug_frame) }
  245. .debug_str 0 : { *(.debug_str) }
  246. .debug_loc 0 : { *(.debug_loc) }
  247. .debug_macinfo 0 : { *(.debug_macinfo) }
  248. /* SGI/MIPS DWARF 2 extensions */
  249. .debug_weaknames 0 : { *(.debug_weaknames) }
  250. .debug_funcnames 0 : { *(.debug_funcnames) }
  251. .debug_typenames 0 : { *(.debug_typenames) }
  252. .debug_varnames 0 : { *(.debug_varnames) }
  253. .stack ORIGIN(INTRAM) + LENGTH(INTRAM) - __stack_size__ :
  254. {
  255. _stack = .;
  256. *(.stack)
  257. . = __stack_size__;
  258. _estack = .;
  259. } >INTRAM AT>INTRAM :INTRAM
  260. .userpage : { *(.userpage .userpage.*) } >USERPAGE AT>USERPAGE :USERPAGE
  261. /DISCARD/ : { *(.note.GNU-stack) }
  262. }