efm32g_rom.ld 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /***************************************************************************//**
  2. * @file efm32_rom_g.ld
  3. * @brief Linker script for EFM32 gecko
  4. * COPYRIGHT (C) 2012, RT-Thread Development Team
  5. * @author Bernard, onelife
  6. * @version 1.0
  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. * 2012-05-15 onelife Modified to compatible with CMSIS v3
  18. ******************************************************************************/
  19. MEMORY
  20. {
  21. FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 131072
  22. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 16384
  23. }
  24. _system_stack_size = 0x200;
  25. /* Linker script to place sections and symbol values. Should be used together
  26. * with other linker script that defines memory regions FLASH and RAM.
  27. * It references following symbols, which must be defined in code:
  28. * Reset_Handler : Entry of reset handler
  29. *
  30. * It defines following symbols, which code can use without definition:
  31. * __exidx_start
  32. * __exidx_end
  33. * __etext
  34. * __data_start__
  35. * __preinit_array_start
  36. * __preinit_array_end
  37. * __init_array_start
  38. * __init_array_end
  39. * __fini_array_start
  40. * __fini_array_end
  41. * __data_end__
  42. * __bss_start__
  43. * __bss_end__
  44. * __end__
  45. * end
  46. * __HeapLimit
  47. * __StackLimit
  48. * __StackTop
  49. * __stack
  50. */
  51. ENTRY(Reset_Handler)
  52. SECTIONS
  53. {
  54. .text :
  55. {
  56. KEEP(*(.isr_vector))
  57. *(.text*)
  58. KEEP(*(.init))
  59. KEEP(*(.fini))
  60. /* .ctors */
  61. *crtbegin.o(.ctors)
  62. *crtbegin?.o(.ctors)
  63. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  64. *(SORT(.ctors.*))
  65. *(.ctors)
  66. /* .dtors */
  67. *crtbegin.o(.dtors)
  68. *crtbegin?.o(.dtors)
  69. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  70. *(SORT(.dtors.*))
  71. *(.dtors)
  72. *(.rodata*)
  73. KEEP(*(.eh_frame*))
  74. /* section information for finsh shell */
  75. . = ALIGN(4);
  76. __fsymtab_start = .;
  77. KEEP(*(FSymTab))
  78. __fsymtab_end = .;
  79. . = ALIGN(4);
  80. __vsymtab_start = .;
  81. KEEP(*(VSymTab))
  82. __vsymtab_end = .;
  83. . = ALIGN(4);
  84. __rt_init_start = .;
  85. KEEP(*(SORT(.rti_fn*)))
  86. __rt_init_end = .;
  87. . = ALIGN(4);
  88. } > FLASH = 0
  89. .ARM.extab :
  90. {
  91. *(.ARM.extab* .gnu.linkonce.armextab.*)
  92. } > FLASH
  93. __exidx_start = .;
  94. .ARM.exidx :
  95. {
  96. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  97. } > FLASH
  98. __exidx_end = .;
  99. __etext = .;
  100. .data : AT (__etext)
  101. {
  102. __data_start__ = .;
  103. *(vtable)
  104. *(.data*)
  105. *(.ram)
  106. . = ALIGN(4);
  107. /* preinit data */
  108. PROVIDE_HIDDEN (__preinit_array_start = .);
  109. KEEP(*(.preinit_array))
  110. PROVIDE_HIDDEN (__preinit_array_end = .);
  111. . = ALIGN(4);
  112. /* init data */
  113. PROVIDE_HIDDEN (__init_array_start = .);
  114. KEEP(*(SORT(.init_array.*)))
  115. KEEP(*(.init_array))
  116. PROVIDE_HIDDEN (__init_array_end = .);
  117. . = ALIGN(4);
  118. /* finit data */
  119. PROVIDE_HIDDEN (__fini_array_start = .);
  120. KEEP(*(SORT(.fini_array.*)))
  121. KEEP(*(.fini_array))
  122. PROVIDE_HIDDEN (__fini_array_end = .);
  123. . = ALIGN(4);
  124. /* All data end */
  125. __data_end__ = .;
  126. } > RAM
  127. .bss :
  128. {
  129. __bss_start__ = .;
  130. *(.bss*)
  131. *(COMMON)
  132. __bss_end__ = .;
  133. } > RAM
  134. .heap :
  135. {
  136. __end__ = .;
  137. end = __end__;
  138. _end = __end__;
  139. *(.heap*)
  140. __HeapLimit = .;
  141. } > RAM
  142. /* .stack_dummy section doesn't contains any symbols. It is only
  143. * used for linker to calculate size of stack sections, and assign
  144. * values to stack symbols later */
  145. .stack_dummy :
  146. {
  147. *(.stack)
  148. } > RAM
  149. /* Set stack top to end of RAM, and stack limit move down by
  150. * size of stack_dummy section */
  151. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  152. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  153. PROVIDE(__stack = __StackTop);
  154. /* Check if data + heap + stack exceeds RAM limit */
  155. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  156. }