STM32F030F4Px_FLASH.ld 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : LinkerScript.ld
  5. **
  6. ** Abstract : Linker script for STM32F030F4Px 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. **
  17. ** Distribution: The file is distributed as is, without any warranty
  18. ** of any kind.
  19. *****************************************************************************
  20. ** @attention
  21. **
  22. ** <h2><center>&copy; COPYRIGHT(c) 2014 Ac6</center></h2>
  23. **
  24. ** Redistribution and use in source and binary forms, with or without modification,
  25. ** are permitted provided that the following conditions are met:
  26. ** 1. Redistributions of source code must retain the above copyright notice,
  27. ** this list of conditions and the following disclaimer.
  28. ** 2. Redistributions in binary form must reproduce the above copyright notice,
  29. ** this list of conditions and the following disclaimer in the documentation
  30. ** and/or other materials provided with the distribution.
  31. ** 3. Neither the name of Ac6 nor the names of its contributors
  32. ** may be used to endorse or promote products derived from this software
  33. ** without specific prior written permission.
  34. **
  35. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  36. ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  37. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  39. ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  40. ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  41. ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  42. ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  43. ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  44. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  45. **
  46. *****************************************************************************
  47. */
  48. /* Entry Point */
  49. ENTRY(Reset_Handler)
  50. /* Highest address of the user mode stack */
  51. _estack = 0x20001000; /* end of RAM */
  52. /* Generate a link error if heap and stack don't fit into RAM */
  53. _Min_Heap_Size = 0; /* required amount of heap */
  54. _Min_Stack_Size = 0; /* required amount of stack */
  55. /* Specify the memory areas */
  56. MEMORY
  57. {
  58. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
  59. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K
  60. }
  61. /* Define output sections */
  62. SECTIONS
  63. {
  64. /* The startup code goes first into FLASH */
  65. .isr_vector :
  66. {
  67. . = ALIGN(4);
  68. KEEP(*(.isr_vector)) /* Startup code */
  69. . = ALIGN(4);
  70. } >FLASH
  71. /* The program code and other data goes into FLASH */
  72. .text :
  73. {
  74. . = ALIGN(4);
  75. *(.text) /* .text sections (code) */
  76. *(.text*) /* .text* sections (code) */
  77. *(.glue_7) /* glue arm to thumb code */
  78. *(.glue_7t) /* glue thumb to arm code */
  79. *(.eh_frame)
  80. KEEP (*(.init))
  81. KEEP (*(.fini))
  82. . = ALIGN(4);
  83. _etext = .; /* define a global symbols at end of code */
  84. } >FLASH
  85. /* Constant data goes into FLASH */
  86. .rodata :
  87. {
  88. . = ALIGN(4);
  89. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  90. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  91. . = ALIGN(4);
  92. } >FLASH
  93. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  94. .ARM : {
  95. __exidx_start = .;
  96. *(.ARM.exidx*)
  97. __exidx_end = .;
  98. } >FLASH
  99. .preinit_array :
  100. {
  101. PROVIDE_HIDDEN (__preinit_array_start = .);
  102. KEEP (*(.preinit_array*))
  103. PROVIDE_HIDDEN (__preinit_array_end = .);
  104. } >FLASH
  105. .init_array :
  106. {
  107. PROVIDE_HIDDEN (__init_array_start = .);
  108. KEEP (*(SORT(.init_array.*)))
  109. KEEP (*(.init_array*))
  110. PROVIDE_HIDDEN (__init_array_end = .);
  111. } >FLASH
  112. .fini_array :
  113. {
  114. PROVIDE_HIDDEN (__fini_array_start = .);
  115. KEEP (*(SORT(.fini_array.*)))
  116. KEEP (*(.fini_array*))
  117. PROVIDE_HIDDEN (__fini_array_end = .);
  118. } >FLASH
  119. /* used by the startup to initialize data */
  120. _sidata = LOADADDR(.data);
  121. /* Initialized data sections goes into RAM, load LMA copy after code */
  122. .data :
  123. {
  124. . = ALIGN(4);
  125. _sdata = .; /* create a global symbol at data start */
  126. *(.data) /* .data sections */
  127. *(.data*) /* .data* sections */
  128. . = ALIGN(4);
  129. _edata = .; /* define a global symbol at data end */
  130. } >RAM AT> FLASH
  131. /* Uninitialized data section */
  132. . = ALIGN(4);
  133. .bss :
  134. {
  135. /* This is used by the startup in order to initialize the .bss secion */
  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 left */
  146. ._user_heap_stack :
  147. {
  148. . = ALIGN(4);
  149. PROVIDE ( end = . );
  150. PROVIDE ( _end = . );
  151. . = . + _Min_Heap_Size;
  152. . = . + _Min_Stack_Size;
  153. . = ALIGN(4);
  154. } >RAM
  155. /* Remove information from the standard libraries */
  156. /DISCARD/ :
  157. {
  158. libc.a ( * )
  159. libm.a ( * )
  160. libgcc.a ( * )
  161. }
  162. .ARM.attributes 0 : { *(.ARM.attributes) }
  163. }