STM32F405RGTX_FLASH.ld 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. /*
  2. ******************************************************************************
  3. **
  4. ** @file : LinkerScript.ld
  5. **
  6. ** @author : Auto-generated by STM32CubeIDE
  7. **
  8. ** @brief : Linker script for STM32F405RGTx Device from STM32F4 series
  9. ** 1024KBytes 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) 2025 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. /*_Min_Heap_Size = 0x3C00;*/ /* required amount of heap */
  42. /*_Min_Stack_Size = 0x400;*/ /* required amount of stack */
  43. /* Memories definition */
  44. MEMORY
  45. {
  46. CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
  47. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  48. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 32K
  49. /* FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 992K */
  50. }
  51. /* Sections */
  52. SECTIONS
  53. {
  54. /* The startup code into "FLASH" Rom type memory */
  55. .isr_vector :
  56. {
  57. . = ALIGN(4);
  58. KEEP(*(.isr_vector)) /* Startup code */
  59. . = ALIGN(4);
  60. } >FLASH
  61. /* 添加版本信息段 */
  62. .version_info :
  63. {
  64. . = ALIGN(4);
  65. /* 版本信息位于0x08000188*/
  66. KEEP(*(.version_info))
  67. . = ALIGN(4);
  68. } >FLASH
  69. /* The program code and other data into "FLASH" Rom type memory */
  70. .text :
  71. {
  72. . = ALIGN(4);
  73. *(.text) /* .text sections (code) */
  74. *(.text*) /* .text* sections (code) */
  75. *(.glue_7) /* glue arm to thumb code */
  76. *(.glue_7t) /* glue thumb to arm code */
  77. *(.eh_frame)
  78. KEEP (*(.init))
  79. KEEP (*(.fini))
  80. . = ALIGN(4);
  81. _etext = .; /* define a global symbols at end of code */
  82. } >FLASH
  83. /* Constant data into "FLASH" Rom type memory */
  84. .rodata :
  85. {
  86. . = ALIGN(4);
  87. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  88. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  89. . = ALIGN(4);
  90. } >FLASH
  91. .ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  92. {
  93. . = ALIGN(4);
  94. *(.ARM.extab* .gnu.linkonce.armextab.*)
  95. . = ALIGN(4);
  96. } >FLASH
  97. .ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  98. {
  99. . = ALIGN(4);
  100. __exidx_start = .;
  101. *(.ARM.exidx*)
  102. __exidx_end = .;
  103. . = ALIGN(4);
  104. } >FLASH
  105. .preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  106. {
  107. . = ALIGN(4);
  108. PROVIDE_HIDDEN (__preinit_array_start = .);
  109. KEEP (*(.preinit_array*))
  110. PROVIDE_HIDDEN (__preinit_array_end = .);
  111. . = ALIGN(4);
  112. } >FLASH
  113. .init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  114. {
  115. . = ALIGN(4);
  116. PROVIDE_HIDDEN (__init_array_start = .);
  117. KEEP (*(SORT(.init_array.*)))
  118. KEEP (*(.init_array*))
  119. PROVIDE_HIDDEN (__init_array_end = .);
  120. . = ALIGN(4);
  121. } >FLASH
  122. .fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  123. {
  124. . = ALIGN(4);
  125. PROVIDE_HIDDEN (__fini_array_start = .);
  126. KEEP (*(SORT(.fini_array.*)))
  127. KEEP (*(.fini_array*))
  128. PROVIDE_HIDDEN (__fini_array_end = .);
  129. . = ALIGN(4);
  130. } >FLASH
  131. /* Used by the startup to initialize data */
  132. _sidata = LOADADDR(.data);
  133. /* Initialized data sections into "RAM" Ram type memory */
  134. .data :
  135. {
  136. . = ALIGN(4);
  137. _sdata = .; /* create a global symbol at data start */
  138. *(.data) /* .data sections */
  139. *(.data*) /* .data* sections */
  140. *(.RamFunc) /* .RamFunc sections */
  141. *(.RamFunc*) /* .RamFunc* sections */
  142. . = ALIGN(4);
  143. _edata = .; /* define a global symbol at data end */
  144. } >RAM AT> FLASH
  145. _siccmram = LOADADDR(.ccmram);
  146. /* CCM-RAM section
  147. *
  148. * IMPORTANT NOTE!
  149. * If initialized variables will be placed in this section,
  150. * the startup code needs to be modified to copy the init-values.
  151. */
  152. .ccmram :
  153. {
  154. . = ALIGN(4);
  155. _sccmram = .; /* create a global symbol at ccmram start */
  156. *(.ccmram)
  157. *(.ccmram*)
  158. . = ALIGN(4);
  159. _eccmram = .; /* create a global symbol at ccmram end */
  160. } >CCMRAM AT> FLASH
  161. /* Uninitialized data section into "RAM" Ram type memory */
  162. . = ALIGN(4);
  163. .bss :
  164. {
  165. /* This is used by the startup in order to initialize the .bss section */
  166. _sbss = .; /* define a global symbol at bss start */
  167. __bss_start__ = _sbss;
  168. *(.bss)
  169. *(.bss*)
  170. *(COMMON)
  171. . = ALIGN(4);
  172. _ebss = .; /* define a global symbol at bss end */
  173. __bss_end__ = _ebss;
  174. } >RAM
  175. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  176. ._user_heap_stack :
  177. {
  178. . = ALIGN(8);
  179. PROVIDE ( end = . );
  180. PROVIDE ( _end = . );
  181. . = . + _Min_Heap_Size;
  182. . = . + _Min_Stack_Size;
  183. . = ALIGN(8);
  184. } >RAM
  185. /* Remove information from the compiler libraries */
  186. /DISCARD/ :
  187. {
  188. libc.a ( * )
  189. libm.a ( * )
  190. libgcc.a ( * )
  191. }
  192. .ARM.attributes 0 : { *(.ARM.attributes) }
  193. }