STM32L443RCTx_FLASH.ld 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : LinkerScript.ld
  5. **
  6. ** Abstract : Linker script for STM32L443RCTx Device with
  7. ** 256KByte FLASH, 64KByte 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. ** Target : STMicroelectronics STM32
  15. **
  16. **
  17. ** Distribution: The file is distributed as is, without any warranty
  18. ** of any kind.
  19. **
  20. ** (c)Copyright Ac6.
  21. ** You may use this file as-is or modify it according to the needs of your
  22. ** project. Distribution of this file (unmodified or modified) is not
  23. ** permitted. Ac6 permit registered System Workbench for MCU users the
  24. ** rights to distribute the assembled, compiled & linked contents of this
  25. ** file as part of an application binary file, provided that it is built
  26. ** using the System Workbench for MCU toolchain.
  27. **
  28. *****************************************************************************
  29. */
  30. /* Entry Point */
  31. ENTRY(Reset_Handler)
  32. /* Highest address of the user mode stack */
  33. _estack = 0x20010000; /* end of RAM */
  34. /* Generate a link error if heap and stack don't fit into RAM */
  35. _Min_Heap_Size = 0x200; /* required amount of heap */
  36. _Min_Stack_Size = 0x400; /* required amount of stack */
  37. /* Specify the memory areas */
  38. MEMORY
  39. {
  40. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
  41. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 256K
  42. }
  43. /* Define output sections */
  44. SECTIONS
  45. {
  46. /* The startup code goes first into FLASH */
  47. .isr_vector :
  48. {
  49. . = ALIGN(8);
  50. KEEP(*(.isr_vector)) /* Startup code */
  51. . = ALIGN(8);
  52. } >FLASH
  53. /* The program code and other data goes into FLASH */
  54. .text :
  55. {
  56. . = ALIGN(8);
  57. *(.text) /* .text sections (code) */
  58. *(.text*) /* .text* sections (code) */
  59. *(.glue_7) /* glue arm to thumb code */
  60. *(.glue_7t) /* glue thumb to arm code */
  61. *(.eh_frame)
  62. KEEP (*(.init))
  63. KEEP (*(.fini))
  64. . = ALIGN(8);
  65. _etext = .; /* define a global symbols at end of code */
  66. } >FLASH
  67. /* Constant data goes into FLASH */
  68. .rodata :
  69. {
  70. . = ALIGN(8);
  71. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  72. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  73. . = ALIGN(8);
  74. } >FLASH
  75. .ARM.extab :
  76. {
  77. . = ALIGN(8);
  78. *(.ARM.extab* .gnu.linkonce.armextab.*)
  79. . = ALIGN(8);
  80. } >FLASH
  81. .ARM : {
  82. . = ALIGN(8);
  83. __exidx_start = .;
  84. *(.ARM.exidx*)
  85. __exidx_end = .;
  86. . = ALIGN(8);
  87. } >FLASH
  88. .preinit_array :
  89. {
  90. . = ALIGN(8);
  91. PROVIDE_HIDDEN (__preinit_array_start = .);
  92. KEEP (*(.preinit_array*))
  93. PROVIDE_HIDDEN (__preinit_array_end = .);
  94. . = ALIGN(8);
  95. } >FLASH
  96. .init_array :
  97. {
  98. . = ALIGN(8);
  99. PROVIDE_HIDDEN (__init_array_start = .);
  100. KEEP (*(SORT(.init_array.*)))
  101. KEEP (*(.init_array*))
  102. PROVIDE_HIDDEN (__init_array_end = .);
  103. . = ALIGN(8);
  104. } >FLASH
  105. .fini_array :
  106. {
  107. . = ALIGN(8);
  108. PROVIDE_HIDDEN (__fini_array_start = .);
  109. KEEP (*(SORT(.fini_array.*)))
  110. KEEP (*(.fini_array*))
  111. PROVIDE_HIDDEN (__fini_array_end = .);
  112. . = ALIGN(8);
  113. } >FLASH
  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(8);
  120. _sdata = .; /* create a global symbol at data start */
  121. *(.data) /* .data sections */
  122. *(.data*) /* .data* sections */
  123. . = ALIGN(8);
  124. _edata = .; /* define a global symbol at data end */
  125. } >RAM AT> FLASH
  126. /* Uninitialized data section */
  127. . = ALIGN(4);
  128. .bss :
  129. {
  130. /* This is used by the startup in order to initialize the .bss secion */
  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. } >RAM
  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. } >RAM
  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. }