efm32gg_rom.ld 3.8 KB

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