You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

208 lines
5.1 KiB

  1. /* Linker script for Silicon Labs EFM32TG devices */
  2. /* */
  3. /* This file is subject to the license terms as defined in ARM's */
  4. /* CMSIS END USER LICENSE AGREEMENT.pdf, governing the use of */
  5. /* Example Code. */
  6. /* */
  7. /* Copyright 2016 Silicon Laboratories, Inc. http://www.silabs.com */
  8. /* */
  9. /* Version 4.4.0 */
  10. /* */
  11. MEMORY
  12. {
  13. FLASH (rx) : ORIGIN = 0x00000800, LENGTH = 30720
  14. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 4096
  15. }
  16. /* Linker script to place sections and symbol values. Should be used together
  17. * with other linker script that defines memory regions FLASH and RAM.
  18. * It references following symbols, which must be defined in code:
  19. * Reset_Handler : Entry of reset handler
  20. *
  21. * It defines following symbols, which code can use without definition:
  22. * __exidx_start
  23. * __exidx_end
  24. * __copy_table_start__
  25. * __copy_table_end__
  26. * __zero_table_start__
  27. * __zero_table_end__
  28. * __etext
  29. * __data_start__
  30. * __preinit_array_start
  31. * __preinit_array_end
  32. * __init_array_start
  33. * __init_array_end
  34. * __fini_array_start
  35. * __fini_array_end
  36. * __data_end__
  37. * __bss_start__
  38. * __bss_end__
  39. * __end__
  40. * end
  41. * __HeapLimit
  42. * __StackLimit
  43. * __StackTop
  44. * __stack
  45. * __Vectors_End
  46. * __Vectors_Size
  47. */
  48. ENTRY(Reset_Handler)
  49. SECTIONS
  50. {
  51. .text :
  52. {
  53. KEEP(*(.vectors))
  54. __Vectors_End = .;
  55. __Vectors_Size = __Vectors_End - __Vectors;
  56. __end__ = .;
  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. } > FLASH
  75. .ARM.extab :
  76. {
  77. *(.ARM.extab* .gnu.linkonce.armextab.*)
  78. } > FLASH
  79. __exidx_start = .;
  80. .ARM.exidx :
  81. {
  82. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  83. } > FLASH
  84. __exidx_end = .;
  85. /* To copy multiple ROM to RAM sections,
  86. * uncomment .copy.table section and,
  87. * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
  88. /*
  89. .copy.table :
  90. {
  91. . = ALIGN(4);
  92. __copy_table_start__ = .;
  93. LONG (__etext)
  94. LONG (__data_start__)
  95. LONG (__data_end__ - __data_start__)
  96. LONG (__etext2)
  97. LONG (__data2_start__)
  98. LONG (__data2_end__ - __data2_start__)
  99. __copy_table_end__ = .;
  100. } > FLASH
  101. */
  102. /* To clear multiple BSS sections,
  103. * uncomment .zero.table section and,
  104. * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
  105. /*
  106. .zero.table :
  107. {
  108. . = ALIGN(4);
  109. __zero_table_start__ = .;
  110. LONG (__bss_start__)
  111. LONG (__bss_end__ - __bss_start__)
  112. LONG (__bss2_start__)
  113. LONG (__bss2_end__ - __bss2_start__)
  114. __zero_table_end__ = .;
  115. } > FLASH
  116. */
  117. __etext = .;
  118. .data : AT (__etext)
  119. {
  120. __data_start__ = .;
  121. *(vtable)
  122. *(.data*)
  123. . = ALIGN (4);
  124. *(.ram)
  125. . = ALIGN(4);
  126. /* preinit data */
  127. PROVIDE_HIDDEN (__preinit_array_start = .);
  128. KEEP(*(.preinit_array))
  129. PROVIDE_HIDDEN (__preinit_array_end = .);
  130. . = ALIGN(4);
  131. /* init data */
  132. PROVIDE_HIDDEN (__init_array_start = .);
  133. KEEP(*(SORT(.init_array.*)))
  134. KEEP(*(.init_array))
  135. PROVIDE_HIDDEN (__init_array_end = .);
  136. . = ALIGN(4);
  137. /* finit data */
  138. PROVIDE_HIDDEN (__fini_array_start = .);
  139. KEEP(*(SORT(.fini_array.*)))
  140. KEEP(*(.fini_array))
  141. PROVIDE_HIDDEN (__fini_array_end = .);
  142. KEEP(*(.jcr*))
  143. . = ALIGN(4);
  144. /* All data end */
  145. __data_end__ = .;
  146. } > RAM
  147. .bss :
  148. {
  149. . = ALIGN(4);
  150. __bss_start__ = .;
  151. *(.bss*)
  152. *(COMMON)
  153. . = ALIGN(4);
  154. __bss_end__ = .;
  155. } > RAM
  156. .heap (COPY):
  157. {
  158. __HeapBase = .;
  159. __end__ = .;
  160. end = __end__;
  161. _end = __end__;
  162. KEEP(*(.heap*))
  163. __HeapLimit = .;
  164. } > RAM
  165. /* .stack_dummy section doesn't contains any symbols. It is only
  166. * used for linker to calculate size of stack sections, and assign
  167. * values to stack symbols later */
  168. .stack_dummy (COPY):
  169. {
  170. KEEP(*(.stack*))
  171. } > RAM
  172. /* Set stack top to end of RAM, and stack limit move down by
  173. * size of stack_dummy section */
  174. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  175. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  176. PROVIDE(__stack = __StackTop);
  177. /* Check if data + heap + stack exceeds RAM limit */
  178. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  179. /* Check if FLASH usage exceeds FLASH size */
  180. ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
  181. }