STM32G491RETX_FLASH.ld 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*
  2. ******************************************************************************
  3. **
  4. ** @file : LinkerScript.ld
  5. **
  6. ** @author : Auto-generated by STM32CubeIDE
  7. **
  8. ** @brief : Linker script for STM32G491RETx Device from STM32G4 series
  9. ** 512Kbytes FLASH
  10. ** 112Kbytes RAM
  11. **
  12. ** Set heap size, stack size and stack location according
  13. ** to application requirements.
  14. **
  15. ** Set memory bank area and size if external memory is used
  16. **
  17. ** Target : STMicroelectronics STM32
  18. **
  19. ** Distribution: The file is distributed as is, without any warranty
  20. ** of any kind.
  21. **
  22. ******************************************************************************
  23. ** @attention
  24. **
  25. ** <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  26. ** All rights reserved.</center></h2>
  27. **
  28. ** This software component is licensed by ST under BSD 3-Clause license,
  29. ** the "License"; You may not use this file except in compliance with the
  30. ** License. You may obtain a copy of the License at:
  31. ** opensource.org/licenses/BSD-3-Clause
  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. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 112K
  45. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
  46. }
  47. /* Sections */
  48. SECTIONS
  49. {
  50. /* The startup code into "FLASH" Rom type memory */
  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 into "FLASH" Rom type memory */
  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 into "FLASH" Rom type memory */
  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 : {
  80. . = ALIGN(4);
  81. *(.ARM.extab* .gnu.linkonce.armextab.*)
  82. . = ALIGN(4);
  83. } >FLASH
  84. .ARM : {
  85. . = ALIGN(4);
  86. __exidx_start = .;
  87. *(.ARM.exidx*)
  88. __exidx_end = .;
  89. . = ALIGN(4);
  90. } >FLASH
  91. .preinit_array :
  92. {
  93. . = ALIGN(4);
  94. PROVIDE_HIDDEN (__preinit_array_start = .);
  95. KEEP (*(.preinit_array*))
  96. PROVIDE_HIDDEN (__preinit_array_end = .);
  97. . = ALIGN(4);
  98. } >FLASH
  99. .init_array :
  100. {
  101. . = ALIGN(4);
  102. PROVIDE_HIDDEN (__init_array_start = .);
  103. KEEP (*(SORT(.init_array.*)))
  104. KEEP (*(.init_array*))
  105. PROVIDE_HIDDEN (__init_array_end = .);
  106. . = ALIGN(4);
  107. } >FLASH
  108. .fini_array :
  109. {
  110. . = ALIGN(4);
  111. PROVIDE_HIDDEN (__fini_array_start = .);
  112. KEEP (*(SORT(.fini_array.*)))
  113. KEEP (*(.fini_array*))
  114. PROVIDE_HIDDEN (__fini_array_end = .);
  115. . = ALIGN(4);
  116. } >FLASH
  117. /* Used by the startup to initialize data */
  118. _sidata = LOADADDR(.data);
  119. /* Initialized data sections into "RAM" Ram type memory */
  120. .data :
  121. {
  122. . = ALIGN(4);
  123. _sdata = .; /* create a global symbol at data start */
  124. *(.data) /* .data sections */
  125. *(.data*) /* .data* sections */
  126. *(.RamFunc) /* .RamFunc sections */
  127. *(.RamFunc*) /* .RamFunc* sections */
  128. . = ALIGN(4);
  129. _edata = .; /* define a global symbol at data end */
  130. } >RAM AT> FLASH
  131. /* Uninitialized data section into "RAM" Ram type memory */
  132. . = ALIGN(4);
  133. .bss :
  134. {
  135. /* This is used by the startup in order to initialize the .bss section */
  136. _sbss = .; /* define a global symbol at bss start */
  137. __bss_start__ = _sbss;
  138. *(.bss)
  139. *(.bss*)
  140. *(COMMON)
  141. . = ALIGN(4);
  142. _ebss = .; /* define a global symbol at bss end */
  143. __bss_end__ = _ebss;
  144. } >RAM
  145. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  146. ._user_heap_stack :
  147. {
  148. . = ALIGN(8);
  149. PROVIDE ( end = . );
  150. PROVIDE ( _end = . );
  151. . = . + _Min_Heap_Size;
  152. . = . + _Min_Stack_Size;
  153. . = ALIGN(8);
  154. } >RAM
  155. /* Remove information from the compiler libraries */
  156. /DISCARD/ :
  157. {
  158. libc.a ( * )
  159. libm.a ( * )
  160. libgcc.a ( * )
  161. }
  162. .ARM.attributes 0 : { *(.ARM.attributes) }
  163. }