ldscript.ld 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. /**
  2. ******************************************************************************
  3. * @file LinkerScript.ld
  4. * @author Auto-generated by STM32CubeIDE
  5. * @brief Linker script for STM32F401RBTx Device from STM32F4 series
  6. * 128Kbytes FLASH
  7. * 64Kbytes RAM
  8. *
  9. * Set heap size, stack size and stack location according
  10. * to application requirements.
  11. *
  12. * Set memory bank area and size if external memory is used
  13. ******************************************************************************
  14. * @attention
  15. *
  16. * Copyright (c) 2020 STMicroelectronics.
  17. * All rights reserved.
  18. *
  19. * This software component is licensed by ST under BSD 3-Clause license,
  20. * the "License"; You may not use this file except in compliance with the
  21. * License. You may obtain a copy of the License at:
  22. * opensource.org/licenses/BSD-3-Clause
  23. *
  24. ******************************************************************************
  25. */
  26. /* Entry Point */
  27. ENTRY(Reset_Handler)
  28. /* Highest address of the user mode stack */
  29. _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
  30. _Min_Heap_Size = 0x200; /* required amount of heap */
  31. _Min_Stack_Size = 0x400; /* required amount of stack */
  32. /* Memories definition */
  33. MEMORY
  34. {
  35. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = LD_MAX_DATA_SIZE
  36. FLASH (rx) : ORIGIN = 0x8000000 + LD_FLASH_OFFSET, LENGTH = LD_MAX_SIZE - LD_FLASH_OFFSET
  37. }
  38. /* Sections */
  39. SECTIONS
  40. {
  41. /* The startup code into "FLASH" Rom type memory */
  42. .isr_vector :
  43. {
  44. . = ALIGN(4);
  45. KEEP(*(.isr_vector)) /* Startup code */
  46. . = ALIGN(4);
  47. } >FLASH
  48. /* The program code and other data into "FLASH" Rom type memory */
  49. .text :
  50. {
  51. . = ALIGN(4);
  52. *(.text) /* .text sections (code) */
  53. *(.text*) /* .text* sections (code) */
  54. *(.glue_7) /* glue arm to thumb code */
  55. *(.glue_7t) /* glue thumb to arm code */
  56. *(.eh_frame)
  57. KEEP (*(.init))
  58. KEEP (*(.fini))
  59. . = ALIGN(4);
  60. _etext = .; /* define a global symbols at end of code */
  61. } >FLASH
  62. /* Constant data into "FLASH" Rom type memory */
  63. .rodata :
  64. {
  65. . = ALIGN(4);
  66. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  67. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  68. . = ALIGN(4);
  69. } >FLASH
  70. .ARM.extab : {
  71. . = ALIGN(4);
  72. *(.ARM.extab* .gnu.linkonce.armextab.*)
  73. . = ALIGN(4);
  74. } >FLASH
  75. .ARM : {
  76. . = ALIGN(4);
  77. __exidx_start = .;
  78. *(.ARM.exidx*)
  79. __exidx_end = .;
  80. . = ALIGN(4);
  81. } >FLASH
  82. .preinit_array :
  83. {
  84. . = ALIGN(4);
  85. PROVIDE_HIDDEN (__preinit_array_start = .);
  86. KEEP (*(.preinit_array*))
  87. PROVIDE_HIDDEN (__preinit_array_end = .);
  88. . = ALIGN(4);
  89. } >FLASH
  90. .init_array :
  91. {
  92. . = ALIGN(4);
  93. PROVIDE_HIDDEN (__init_array_start = .);
  94. KEEP (*(SORT(.init_array.*)))
  95. KEEP (*(.init_array*))
  96. PROVIDE_HIDDEN (__init_array_end = .);
  97. . = ALIGN(4);
  98. } >FLASH
  99. .fini_array :
  100. {
  101. . = ALIGN(4);
  102. PROVIDE_HIDDEN (__fini_array_start = .);
  103. KEEP (*(SORT(.fini_array.*)))
  104. KEEP (*(.fini_array*))
  105. PROVIDE_HIDDEN (__fini_array_end = .);
  106. . = ALIGN(4);
  107. } >FLASH
  108. /* Used by the startup to initialize data */
  109. _sidata = LOADADDR(.data);
  110. /* Initialized data sections into "RAM" Ram type memory */
  111. .data :
  112. {
  113. . = ALIGN(4);
  114. _sdata = .; /* create a global symbol at data start */
  115. *(.data) /* .data sections */
  116. *(.data*) /* .data* sections */
  117. *(.RamFunc) /* .RamFunc sections */
  118. *(.RamFunc*) /* .RamFunc* sections */
  119. . = ALIGN(4);
  120. _edata = .; /* define a global symbol at data end */
  121. } >RAM AT> FLASH
  122. /* Uninitialized data section into "RAM" Ram type memory */
  123. . = ALIGN(4);
  124. .bss :
  125. {
  126. /* This is used by the startup in order to initialize the .bss section */
  127. _sbss = .; /* define a global symbol at bss start */
  128. __bss_start__ = _sbss;
  129. *(.bss)
  130. *(.bss*)
  131. *(COMMON)
  132. . = ALIGN(4);
  133. _ebss = .; /* define a global symbol at bss end */
  134. __bss_end__ = _ebss;
  135. } >RAM
  136. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  137. ._user_heap_stack :
  138. {
  139. . = ALIGN(8);
  140. PROVIDE ( end = . );
  141. PROVIDE ( _end = . );
  142. . = . + _Min_Heap_Size;
  143. . = . + _Min_Stack_Size;
  144. . = ALIGN(8);
  145. } >RAM
  146. /* Remove information from the compiler libraries */
  147. /DISCARD/ :
  148. {
  149. libc.a ( * )
  150. libm.a ( * )
  151. libgcc.a ( * )
  152. }
  153. .ARM.attributes 0 : { *(.ARM.attributes) }
  154. }