efm32g_rom.ld 4.0 KB

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