Advertisement
gelmuda

osm linker

Mar 5th, 2016
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.02 KB | None | 0 0
  1. /* Linker script for Silicon Labs EFM32WG 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. /* Silicon Laboratories, Inc. 2015 */
  8. /* */
  9. /* Version 4.2.0 */
  10. /* */
  11.  
  12. MEMORY
  13. {
  14. FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 262144
  15. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32768
  16. }
  17.  
  18. /* Linker script to place sections and symbol values. Should be used together
  19. * with other linker script that defines memory regions FLASH and RAM.
  20. * It references following symbols, which must be defined in code:
  21. * Reset_Handler : Entry of reset handler
  22. *
  23. * It defines following symbols, which code can use without definition:
  24. * __exidx_start
  25. * __exidx_end
  26. * __copy_table_start__
  27. * __copy_table_end__
  28. * __zero_table_start__
  29. * __zero_table_end__
  30. * __etext
  31. * __data_start__
  32. * __preinit_array_start
  33. * __preinit_array_end
  34. * __init_array_start
  35. * __init_array_end
  36. * __fini_array_start
  37. * __fini_array_end
  38. * __data_end__
  39. * __bss_start__
  40. * __bss_end__
  41. * __end__
  42. * end
  43. * __HeapLimit
  44. * __StackLimit
  45. * __StackTop
  46. * __stack
  47. * __Vectors_End
  48. * __Vectors_Size
  49. */
  50. ENTRY(Reset_Handler)
  51.  
  52. SECTIONS
  53. {
  54. .text :
  55. {
  56. KEEP(*(.vectors))
  57. __Vectors_End = .;
  58. __Vectors_Size = __Vectors_End - __Vectors;
  59. __end__ = .;
  60.  
  61. *(.text*)
  62.  
  63. KEEP(*(.init))
  64. KEEP(*(.fini))
  65.  
  66. /* .ctors */
  67. *crtbegin.o(.ctors)
  68. *crtbegin?.o(.ctors)
  69. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  70. *(SORT(.ctors.*))
  71. *(.ctors)
  72.  
  73. /* .dtors */
  74. *crtbegin.o(.dtors)
  75. *crtbegin?.o(.dtors)
  76. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  77. *(SORT(.dtors.*))
  78. *(.dtors)
  79.  
  80. *(.rodata*)
  81.  
  82. KEEP(*(.eh_frame*))
  83. } > FLASH
  84.  
  85. .ARM.extab :
  86. {
  87. *(.ARM.extab* .gnu.linkonce.armextab.*)
  88. } > FLASH
  89.  
  90. __exidx_start = .;
  91. .ARM.exidx :
  92. {
  93. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  94. } > FLASH
  95. __exidx_end = .;
  96.  
  97. /* To copy multiple ROM to RAM sections,
  98. * uncomment .copy.table section and,
  99. * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
  100. /*
  101. .copy.table :
  102. {
  103. . = ALIGN(4);
  104. __copy_table_start__ = .;
  105. LONG (__etext)
  106. LONG (__data_start__)
  107. LONG (__data_end__ - __data_start__)
  108. LONG (__etext2)
  109. LONG (__data2_start__)
  110. LONG (__data2_end__ - __data2_start__)
  111. __copy_table_end__ = .;
  112. } > FLASH
  113. */
  114.  
  115. /* To clear multiple BSS sections,
  116. * uncomment .zero.table section and,
  117. * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
  118. /*
  119. .zero.table :
  120. {
  121. . = ALIGN(4);
  122. __zero_table_start__ = .;
  123. LONG (__bss_start__)
  124. LONG (__bss_end__ - __bss_start__)
  125. LONG (__bss2_start__)
  126. LONG (__bss2_end__ - __bss2_start__)
  127. __zero_table_end__ = .;
  128. } > FLASH
  129. */
  130.  
  131. __etext = .;
  132.  
  133. .data : AT (__etext)
  134. {
  135. __data_start__ = .;
  136. *(vtable)
  137. *(.data*)
  138. . = ALIGN (4);
  139. *(.ram)
  140.  
  141. . = ALIGN(4);
  142. /* preinit data */
  143. PROVIDE_HIDDEN (__preinit_array_start = .);
  144. KEEP(*(.preinit_array))
  145. PROVIDE_HIDDEN (__preinit_array_end = .);
  146.  
  147. . = ALIGN(4);
  148. /* init data */
  149. PROVIDE_HIDDEN (__init_array_start = .);
  150. KEEP(*(SORT(.init_array.*)))
  151. KEEP(*(.init_array))
  152. PROVIDE_HIDDEN (__init_array_end = .);
  153.  
  154. . = ALIGN(4);
  155. /* finit data */
  156. PROVIDE_HIDDEN (__fini_array_start = .);
  157. KEEP(*(SORT(.fini_array.*)))
  158. KEEP(*(.fini_array))
  159. PROVIDE_HIDDEN (__fini_array_end = .);
  160.  
  161. KEEP(*(.jcr*))
  162. . = ALIGN(4);
  163. /* All data end */
  164. __data_end__ = .;
  165.  
  166. } > RAM
  167.  
  168. .bss :
  169. {
  170. . = ALIGN(4);
  171. __bss_start__ = .;
  172. *(.bss*)
  173. *(COMMON)
  174. . = ALIGN(4);
  175. __bss_end__ = .;
  176. } > RAM
  177.  
  178. .heap (COPY):
  179. {
  180. __HeapBase = .;
  181. __end__ = .;
  182. end = __end__;
  183. _end = __end__;
  184. KEEP(*(.heap*))
  185. __HeapLimit = .;
  186. } > RAM
  187.  
  188. /* .stack_dummy section doesn't contains any symbols. It is only
  189. * used for linker to calculate size of stack sections, and assign
  190. * values to stack symbols later */
  191. .stack_dummy (COPY):
  192. {
  193. KEEP(*(.stack*))
  194. } > RAM
  195.  
  196. /* Set stack top to end of RAM, and stack limit move down by
  197. * size of stack_dummy section */
  198. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  199. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  200. PROVIDE(__stack = __StackTop);
  201.  
  202. /* Check if data + heap + stack exceeds RAM limit */
  203. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  204.  
  205. /* Check if FLASH usage exceeds FLASH size */
  206. ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement