STM32F417IG_FLASH.ld 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : stm32_flash.ld
  5. **
  6. ** Abstract : Linker script for STM32F417IG Device with
  7. ** 1024KByte FLASH, 128KByte 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. ** Environment : Atollic TrueSTUDIO(R)
  17. **
  18. ** Distribution: The file is distributed “as is,” without any warranty
  19. ** of any kind.
  20. **
  21. ** (c)Copyright Atollic AB.
  22. ** You may use this file as-is or modify it according to the needs of your
  23. ** project. This file may only be built (assembled or compiled and linked)
  24. ** using the Atollic TrueSTUDIO(R) product. The use of this file together
  25. ** with other tools than Atollic TrueSTUDIO(R) is not permitted.
  26. **
  27. *****************************************************************************
  28. */
  29. /* Entry Point */
  30. ENTRY(Reset_Handler)
  31. /* Highest address of the user mode stack */
  32. _estack = 0x2001FFFF; /* end of RAM */
  33. /* Generate a link error if heap and stack don't fit into RAM */
  34. _Min_Heap_Size = 0x200; /* required amount of heap */
  35. _Min_Stack_Size = 0x400; /* required amount of stack */
  36. /* Specify the memory areas */
  37. MEMORY
  38. {
  39. FLASH (rx) : ORIGIN = 0x8010000, LENGTH = 1024K
  40. RW_IRAM1 (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  41. RW_IRAM2 (rw) : ORIGIN = 0x10000000, LENGTH = 64K
  42. EXTSRAM (rw) : ORIGIN = 0x68000000, LENGTH = 2048K
  43. }
  44. /* Define output sections */
  45. SECTIONS
  46. {
  47. /* The startup code goes first into FLASH */
  48. .isr_vector :
  49. {
  50. . = ALIGN(4);
  51. KEEP(*(.isr_vector)) /* Startup code */
  52. . = ALIGN(4);
  53. } >FLASH
  54. /* The program code and other data goes into FLASH */
  55. .text :
  56. {
  57. . = ALIGN(4);
  58. *(.text) /* .text sections (code) */
  59. *(.text*) /* .text* sections (code) */
  60. *(.glue_7) /* glue arm to thumb code */
  61. *(.glue_7t) /* glue thumb to arm code */
  62. *(.eh_frame)
  63. KEEP (*(.init))
  64. KEEP (*(.fini))
  65. . = ALIGN(4);
  66. _etext = .; /* define a global symbols at end of code */
  67. } >FLASH
  68. /* Constant data goes into FLASH */
  69. .rodata :
  70. {
  71. . = ALIGN(4);
  72. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  73. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  74. . = ALIGN(4);
  75. } >FLASH
  76. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  77. .ARM : {
  78. __exidx_start = .;
  79. *(.ARM.exidx*)
  80. __exidx_end = .;
  81. } >FLASH
  82. .preinit_array :
  83. {
  84. PROVIDE_HIDDEN (__preinit_array_start = .);
  85. KEEP (*(.preinit_array*))
  86. PROVIDE_HIDDEN (__preinit_array_end = .);
  87. } >FLASH
  88. .init_array :
  89. {
  90. PROVIDE_HIDDEN (__init_array_start = .);
  91. KEEP (*(SORT(.init_array.*)))
  92. KEEP (*(.init_array*))
  93. PROVIDE_HIDDEN (__init_array_end = .);
  94. } >FLASH
  95. .fini_array :
  96. {
  97. PROVIDE_HIDDEN (__fini_array_start = .);
  98. KEEP (*(SORT(.fini_array.*)))
  99. KEEP (*(.fini_array*))
  100. PROVIDE_HIDDEN (__fini_array_end = .);
  101. } >FLASH
  102. /* used by the startup to initialize data */
  103. _sidata = LOADADDR(.data);
  104. /* Initialized data sections goes into RAM, load LMA copy after code */
  105. .data :
  106. {
  107. . = ALIGN(4);
  108. _sdata = .; /* create a global symbol at data start */
  109. *(.data) /* .data sections */
  110. *(.data*) /* .data* sections */
  111. . = ALIGN(4);
  112. _edata = .; /* define a global symbol at data end */
  113. } >RW_IRAM1 AT> FLASH
  114. _siccmram = LOADADDR(.ccmram);
  115. /* CCM-RAM section
  116. *
  117. * IMPORTANT NOTE!
  118. * If initialized variables will be placed in this section,
  119. * the startup code needs to be modified to copy the init-values.
  120. */
  121. .ccmram :
  122. {
  123. . = ALIGN(4);
  124. _sccmram = .; /* create a global symbol at ccmram start */
  125. KEEP(*(RAM_ERR))
  126. . = ALIGN(4);
  127. _eccmram = .; /* create a global symbol at ccmram end */
  128. } >RW_IRAM2 AT> FLASH
  129. /* Uninitialized data section */
  130. . = ALIGN(4);
  131. .bss :
  132. {
  133. /* This is used by the startup in order to initialize the .bss secion */
  134. _sbss = .; /* define a global symbol at bss start */
  135. __bss_start__ = _sbss;
  136. *(.bss)
  137. *(.bss*)
  138. *(COMMON)
  139. . = ALIGN(4);
  140. _ebss = .; /* define a global symbol at bss end */
  141. __bss_end__ = _ebss;
  142. } >RW_IRAM1
  143. /* User_heap_stack section, used to check that there is enough RAM left */
  144. ._user_heap_stack :
  145. {
  146. . = ALIGN(4);
  147. PROVIDE ( end = . );
  148. PROVIDE ( _end = . );
  149. . = . + _Min_Heap_Size;
  150. . = . + _Min_Stack_Size;
  151. . = ALIGN(4);
  152. } >RW_IRAM1
  153. /* external sram data, do not initialize at startup */
  154. .ext_sram(NOLOAD) :
  155. {
  156. . = ALIGN(4);
  157. _sext_sram = .; /* create a global symbol at ext_sram start */
  158. KEEP(*(EXT_SRAM))
  159. . = ALIGN(4);
  160. _eext_sram = .; /* define a global symbol at ext_sram end */
  161. } >EXTSRAM AT> FLASH
  162. /* Remove information from the standard libraries */
  163. /DISCARD/ :
  164. {
  165. libc.a ( * )
  166. libm.a ( * )
  167. libgcc.a ( * )
  168. }
  169. .ARM.attributes 0 : { *(.ARM.attributes) }
  170. }