rtthread-mb9bf506.ld 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /* Linker script to configure memory regions
  2. *
  3. * Version:CodeSourcery Sourcery G++ Lite 2007q3-53
  4. * BugURL:https://support.codesourcery.com/GNUToolchain/
  5. *
  6. * Copyright 2007 CodeSourcery.
  7. *
  8. * The authors hereby grant permission to use, copy, modify, distribute,
  9. * and license this software and its documentation for any purpose, provided
  10. * that existing copyright notices are retained in all copies and that this
  11. * notice is included verbatim in any distributions. No written agreement,
  12. * license, or royalty fee is required for any of the authorized uses.
  13. * Modifications to this software may be copyrighted by their authors
  14. * and need not follow the licensing terms described here, provided that
  15. * the new terms are clearly indicated on the first page of each file where
  16. * they apply. */
  17. OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  18. ENTRY(_start)
  19. SEARCH_DIR(.)
  20. MEMORY
  21. {
  22. rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00080000 /* 512k */
  23. ram (rwx) : ORIGIN = 0x1FFF8000, LENGTH = 0x00010000 /* 32k */
  24. }
  25. /* These force the linker to search for particular symbols from
  26. * the start of the link process and thus ensure the user's
  27. * overrides are picked up
  28. */
  29. EXTERN(__cs3_reset_cortex_m)
  30. EXTERN(__cs3_interrupt_vector_cortex_m)
  31. EXTERN(__cs3_start_c main __cs3_stack __cs3_stack_size __cs3_heap_end)
  32. PROVIDE(__cs3_stack = __cs3_region_start_ram + __cs3_region_size_ram);
  33. PROVIDE(__cs3_stack_size = __cs3_region_start_ram + __cs3_region_size_ram - _end);
  34. PROVIDE(__cs3_heap_start = _end);
  35. PROVIDE(__cs3_heap_end = __cs3_region_start_ram + __cs3_region_size_ram);
  36. SECTIONS
  37. {
  38. .text :
  39. {
  40. CREATE_OBJECT_SYMBOLS
  41. __cs3_region_start_rom = .;
  42. *(.cs3.region-head.rom)
  43. __cs3_interrupt_vector = __cs3_interrupt_vector_cortex_m;
  44. *(.cs3.interrupt_vector)
  45. /* Make sure we pulled in an interrupt vector. */
  46. ASSERT (. != __cs3_interrupt_vector_cortex_m, "No interrupt vector");
  47. *(.rom)
  48. *(.rom.b)
  49. __cs3_reset = __cs3_reset_cortex_m;
  50. *(.cs3.reset)
  51. /* Make sure we pulled in some reset code. */
  52. ASSERT (. != __cs3_reset, "No reset code");
  53. *(.text .text.* .gnu.linkonce.t.*)
  54. *(.plt)
  55. *(.gnu.warning)
  56. *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
  57. *(.rodata .rodata.* .gnu.linkonce.r.*)
  58. *(.ARM.extab* .gnu.linkonce.armextab.*)
  59. *(.gcc_except_table)
  60. *(.eh_frame_hdr)
  61. *(.eh_frame)
  62. . = ALIGN(4);
  63. KEEP(*(.init))
  64. . = ALIGN(4);
  65. __preinit_array_start = .;
  66. KEEP (*(.preinit_array))
  67. __preinit_array_end = .;
  68. . = ALIGN(4);
  69. __init_array_start = .;
  70. KEEP (*(SORT(.init_array.*)))
  71. KEEP (*(.init_array))
  72. __init_array_end = .;
  73. . = ALIGN(0x4);
  74. KEEP (*crtbegin.o(.ctors))
  75. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  76. KEEP (*(SORT(.ctors.*)))
  77. KEEP (*crtend.o(.ctors))
  78. . = ALIGN(4);
  79. KEEP(*(.fini))
  80. . = ALIGN(4);
  81. __fini_array_start = .;
  82. KEEP (*(.fini_array))
  83. KEEP (*(SORT(.fini_array.*)))
  84. __fini_array_end = .;
  85. KEEP (*crtbegin.o(.dtors))
  86. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  87. KEEP (*(SORT(.dtors.*)))
  88. KEEP (*crtend.o(.dtors))
  89. . = ALIGN(4);
  90. __cs3_regions = .;
  91. LONG (0)
  92. LONG (__cs3_region_init_ram)
  93. LONG (__cs3_region_start_ram)
  94. LONG (__cs3_region_init_size_ram)
  95. LONG (__cs3_region_zero_size_ram)
  96. /* section information for finsh shell */
  97. . = ALIGN(4);
  98. __fsymtab_start = .;
  99. KEEP(*(FSymTab))
  100. __fsymtab_end = .;
  101. . = ALIGN(4);
  102. __vsymtab_start = .;
  103. KEEP(*(VSymTab))
  104. __vsymtab_end = .;
  105. . = ALIGN(4);
  106. . = ALIGN(4);
  107. __rt_init_start = .;
  108. KEEP(*(SORT(.rti_fn*)))
  109. __rt_init_end = .;
  110. . = ALIGN(4);
  111. }
  112. /* .ARM.exidx is sorted, so has to go in its own output section. */
  113. __exidx_start = .;
  114. .ARM.exidx :
  115. {
  116. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  117. } >rom
  118. __exidx_end = .;
  119. .text.align :
  120. {
  121. . = ALIGN(8);
  122. _etext = .;
  123. } >rom
  124. __cs3_region_size_rom = LENGTH(rom);
  125. __cs3_region_num = 1;
  126. .data :
  127. {
  128. __cs3_region_start_ram = .;
  129. *(.cs3.region-head.ram)
  130. KEEP(*(.jcr))
  131. *(.got.plt) *(.got)
  132. *(.shdata)
  133. *(.data .data.* .gnu.linkonce.d.*)
  134. *(.ram)
  135. . = ALIGN (8);
  136. _edata = .;
  137. } >ram AT>rom
  138. .bss :
  139. {
  140. *(.shbss)
  141. *(.bss .bss.* .gnu.linkonce.b.*)
  142. *(COMMON)
  143. *(.ram.b)
  144. . = ALIGN (8);
  145. _end = .;
  146. __end = .;
  147. } >ram AT>rom
  148. .heap :
  149. {
  150. *(.heap)
  151. } >ram
  152. __bss_end = .;
  153. .stack (__cs3_stack - __cs3_stack_size) :
  154. {
  155. *(.stack)
  156. } >ram
  157. __cs3_region_init_ram = LOADADDR (.data);
  158. __cs3_region_init_size_ram = _edata - __cs3_region_start_ram;
  159. __cs3_region_zero_size_ram = _end - _edata;
  160. __cs3_region_size_ram = LENGTH(ram);
  161. __cs3_region_num = 1;
  162. .stab 0 (NOLOAD) : { *(.stab) }
  163. .stabstr 0 (NOLOAD) : { *(.stabstr) }
  164. /* DWARF debug sections.
  165. * Symbols in the DWARF debugging sections are relative to the beginning
  166. * of the section so we begin them at 0. */
  167. /* DWARF 1 */
  168. .debug 0 : { *(.debug) }
  169. .line 0 : { *(.line) }
  170. /* GNU DWARF 1 extensions */
  171. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  172. .debug_sfnames 0 : { *(.debug_sfnames) }
  173. /* DWARF 1.1 and DWARF 2 */
  174. .debug_aranges 0 : { *(.debug_aranges) }
  175. .debug_pubnames 0 : { *(.debug_pubnames) }
  176. /* DWARF 2 */
  177. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  178. .debug_abbrev 0 : { *(.debug_abbrev) }
  179. .debug_line 0 : { *(.debug_line) }
  180. .debug_frame 0 : { *(.debug_frame) }
  181. .debug_str 0 : { *(.debug_str) }
  182. .debug_loc 0 : { *(.debug_loc) }
  183. .debug_macinfo 0 : { *(.debug_macinfo) }
  184. /* SGI/MIPS DWARF 2 extensions */
  185. .debug_weaknames 0 : { *(.debug_weaknames) }
  186. .debug_funcnames 0 : { *(.debug_funcnames) }
  187. .debug_typenames 0 : { *(.debug_typenames) }
  188. .debug_varnames 0 : { *(.debug_varnames) }
  189. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  190. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  191. /DISCARD/ : { *(.note.GNU-stack) }
  192. }