STM32H745XIHX_FLASH.ld 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /*
  2. ******************************************************************************
  3. **
  4. ** File : LinkerScript.ld
  5. **
  6. ** Author : STM32CubeIDE
  7. **
  8. ** Abstract : Linker script for STM32H7 series
  9. ** 1024Kbytes FLASH and 288Kbytes 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) 2022 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(RAM) + LENGTH(RAM); /* 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. FLASH (rx) : ORIGIN = 0x08100000, LENGTH = 1024K
  44. /* ETH_CODE: reduce RAM size, since end is used by ETH buffers */
  45. RAM (xrw) : ORIGIN = 0x10000000, LENGTH = 128K
  46. }
  47. /* Define output sections */
  48. SECTIONS
  49. {
  50. /* The startup code goes first into FLASH */
  51. .isr_vector :
  52. {
  53. . = ALIGN(4);
  54. KEEP(*(.isr_vector)) /* Startup code */
  55. . = ALIGN(4);
  56. } >FLASH
  57. /* The program code and other data goes into FLASH */
  58. .text :
  59. {
  60. . = ALIGN(4);
  61. *(.text) /* .text sections (code) */
  62. *(.text*) /* .text* sections (code) */
  63. *(.glue_7) /* glue arm to thumb code */
  64. *(.glue_7t) /* glue thumb to arm code */
  65. *(.eh_frame)
  66. KEEP (*(.init))
  67. KEEP (*(.fini))
  68. . = ALIGN(4);
  69. _etext = .; /* define a global symbols at end of code */
  70. } >FLASH
  71. /* Constant data goes into FLASH */
  72. .rodata :
  73. {
  74. . = ALIGN(4);
  75. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  76. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  77. . = ALIGN(4);
  78. } >FLASH
  79. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  80. .ARM : {
  81. __exidx_start = .;
  82. *(.ARM.exidx*)
  83. __exidx_end = .;
  84. } >FLASH
  85. .preinit_array :
  86. {
  87. PROVIDE_HIDDEN (__preinit_array_start = .);
  88. KEEP (*(.preinit_array*))
  89. PROVIDE_HIDDEN (__preinit_array_end = .);
  90. } >FLASH
  91. .init_array :
  92. {
  93. PROVIDE_HIDDEN (__init_array_start = .);
  94. KEEP (*(SORT(.init_array.*)))
  95. KEEP (*(.init_array*))
  96. PROVIDE_HIDDEN (__init_array_end = .);
  97. } >FLASH
  98. .fini_array :
  99. {
  100. PROVIDE_HIDDEN (__fini_array_start = .);
  101. KEEP (*(SORT(.fini_array.*)))
  102. KEEP (*(.fini_array*))
  103. PROVIDE_HIDDEN (__fini_array_end = .);
  104. } >FLASH
  105. /* used by the startup to initialize data */
  106. _sidata = LOADADDR(.data);
  107. /* Initialized data sections goes into RAM, load LMA copy after code */
  108. .data :
  109. {
  110. . = ALIGN(4);
  111. _sdata = .; /* create a global symbol at data start */
  112. *(.data) /* .data sections */
  113. *(.data*) /* .data* sections */
  114. *(.RamFunc) /* .RamFunc sections */
  115. *(.RamFunc*) /* .RamFunc* sections */
  116. . = ALIGN(4);
  117. _edata = .; /* define a global symbol at data end */
  118. } >RAM AT> FLASH
  119. /* Uninitialized data section */
  120. . = ALIGN(4);
  121. .bss :
  122. {
  123. /* This is used by the startup in order to initialize the .bss section */
  124. _sbss = .; /* define a global symbol at bss start */
  125. __bss_start__ = _sbss;
  126. *(.bss)
  127. *(.bss*)
  128. *(COMMON)
  129. . = ALIGN(4);
  130. _ebss = .; /* define a global symbol at bss end */
  131. __bss_end__ = _ebss;
  132. } >RAM
  133. /* User_heap_stack section, used to check that there is enough RAM left */
  134. ._user_heap_stack :
  135. {
  136. . = ALIGN(8);
  137. PROVIDE ( end = . );
  138. PROVIDE ( _end = . );
  139. . = . + _Min_Heap_Size;
  140. . = . + _Min_Stack_Size;
  141. . = ALIGN(8);
  142. } >RAM
  143. /* Remove information from the standard libraries */
  144. /DISCARD/ :
  145. {
  146. libc.a ( * )
  147. libm.a ( * )
  148. libgcc.a ( * )
  149. }
  150. .ARM.attributes 0 : { *(.ARM.attributes) }
  151. }