STM32F030F4P6_flash.ld 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : stm32_flash.ld
  5. **
  6. ** Abstract : Linker script for STM32F0 Device with
  7. ** 16KByte FLASH, 4KByte 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. Distribution of this file (unmodified or modified) is not
  24. ** permitted. Atollic AB permit registered Atollic TrueSTUDIO(R) users the
  25. ** rights to distribute the assembled, compiled & linked contents of this
  26. ** file as part of an application binary file, provided that it is built
  27. ** using the Atollic TrueSTUDIO(R) toolchain.
  28. **
  29. *****************************************************************************
  30. */
  31. /* Entry Point */
  32. ENTRY(Reset_Handler)
  33. /* Highest address of the user mode stack */
  34. _estack = 0x20001000; /* end of 4K RAM on AHB bus*/
  35. /* Generate a link error if heap and stack don't fit into RAM */
  36. _Min_Heap_Size = 0; /* required amount of heap */
  37. _Min_Stack_Size = 0x400; /* required amount of stack */
  38. /* Specify the memory areas */
  39. MEMORY
  40. {
  41. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 16K
  42. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K
  43. MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K
  44. }
  45. /* Define output sections */
  46. SECTIONS
  47. {
  48. /* The startup code goes first into FLASH */
  49. .isr_vector :
  50. {
  51. . = ALIGN(4);
  52. KEEP(*(.isr_vector)) /* Startup code */
  53. . = ALIGN(4);
  54. } >FLASH
  55. /* The program code and other data goes into FLASH */
  56. .text :
  57. {
  58. . = ALIGN(4);
  59. *(.text) /* .text sections (code) */
  60. *(.text*) /* .text* sections (code) */
  61. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  62. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  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. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  72. .ARM : {
  73. __exidx_start = .;
  74. *(.ARM.exidx*)
  75. __exidx_end = .;
  76. } >FLASH
  77. .preinit_array :
  78. {
  79. PROVIDE_HIDDEN (__preinit_array_start = .);
  80. KEEP (*(.preinit_array*))
  81. PROVIDE_HIDDEN (__preinit_array_end = .);
  82. } >FLASH
  83. .init_array :
  84. {
  85. PROVIDE_HIDDEN (__init_array_start = .);
  86. KEEP (*(SORT(.init_array.*)))
  87. KEEP (*(.init_array*))
  88. PROVIDE_HIDDEN (__init_array_end = .);
  89. } >FLASH
  90. .fini_array :
  91. {
  92. PROVIDE_HIDDEN (__fini_array_start = .);
  93. KEEP (*(.fini_array*))
  94. KEEP (*(SORT(.fini_array.*)))
  95. PROVIDE_HIDDEN (__fini_array_end = .);
  96. } >FLASH
  97. /* used by the startup to initialize data */
  98. _sidata = .;
  99. /* Initialized data sections goes into RAM, load LMA copy after code */
  100. .data : AT ( _sidata )
  101. {
  102. . = ALIGN(4);
  103. _sdata = .; /* create a global symbol at data start */
  104. *(.data) /* .data sections */
  105. *(.data*) /* .data* sections */
  106. . = ALIGN(4);
  107. _edata = .; /* define a global symbol at data end */
  108. } >RAM
  109. /* Uninitialized data section */
  110. . = ALIGN(4);
  111. .bss :
  112. {
  113. /* This is used by the startup in order to initialize the .bss secion */
  114. _sbss = .; /* define a global symbol at bss start */
  115. __bss_start__ = _sbss;
  116. *(.bss)
  117. *(.bss*)
  118. *(COMMON)
  119. . = ALIGN(4);
  120. _ebss = .; /* define a global symbol at bss end */
  121. __bss_end__ = _ebss;
  122. } >RAM
  123. /* User_heap_stack section, used to check that there is enough RAM left */
  124. ._user_heap_stack :
  125. {
  126. . = ALIGN(4);
  127. PROVIDE ( end = . );
  128. PROVIDE ( _end = . );
  129. . = . + _Min_Heap_Size;
  130. . = . + _Min_Stack_Size;
  131. . = ALIGN(4);
  132. } >RAM
  133. /* MEMORY_bank1 section, code must be located here explicitly */
  134. /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
  135. .memory_b1_text :
  136. {
  137. *(.mb1text) /* .mb1text sections (code) */
  138. *(.mb1text*) /* .mb1text* sections (code) */
  139. *(.mb1rodata) /* read-only data (constants) */
  140. *(.mb1rodata*)
  141. } >MEMORY_B1
  142. /* Remove information from the standard libraries */
  143. /DISCARD/ :
  144. {
  145. libc.a ( * )
  146. libm.a ( * )
  147. libgcc.a ( * )
  148. }
  149. .ARM.attributes 0 : { *(.ARM.attributes) }
  150. }