STM32F103RC_FLASH.ld 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : stm32_flash.ld
  5. **
  6. ** Abstract : Linker script for STM32F103RC Device with
  7. ** 256KByte FLASH, 48KByte 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 = 0x2000C000; /* 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. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
  40. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 16K
  41. }
  42. /* Define output sections */
  43. SECTIONS
  44. {
  45. /* The startup code goes first into FLASH */
  46. .isr_vector :
  47. {
  48. . = ALIGN(4);
  49. KEEP(*(.isr_vector)) /* Startup code */
  50. . = ALIGN(4);
  51. } >FLASH
  52. /* The program code and other data goes into FLASH */
  53. .text :
  54. {
  55. . = ALIGN(4);
  56. *(.text) /* .text sections (code) */
  57. *(.text*) /* .text* sections (code) */
  58. *(.glue_7) /* glue arm to thumb code */
  59. *(.glue_7t) /* glue thumb to arm code */
  60. *(.eh_frame)
  61. KEEP (*(.init))
  62. KEEP (*(.fini))
  63. . = ALIGN(4);
  64. _etext = .; /* define a global symbols at end of code */
  65. } >FLASH
  66. /* Constant data goes into FLASH */
  67. .rodata :
  68. {
  69. . = ALIGN(4);
  70. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  71. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  72. . = ALIGN(4);
  73. } >FLASH
  74. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  75. .ARM : {
  76. __exidx_start = .;
  77. *(.ARM.exidx*)
  78. __exidx_end = .;
  79. } >FLASH
  80. .preinit_array :
  81. {
  82. PROVIDE_HIDDEN (__preinit_array_start = .);
  83. KEEP (*(.preinit_array*))
  84. PROVIDE_HIDDEN (__preinit_array_end = .);
  85. } >FLASH
  86. .init_array :
  87. {
  88. PROVIDE_HIDDEN (__init_array_start = .);
  89. KEEP (*(SORT(.init_array.*)))
  90. KEEP (*(.init_array*))
  91. PROVIDE_HIDDEN (__init_array_end = .);
  92. } >FLASH
  93. .fini_array :
  94. {
  95. PROVIDE_HIDDEN (__fini_array_start = .);
  96. KEEP (*(SORT(.fini_array.*)))
  97. KEEP (*(.fini_array*))
  98. PROVIDE_HIDDEN (__fini_array_end = .);
  99. } >FLASH
  100. /* used by the startup to initialize data */
  101. _sidata = LOADADDR(.data);
  102. /* Initialized data sections goes into RAM, load LMA copy after code */
  103. .data :
  104. {
  105. . = ALIGN(4);
  106. _sdata = .; /* create a global symbol at data start */
  107. *(.data) /* .data sections */
  108. *(.data*) /* .data* sections */
  109. . = ALIGN(4);
  110. _edata = .; /* define a global symbol at data end */
  111. } >RAM AT> FLASH
  112. /* Uninitialized data section */
  113. . = ALIGN(4);
  114. .bss :
  115. {
  116. /* This is used by the startup in order to initialize the .bss secion */
  117. _sbss = .; /* define a global symbol at bss start */
  118. __bss_start__ = _sbss;
  119. *(.bss)
  120. *(.bss*)
  121. *(COMMON)
  122. . = ALIGN(4);
  123. _ebss = .; /* define a global symbol at bss end */
  124. __bss_end__ = _ebss;
  125. } >RAM
  126. /* User_heap_stack section, used to check that there is enough RAM left */
  127. ._user_heap_stack :
  128. {
  129. . = ALIGN(4);
  130. PROVIDE ( end = . );
  131. PROVIDE ( _end = . );
  132. . = . + _Min_Heap_Size;
  133. . = . + _Min_Stack_Size;
  134. . = ALIGN(4);
  135. } >RAM
  136. /* Remove information from the standard libraries */
  137. /DISCARD/ :
  138. {
  139. libc.a ( * )
  140. libm.a ( * )
  141. libgcc.a ( * )
  142. }
  143. .ARM.attributes 0 : { *(.ARM.attributes) }
  144. }