efm32_rom.ld 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /***************************************************************************//**
  2. * @file efm32_rom.ld
  3. * @brief Linker script for EFM32 with GNU ld
  4. * COPYRIGHT (C) 2011, RT-Thread Development Team
  5. * @author Bernard, onelife
  6. * @version 0.4 beta
  7. *******************************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file
  10. * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
  11. *******************************************************************************
  12. * @section Change Logs
  13. * Date Author Notes
  14. * 2009-10-14 Bernard first version
  15. * 2010-12-22 onelife Modify for EFM32
  16. * 2011-07-06 onelife Modify to make use the start code in libraries
  17. ******************************************************************************/
  18. OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  19. ENTRY(__cs3_reset)
  20. SEARCH_DIR(.)
  21. GROUP(-lgcc -lc -lcs3 -lcs3unhosted)
  22. MEMORY
  23. {
  24. CODE (rx) : ORIGIN = 0x00000000, LENGTH = 128K
  25. DATA (rwx) : ORIGIN = 0x20000000, LENGTH = 16K
  26. }
  27. _system_stack_size = 0x200;
  28. /* These force the linker to search for particular symbols from
  29. * the start of the link process and thus ensure the user's
  30. * overrides are picked up
  31. */
  32. EXTERN(__cs3_reset __cs3_reset_efm32)
  33. EXTERN(__cs3_start_asm _start)
  34. PROVIDE(__cs3_reset = __cs3_reset_efm32);
  35. PROVIDE(__cs3_start_asm = _start);
  36. SECTIONS
  37. {
  38. .text :
  39. {
  40. . = ALIGN(4);
  41. KEEP(*(.cs3.interrupt_vector)) /* Startup code */
  42. . = ALIGN(4);
  43. *(.cs3.reset)
  44. *(.cs3.init)
  45. *(.text) /* remaining code */
  46. *(.text.*) /* remaining code */
  47. *(.rodata) /* read-only data (constants) */
  48. *(.rodata*)
  49. *(.glue_7)
  50. *(.glue_7t)
  51. *(.gnu.linkonce.t*)
  52. /* section information for finsh shell */
  53. . = ALIGN(4);
  54. __fsymtab_start = .;
  55. KEEP(*(FSymTab))
  56. __fsymtab_end = .;
  57. . = ALIGN(4);
  58. __vsymtab_start = .;
  59. KEEP(*(VSymTab))
  60. __vsymtab_end = .;
  61. . = ALIGN(4);
  62. . = ALIGN(4);
  63. _etext = .;
  64. } > CODE = 0
  65. /* .ARM.exidx is sorted, so has to go in its own output section. */
  66. __exidx_start = .;
  67. .ARM.exidx :
  68. {
  69. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  70. /* This is used by the startup in order to initialize the .data secion */
  71. _sidata = .;
  72. } > CODE
  73. __exidx_end = .;
  74. /* .data section which is used for initialized data */
  75. .data : AT (_sidata)
  76. {
  77. . = ALIGN(4);
  78. /* This is used by the startup in order to initialize the .data secion */
  79. _sdata = . ;
  80. *(.data)
  81. *(.data.*)
  82. *(.gnu.linkonce.d*)
  83. . = ALIGN(4);
  84. /* This is used by the startup in order to initialize the .data secion */
  85. _edata = . ;
  86. } >DATA
  87. .stack :
  88. {
  89. . = . + _system_stack_size;
  90. . = ALIGN(4);
  91. __cs3_stack = .;
  92. } >DATA
  93. __bss_start = .;
  94. .bss :
  95. {
  96. . = ALIGN(4);
  97. /* This is used by the startup in order to initialize the .bss secion */
  98. _sbss = .;
  99. *(.bss)
  100. *(.bss.*)
  101. *(COMMON)
  102. . = ALIGN(4);
  103. /* This is used by the startup in order to initialize the .bss secion */
  104. _ebss = . ;
  105. *(.bss.init)
  106. } > DATA
  107. __bss_end = .;
  108. _end = .;
  109. /* Stabs debugging sections. */
  110. .stab 0 : { *(.stab) }
  111. .stabstr 0 : { *(.stabstr) }
  112. .stab.excl 0 : { *(.stab.excl) }
  113. .stab.exclstr 0 : { *(.stab.exclstr) }
  114. .stab.index 0 : { *(.stab.index) }
  115. .stab.indexstr 0 : { *(.stab.indexstr) }
  116. .comment 0 : { *(.comment) }
  117. /* DWARF debug sections.
  118. * Symbols in the DWARF debugging sections are relative to
  119. * the beginning of the section so we begin them at 0.
  120. */
  121. /* DWARF 1 */
  122. .debug 0 : { *(.debug) }
  123. .line 0 : { *(.line) }
  124. /* GNU DWARF 1 extensions */
  125. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  126. .debug_sfnames 0 : { *(.debug_sfnames) }
  127. /* DWARF 1.1 and DWARF 2 */
  128. .debug_aranges 0 : { *(.debug_aranges) }
  129. .debug_pubnames 0 : { *(.debug_pubnames) }
  130. /* DWARF 2 */
  131. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  132. .debug_abbrev 0 : { *(.debug_abbrev) }
  133. .debug_line 0 : { *(.debug_line) }
  134. .debug_frame 0 : { *(.debug_frame) }
  135. .debug_str 0 : { *(.debug_str) }
  136. .debug_loc 0 : { *(.debug_loc) }
  137. .debug_macinfo 0 : { *(.debug_macinfo) }
  138. /* DWARF 2.1 */
  139. .debug_ranges 0 : { *(.debug_ranges) }
  140. /* SGI/MIPS DWARF 2 extensions */
  141. .debug_weaknames 0 : { *(.debug_weaknames) }
  142. .debug_funcnames 0 : { *(.debug_funcnames) }
  143. .debug_typenames 0 : { *(.debug_typenames) }
  144. .debug_varnames 0 : { *(.debug_varnames) }
  145. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  146. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  147. /DISCARD/ : { *(.note.GNU-stack) }
  148. }