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.7 KiB

  1. /*
  2. ******************************************************************************
  3. **
  4. ** @file : LinkerScript.ld
  5. **
  6. ** @author : Auto-generated by STM32CubeIDE
  7. **
  8. ** @brief : Linker script for STM32F407VETx Device from STM32F4 series
  9. ** 512KBytes FLASH
  10. ** 64KBytes CCMRAM
  11. ** 128KBytes RAM
  12. **
  13. ** Set heap size, stack size and stack location according
  14. ** to application requirements.
  15. **
  16. ** Set memory bank area and size if external memory is used
  17. **
  18. ** Target : STMicroelectronics STM32
  19. **
  20. ** Distribution: The file is distributed as is, without any warranty
  21. ** of any kind.
  22. **
  23. ******************************************************************************
  24. ** @attention
  25. **
  26. ** Copyright (c) 2024 STMicroelectronics.
  27. ** All rights reserved.
  28. **
  29. ** This software is licensed under terms that can be found in the LICENSE file
  30. ** in the root directory of this software component.
  31. ** If no LICENSE file comes with this software, it is provided AS-IS.
  32. **
  33. ******************************************************************************
  34. */
  35. /* Entry Point */
  36. ENTRY(Reset_Handler)
  37. /* Highest address of the user mode stack */
  38. _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
  39. _Min_Heap_Size = 0x200; /* required amount of heap */
  40. _Min_Stack_Size = 0x400; /* required amount of stack */
  41. /* Memories definition */
  42. MEMORY
  43. {
  44. CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
  45. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  46. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
  47. }
  48. /* Sections */
  49. SECTIONS
  50. {
  51. /* The startup code into "FLASH" Rom type memory */
  52. .isr_vector :
  53. {
  54. . = ALIGN(4);
  55. KEEP(*(.isr_vector)) /* Startup code */
  56. . = ALIGN(4);
  57. } >FLASH
  58. /* The program code and other data into "FLASH" Rom type memory */
  59. .text :
  60. {
  61. . = ALIGN(4);
  62. *(.text) /* .text sections (code) */
  63. *(.text*) /* .text* sections (code) */
  64. *(.glue_7) /* glue arm to thumb code */
  65. *(.glue_7t) /* glue thumb to arm code */
  66. *(.eh_frame)
  67. KEEP (*(.init))
  68. KEEP (*(.fini))
  69. . = ALIGN(4);
  70. _etext = .; /* define a global symbols at end of code */
  71. } >FLASH
  72. /* Constant data into "FLASH" Rom type memory */
  73. .rodata :
  74. {
  75. . = ALIGN(4);
  76. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  77. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  78. . = ALIGN(4);
  79. } >FLASH
  80. .ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  81. {
  82. . = ALIGN(4);
  83. *(.ARM.extab* .gnu.linkonce.armextab.*)
  84. . = ALIGN(4);
  85. } >FLASH
  86. .ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  87. {
  88. . = ALIGN(4);
  89. __exidx_start = .;
  90. *(.ARM.exidx*)
  91. __exidx_end = .;
  92. . = ALIGN(4);
  93. } >FLASH
  94. .preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  95. {
  96. . = ALIGN(4);
  97. PROVIDE_HIDDEN (__preinit_array_start = .);
  98. KEEP (*(.preinit_array*))
  99. PROVIDE_HIDDEN (__preinit_array_end = .);
  100. . = ALIGN(4);
  101. } >FLASH
  102. .init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  103. {
  104. . = ALIGN(4);
  105. PROVIDE_HIDDEN (__init_array_start = .);
  106. KEEP (*(SORT(.init_array.*)))
  107. KEEP (*(.init_array*))
  108. PROVIDE_HIDDEN (__init_array_end = .);
  109. . = ALIGN(4);
  110. } >FLASH
  111. .fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  112. {
  113. . = ALIGN(4);
  114. PROVIDE_HIDDEN (__fini_array_start = .);
  115. KEEP (*(SORT(.fini_array.*)))
  116. KEEP (*(.fini_array*))
  117. PROVIDE_HIDDEN (__fini_array_end = .);
  118. . = ALIGN(4);
  119. } >FLASH
  120. /* Used by the startup to initialize data */
  121. _sidata = LOADADDR(.data);
  122. /* Initialized data sections into "RAM" Ram type memory */
  123. .data :
  124. {
  125. . = ALIGN(4);
  126. _sdata = .; /* create a global symbol at data start */
  127. *(.data) /* .data sections */
  128. *(.data*) /* .data* sections */
  129. *(.RamFunc) /* .RamFunc sections */
  130. *(.RamFunc*) /* .RamFunc* sections */
  131. . = ALIGN(4);
  132. _edata = .; /* define a global symbol at data end */
  133. } >RAM AT> FLASH
  134. _siccmram = LOADADDR(.ccmram);
  135. /* CCM-RAM section
  136. *
  137. * IMPORTANT NOTE!
  138. * If initialized variables will be placed in this section,
  139. * the startup code needs to be modified to copy the init-values.
  140. */
  141. .ccmram :
  142. {
  143. . = ALIGN(4);
  144. _sccmram = .; /* create a global symbol at ccmram start */
  145. *(.ccmram)
  146. *(.ccmram*)
  147. . = ALIGN(4);
  148. _eccmram = .; /* create a global symbol at ccmram end */
  149. } >CCMRAM AT> FLASH
  150. /* Uninitialized data section into "RAM" Ram type memory */
  151. . = ALIGN(4);
  152. .bss :
  153. {
  154. /* This is used by the startup in order to initialize the .bss section */
  155. _sbss = .; /* define a global symbol at bss start */
  156. __bss_start__ = _sbss;
  157. *(.bss)
  158. *(.bss*)
  159. *(COMMON)
  160. . = ALIGN(4);
  161. _ebss = .; /* define a global symbol at bss end */
  162. __bss_end__ = _ebss;
  163. } >RAM
  164. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  165. ._user_heap_stack :
  166. {
  167. . = ALIGN(8);
  168. PROVIDE ( end = . );
  169. PROVIDE ( _end = . );
  170. . = . + _Min_Heap_Size;
  171. . = . + _Min_Stack_Size;
  172. . = ALIGN(8);
  173. } >RAM
  174. /* Remove information from the compiler libraries */
  175. /DISCARD/ :
  176. {
  177. libc.a ( * )
  178. libm.a ( * )
  179. libgcc.a ( * )
  180. }
  181. .ARM.attributes 0 : { *(.ARM.attributes) }
  182. }