stm32f030.ld 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * STM32F030 Linkerscript
  3. * Copyright (C) 2019 Stefan Strobel <stefan.strobel@shimatta.net>
  4. *
  5. * This file is part of 'STM32F0 code template'.
  6. *
  7. * It is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation, version 2 of the License.
  10. *
  11. * This code is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this template. If not, see <http://www.gnu.org/licenses/>.
  18. * --------------------------------------------------------------------
  19. * FLASH: 16K
  20. * RAM: 4K
  21. */
  22. /* USER PARAMETERS */
  23. __ld_stack_size = 0x0400;
  24. __ld_heap_size = 0x0200;
  25. /* END OF USER PARAMETERS */
  26. ENTRY(Reset_Handler)
  27. __ld_top_of_stack = 0x20001000; /* One byte above the end of the SRAM. Stack is pre-decrewmenting, so this is okay */
  28. /* Available memory areas */
  29. MEMORY
  30. {
  31. FLASH (xr) : ORIGIN = 0x08000000, LENGTH = 16K
  32. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 4K
  33. }
  34. SECTIONS
  35. {
  36. .vectors :
  37. {
  38. . = ALIGN(4);
  39. KEEP(*(.vectors))
  40. . = ALIGN(4);
  41. } >FLASH
  42. .text :
  43. {
  44. . = ALIGN(4);
  45. *(.text) /* .text sections (code) */
  46. *(.text*) /* .text* sections (code) */
  47. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  48. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  49. *(.glue_7) /* glue arm to thumb code */
  50. *(.glue_7t) /* glue thumb to arm code */
  51. *(.eh_frame)
  52. KEEP(*(.init)) /* Constructors */
  53. KEEP(*(.fini)) /* Destructors */
  54. } >FLASH
  55. .ARM.extab :
  56. {
  57. *(.ARM.extab* .gnu.linkonce.armextab.*)
  58. } >FLASH
  59. .ARM :
  60. {
  61. __exidx_start = .;
  62. *(.ARM.exidx*)
  63. __exidx_end = .;
  64. } >FLASH
  65. /* Constructor/Destructor tables */
  66. .preinit_array :
  67. {
  68. PROVIDE_HIDDEN (__preinit_array_start = .);
  69. KEEP (*(.preinit_array*))
  70. PROVIDE_HIDDEN (__preinit_array_end = .);
  71. } >FLASH
  72. .init_array :
  73. {
  74. PROVIDE_HIDDEN (__init_array_start = .);
  75. KEEP (*(SORT(.init_array.*)))
  76. KEEP (*(.init_array*))
  77. PROVIDE_HIDDEN (__init_array_end = .);
  78. } >FLASH
  79. .fini_array :
  80. {
  81. PROVIDE_HIDDEN (__fini_array_start = .);
  82. KEEP (*(.fini_array*))
  83. KEEP (*(SORT(.fini_array.*)))
  84. PROVIDE_HIDDEN (__fini_array_end = .);
  85. } >FLASH
  86. /* Initialized Data */
  87. __ld_load_data = LOADADDR(.data);
  88. .data :
  89. {
  90. . = ALIGN(4);
  91. __ld_sdata = .;
  92. *(.data)
  93. *(.data*)
  94. . = ALIGN(4);
  95. __ld_edata = .;
  96. } >RAM AT> FLASH
  97. /* Uninitialized static data */
  98. .bss :
  99. {
  100. . = ALIGN(4);
  101. __ld_sbss = .;
  102. *(.bss)
  103. *(.bss*)
  104. *(COMMON)
  105. . = ALIGN(4);
  106. __ld_ebss = .;
  107. } >RAM
  108. .heap_stack (NOLOAD) :
  109. {
  110. . = ALIGN(4);
  111. __ld_sheap = .;
  112. . = . + __ld_heap_size;
  113. __ld_eheap = .;
  114. . = . + __ld_stack_size;
  115. . = ALIGN(4);
  116. } >RAM
  117. }