STM32H742VITX_RAM.ld 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. /*
  2. ******************************************************************************
  3. **
  4. ** File : LinkerScript.ld (debug in RAM dedicated)
  5. **
  6. ** Author : STM32CubeIDE
  7. **
  8. ** Abstract : Linker script for STM32H7 series
  9. ** 384Kbytes RAM_EXEC and 304Kbytes RAM
  10. **
  11. ** Set heap size, stack size and stack location according
  12. ** to application requirements.
  13. **
  14. ** Set memory bank area and size if external memory is used.
  15. **
  16. ** Target : STMicroelectronics STM32
  17. **
  18. ** Distribution: The file is distributed as is, without any warranty
  19. ** of any kind.
  20. **
  21. *****************************************************************************
  22. ** @attention
  23. **
  24. ** Copyright (c) 2024 STMicroelectronics.
  25. ** All rights reserved.
  26. **
  27. ** This software is licensed under terms that can be found in the LICENSE file
  28. ** in the root directory of this software component.
  29. ** If no LICENSE file comes with this software, it is provided AS-IS.
  30. **
  31. ****************************************************************************
  32. */
  33. /* Entry Point */
  34. ENTRY(Reset_Handler)
  35. /* Highest address of the user mode stack */
  36. _estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */
  37. /* Generate a link error if heap and stack don't fit into RAM */
  38. _Min_Heap_Size = 0x200; /* required amount of heap */
  39. _Min_Stack_Size = 0x400; /* required amount of stack */
  40. /* Specify the memory areas */
  41. MEMORY
  42. {
  43. RAM_EXEC (xrw) : ORIGIN = 0x24000000, LENGTH = 384K
  44. DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  45. RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K
  46. RAM2_D2 (xrw) : ORIGIN = 0x30020000, LENGTH = 16K
  47. RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K
  48. ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K
  49. }
  50. /* Define output sections */
  51. SECTIONS
  52. {
  53. /* The startup code goes first into RAM_EXEC */
  54. .isr_vector :
  55. {
  56. . = ALIGN(4);
  57. KEEP(*(.isr_vector)) /* Startup code */
  58. . = ALIGN(4);
  59. } >RAM_EXEC
  60. /* The program code and other data goes into RAM_EXEC */
  61. .text :
  62. {
  63. . = ALIGN(4);
  64. *(.text) /* .text sections (code) */
  65. *(.text*) /* .text* sections (code) */
  66. *(.glue_7) /* glue arm to thumb code */
  67. *(.glue_7t) /* glue thumb to arm code */
  68. *(.eh_frame)
  69. *(.RamFunc) /* .RamFunc sections */
  70. *(.RamFunc*) /* .RamFunc* sections */
  71. KEEP (*(.init))
  72. KEEP (*(.fini))
  73. . = ALIGN(4);
  74. _etext = .; /* define a global symbols at end of code */
  75. } >RAM_EXEC
  76. /* Constant data goes into RAM_EXEC */
  77. .rodata :
  78. {
  79. . = ALIGN(4);
  80. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  81. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  82. . = ALIGN(4);
  83. } >RAM_EXEC
  84. .ARM.extab (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  85. {
  86. *(.ARM.extab* .gnu.linkonce.armextab.*)
  87. } >RAM_EXEC
  88. .ARM (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  89. {
  90. __exidx_start = .;
  91. *(.ARM.exidx*)
  92. __exidx_end = .;
  93. } >RAM_EXEC
  94. .preinit_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  95. {
  96. PROVIDE_HIDDEN (__preinit_array_start = .);
  97. KEEP (*(.preinit_array*))
  98. PROVIDE_HIDDEN (__preinit_array_end = .);
  99. } >RAM_EXEC
  100. .init_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  101. {
  102. PROVIDE_HIDDEN (__init_array_start = .);
  103. KEEP (*(SORT(.init_array.*)))
  104. KEEP (*(.init_array*))
  105. PROVIDE_HIDDEN (__init_array_end = .);
  106. } >RAM_EXEC
  107. .fini_array (READONLY) : /* The READONLY keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
  108. {
  109. PROVIDE_HIDDEN (__fini_array_start = .);
  110. KEEP (*(SORT(.fini_array.*)))
  111. KEEP (*(.fini_array*))
  112. PROVIDE_HIDDEN (__fini_array_end = .);
  113. } >RAM_EXEC
  114. /* used by the startup to initialize data */
  115. _sidata = LOADADDR(.data);
  116. /* Initialized data sections goes into RAM, load LMA copy after code */
  117. .data :
  118. {
  119. . = ALIGN(4);
  120. _sdata = .; /* create a global symbol at data start */
  121. *(.data) /* .data sections */
  122. *(.data*) /* .data* sections */
  123. . = ALIGN(4);
  124. _edata = .; /* define a global symbol at data end */
  125. } >DTCMRAM AT> RAM_EXEC
  126. /* Uninitialized data section */
  127. . = ALIGN(4);
  128. .bss :
  129. {
  130. /* This is used by the startup in order to initialize the .bss section */
  131. _sbss = .; /* define a global symbol at bss start */
  132. __bss_start__ = _sbss;
  133. *(.bss)
  134. *(.bss*)
  135. *(COMMON)
  136. . = ALIGN(4);
  137. _ebss = .; /* define a global symbol at bss end */
  138. __bss_end__ = _ebss;
  139. } >DTCMRAM
  140. /* User_heap_stack section, used to check that there is enough RAM left */
  141. ._user_heap_stack :
  142. {
  143. . = ALIGN(8);
  144. PROVIDE ( end = . );
  145. PROVIDE ( _end = . );
  146. . = . + _Min_Heap_Size;
  147. . = . + _Min_Stack_Size;
  148. . = ALIGN(8);
  149. } >DTCMRAM
  150. /* Remove information from the standard libraries */
  151. /DISCARD/ :
  152. {
  153. libc.a ( * )
  154. libm.a ( * )
  155. libgcc.a ( * )
  156. }
  157. .ARM.attributes 0 : { *(.ARM.attributes) }
  158. }