link.lds 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. /*
  2. *-------- <<< Use Configuration Wizard in Context Menu >>> -------------------
  3. */
  4. /*---------------------- Flash Configuration ----------------------------------
  5. <h> Flash Configuration
  6. <o0> Flash Base Address <0x0-0xFFFFFFFF:8>
  7. <o1> Flash Size (in Bytes) <0x0-0xFFFFFFFF:8>
  8. </h>
  9. -----------------------------------------------------------------------------*/
  10. __ROM_BASE = 0x08000000;
  11. __ROM_SIZE = 0x00040000;
  12. /*--------------------- Embedded RAM Configuration ----------------------------
  13. <h> RAM Configuration
  14. <o0> RAM Base Address <0x0-0xFFFFFFFF:8>
  15. <o1> RAM Size (in Bytes) <0x0-0xFFFFFFFF:8>
  16. </h>
  17. -----------------------------------------------------------------------------*/
  18. __RAM_BASE = 0x30000000;
  19. __RAM_SIZE = 0x0001C000;
  20. /*--------------------- Stack / Heap Configuration ----------------------------
  21. <h> Stack / Heap Configuration
  22. <o0> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
  23. <o1> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
  24. </h>
  25. -----------------------------------------------------------------------------*/
  26. __STACK_SIZE = 0x00001000;
  27. /*__HEAP_SIZE = 0x00001000;*/
  28. /*
  29. *-------------------- <<< end of configuration section >>> -------------------
  30. */
  31. /* ARMv8-M stack sealing:
  32. to use ARMv8-M stack sealing set __STACKSEAL_SIZE to 8 otherwise keep 0
  33. */
  34. __STACKSEAL_SIZE = 0;
  35. MEMORY
  36. {
  37. FLASH (rx) : ORIGIN = __ROM_BASE, LENGTH = __ROM_SIZE
  38. RAM (rwx) : ORIGIN = __RAM_BASE, LENGTH = __RAM_SIZE
  39. }
  40. /* Linker script to place sections and symbol values. Should be used together
  41. * with other linker script that defines memory regions FLASH and RAM.
  42. * It references following symbols, which must be defined in code:
  43. * Reset_Handler : Entry of reset handler
  44. *
  45. * It defines following symbols, which code can use without definition:
  46. * __exidx_start
  47. * __exidx_end
  48. * __copy_table_start__
  49. * __copy_table_end__
  50. * __zero_table_start__
  51. * __zero_table_end__
  52. * __etext
  53. * __data_start__
  54. * __preinit_array_start
  55. * __preinit_array_end
  56. * __init_array_start
  57. * __init_array_end
  58. * __fini_array_start
  59. * __fini_array_end
  60. * __data_end__
  61. * __bss_start__
  62. * __bss_end__
  63. * __end__
  64. * end
  65. * __HeapLimit
  66. * __StackLimit
  67. * __StackTop
  68. * __stack
  69. * __StackSeal (only if ARMv8-M stack sealing is used)
  70. */
  71. ENTRY(Reset_Handler)
  72. SECTIONS
  73. {
  74. .text :
  75. {
  76. . = ALIGN(4);
  77. KEEP(*(.vectors))
  78. . = ALIGN(4);
  79. *(.text) /* remaining code */
  80. *(.text.*) /* remaining code */
  81. *(.rodata) /* read-only data (constants) */
  82. *(.rodata*)
  83. *(.glue_7)
  84. *(.glue_7t)
  85. *(.gnu.linkonce.t*)
  86. /* section information for finsh shell */
  87. . = ALIGN(4);
  88. __fsymtab_start = .;
  89. KEEP(*(FSymTab))
  90. __fsymtab_end = .;
  91. . = ALIGN(4);
  92. __vsymtab_start = .;
  93. KEEP(*(VSymTab))
  94. __vsymtab_end = .;
  95. /* section information for initial. */
  96. . = ALIGN(4);
  97. __rt_init_start = .;
  98. KEEP(*(SORT(.rti_fn*)))
  99. __rt_init_end = .;
  100. . = ALIGN(4);
  101. PROVIDE(__ctors_start__ = .);
  102. KEEP (*(SORT(.init_array.*)))
  103. KEEP (*(.init_array))
  104. PROVIDE(__ctors_end__ = .);
  105. . = ALIGN(4);
  106. _etext = .;
  107. } > FLASH
  108. /*
  109. * SG veneers:
  110. * All SG veneers are placed in the special output section .gnu.sgstubs. Its start address
  111. * must be set, either with the command line option ��--section-start�� or in a linker script,
  112. * to indicate where to place these veneers in memory.
  113. */
  114. /*
  115. .gnu.sgstubs :
  116. {
  117. . = ALIGN(32);
  118. } > FLASH
  119. */
  120. .ARM.extab :
  121. {
  122. *(.ARM.extab* .gnu.linkonce.armextab.*)
  123. } > FLASH
  124. __exidx_start = .;
  125. .ARM.exidx :
  126. {
  127. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  128. /* This is used by the startup in order to initialize the .data secion */
  129. _sidata = .;
  130. } > FLASH
  131. __exidx_end = .;
  132. __etext = ALIGN (4);
  133. .data : AT (__etext)
  134. {
  135. . = ALIGN(4);
  136. /* This is used by the startup in order to initialize the .data secion */
  137. _sdata = . ;
  138. *(.data)
  139. *(.data.*)
  140. *(.gnu.linkonce.d*)
  141. PROVIDE(__dtors_start__ = .);
  142. KEEP(*(SORT(.dtors.*)))
  143. KEEP(*(.dtors))
  144. PROVIDE(__dtors_end__ = .);
  145. . = ALIGN(4);
  146. /* This is used by the startup in order to initialize the .data secion */
  147. _edata = . ;
  148. } > RAM
  149. /*
  150. * Secondary data section, optional
  151. *
  152. * Remember to add each additional data section
  153. * to the .copy.table above to asure proper
  154. * initialization during startup.
  155. */
  156. /*
  157. __etext2 = ALIGN (4);
  158. .data2 : AT (__etext2)
  159. {
  160. . = ALIGN(4);
  161. __data2_start__ = .;
  162. *(.data2)
  163. *(.data2.*)
  164. . = ALIGN(4);
  165. __data2_end__ = .;
  166. } > RAM2
  167. */
  168. /*
  169. .heap (COPY) :
  170. {
  171. . = ALIGN(8);
  172. __end__ = .;
  173. PROVIDE(end = .);
  174. . = . + __HEAP_SIZE;
  175. . = ALIGN(8);
  176. __HeapLimit = .;
  177. } > RAM
  178. */
  179. /* ARMv8-M stack sealing:
  180. to use ARMv8-M stack sealing uncomment '.stackseal' section
  181. */
  182. /*
  183. .stackseal :
  184. {
  185. . = ALIGN(8);
  186. __StackSeal = .;
  187. . = . + 8;
  188. . = ALIGN(8);
  189. } > RAM
  190. */
  191. .stack :
  192. {
  193. . = ALIGN(8);
  194. _sstack = .;
  195. . = . + __STACK_SIZE;
  196. . = ALIGN(8);
  197. _estack = .;
  198. } > RAM
  199. __bss_start__ = .;
  200. .bss :
  201. {
  202. . = ALIGN(4);
  203. _sbss = .;
  204. *(.bss)
  205. *(.bss.*)
  206. *(COMMON)
  207. . = ALIGN(4);
  208. _ebss = . ;
  209. *(.bss.init)
  210. } > RAM
  211. __bss_end__ = .;
  212. /*
  213. * Secondary bss section, optional
  214. *
  215. * Remember to add each additional bss section
  216. * to the .zero.table above to asure proper
  217. * initialization during startup.
  218. */
  219. /*
  220. .bss2 :
  221. {
  222. . = ALIGN(4);
  223. __bss2_start__ = .;
  224. *(.bss2)
  225. *(.bss2.*)
  226. . = ALIGN(4);
  227. __bss2_end__ = .;
  228. } > RAM2 AT > RAM2
  229. */
  230. }