STM32L432KCUx_FLASH.ld 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : LinkerScript.ld
  5. **
  6. ** Abstract : Linker script for STM32L432KCUx Device with
  7. ** 256KByte FLASH, 64KByte RAM
  8. **
  9. ** Set heap size, stack size and stack location according
  10. ** to application requirements.
  11. **
  12. ** Set memory bank area and size if external memory is used.
  13. **
  14. ** Target : STMicroelectronics STM32
  15. **
  16. **
  17. ** Distribution: The file is distributed as is, without any warranty
  18. ** of any kind.
  19. **
  20. ** (c)Copyright Ac6.
  21. ** You may use this file as-is or modify it according to the needs of your
  22. ** project. Distribution of this file (unmodified or modified) is not
  23. ** permitted. Ac6 permit registered System Workbench for MCU users the
  24. ** rights to distribute the assembled, compiled & linked contents of this
  25. ** file as part of an application binary file, provided that it is built
  26. ** using the System Workbench for MCU toolchain.
  27. **
  28. *****************************************************************************
  29. */
  30. /* Entry Point */
  31. ENTRY(Reset_Handler)
  32. /* Highest address of the user mode stack */
  33. _estack = 0x2000c000; /* end of RAM */
  34. /* Generate a link error if heap and stack don't fit into RAM */
  35. _Min_Heap_Size = 0x200; /* required amount of heap */
  36. _Min_Stack_Size = 0x400; /* required amount of stack */
  37. /* Specify the memory areas */
  38. MEMORY
  39. {
  40. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 256K
  41. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
  42. SRAM2 (rw) : ORIGIN = 0x10000000, LENGTH = 16K
  43. }
  44. /* Define output sections */
  45. SECTIONS
  46. {
  47. /* The startup code goes first into FLASH */
  48. .isr_vector :
  49. {
  50. . = ALIGN(8);
  51. KEEP(*(.isr_vector)) /* Startup code */
  52. . = ALIGN(8);
  53. } >FLASH
  54. /* The program code and other data goes into FLASH */
  55. .text :
  56. {
  57. . = ALIGN(8);
  58. *(.text) /* .text sections (code) */
  59. *(.text*) /* .text* sections (code) */
  60. *(.glue_7) /* glue arm to thumb code */
  61. *(.glue_7t) /* glue thumb to arm code */
  62. *(.eh_frame)
  63. KEEP (*(.init))
  64. KEEP (*(.fini))
  65. . = ALIGN(8);
  66. _etext = .; /* define a global symbols at end of code */
  67. } >FLASH
  68. /* Constant data goes into FLASH */
  69. .rodata :
  70. {
  71. . = ALIGN(8);
  72. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  73. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  74. . = ALIGN(8);
  75. } >FLASH
  76. .ARM.extab :
  77. {
  78. . = ALIGN(8);
  79. *(.ARM.extab* .gnu.linkonce.armextab.*)
  80. . = ALIGN(8);
  81. } >FLASH
  82. .ARM : {
  83. . = ALIGN(8);
  84. __exidx_start = .;
  85. *(.ARM.exidx*)
  86. __exidx_end = .;
  87. . = ALIGN(8);
  88. } >FLASH
  89. .preinit_array :
  90. {
  91. . = ALIGN(8);
  92. PROVIDE_HIDDEN (__preinit_array_start = .);
  93. KEEP (*(.preinit_array*))
  94. PROVIDE_HIDDEN (__preinit_array_end = .);
  95. . = ALIGN(8);
  96. } >FLASH
  97. .init_array :
  98. {
  99. . = ALIGN(8);
  100. PROVIDE_HIDDEN (__init_array_start = .);
  101. KEEP (*(SORT(.init_array.*)))
  102. KEEP (*(.init_array*))
  103. PROVIDE_HIDDEN (__init_array_end = .);
  104. . = ALIGN(8);
  105. } >FLASH
  106. .fini_array :
  107. {
  108. . = ALIGN(8);
  109. PROVIDE_HIDDEN (__fini_array_start = .);
  110. KEEP (*(SORT(.fini_array.*)))
  111. KEEP (*(.fini_array*))
  112. PROVIDE_HIDDEN (__fini_array_end = .);
  113. . = ALIGN(8);
  114. } >FLASH
  115. /* used by the startup to initialize data */
  116. _sidata = LOADADDR(.data);
  117. /* Initialized data sections goes into RAM, load LMA copy after code */
  118. .data :
  119. {
  120. . = ALIGN(8);
  121. _sdata = .; /* create a global symbol at data start */
  122. *(.data) /* .data sections */
  123. *(.data*) /* .data* sections */
  124. . = ALIGN(8);
  125. _edata = .; /* define a global symbol at data end */
  126. } >RAM AT> FLASH
  127. _sisram2 = LOADADDR(.sram2);
  128. /* CCM-RAM section
  129. *
  130. * IMPORTANT NOTE!
  131. * If initialized variables will be placed in this section,
  132. * the startup code needs to be modified to copy the init-values.
  133. */
  134. .sram2 :
  135. {
  136. . = ALIGN(8);
  137. _ssram2 = .; /* create a global symbol at sram2 start */
  138. *(.sram2)
  139. *(.sram2*)
  140. . = ALIGN(8);
  141. _esram2 = .; /* create a global symbol at sram2 end */
  142. } >SRAM2 AT> FLASH
  143. /* Uninitialized data section */
  144. . = ALIGN(4);
  145. .bss :
  146. {
  147. /* This is used by the startup in order to initialize the .bss secion */
  148. _sbss = .; /* define a global symbol at bss start */
  149. __bss_start__ = _sbss;
  150. *(.bss)
  151. *(.bss*)
  152. *(COMMON)
  153. . = ALIGN(4);
  154. _ebss = .; /* define a global symbol at bss end */
  155. __bss_end__ = _ebss;
  156. } >RAM
  157. /* User_heap_stack section, used to check that there is enough RAM left */
  158. ._user_heap_stack :
  159. {
  160. . = ALIGN(8);
  161. PROVIDE ( end = . );
  162. PROVIDE ( _end = . );
  163. . = . + _Min_Heap_Size;
  164. . = . + _Min_Stack_Size;
  165. . = ALIGN(8);
  166. } >RAM
  167. /* Remove information from the standard libraries */
  168. /DISCARD/ :
  169. {
  170. libc.a ( * )
  171. libm.a ( * )
  172. libgcc.a ( * )
  173. }
  174. .ARM.attributes 0 : { *(.ARM.attributes) }
  175. }