stm32f1.ld.in 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /* Entry Point */
  2. ENTRY(Reset_Handler)
  3. /* Highest address of the user mode stack */
  4. _estack = ${STM32_STACK_ADDRESS}; /* end of RAM */
  5. /* Generate a link error if heap and stack don't fit into RAM */
  6. _Min_Heap_Size = ${STM32_MIN_HEAP_SIZE}; /* required amount of heap */
  7. _Min_Stack_Size = ${STM32_MIN_STACK_SIZE}; /* required amount of stack */
  8. /* Specify the memory areas */
  9. MEMORY
  10. {
  11. FLASH (rx) : ORIGIN = ${STM32_FLASH_ORIGIN}, LENGTH = ${STM32_FLASH_SIZE}
  12. RAM (xrw) : ORIGIN = ${STM32_RAM_ORIGIN}, LENGTH = ${STM32_RAM_SIZE}
  13. }
  14. /* Define output sections */
  15. SECTIONS
  16. {
  17. /* The startup code goes first into FLASH */
  18. .isr_vector :
  19. {
  20. . = ALIGN(4);
  21. KEEP(*(.isr_vector)) /* Startup code */
  22. . = ALIGN(4);
  23. } >FLASH
  24. /* The program code and other data goes into FLASH */
  25. .text :
  26. {
  27. . = ALIGN(4);
  28. *(.text) /* .text sections (code) */
  29. *(.text*) /* .text* sections (code) */
  30. *(.glue_7) /* glue arm to thumb code */
  31. *(.glue_7t) /* glue thumb to arm code */
  32. *(.eh_frame)
  33. KEEP (*(.init))
  34. KEEP (*(.fini))
  35. . = ALIGN(4);
  36. _etext = .; /* define a global symbols at end of code */
  37. } >FLASH
  38. /* Constant data goes into FLASH */
  39. .rodata :
  40. {
  41. . = ALIGN(4);
  42. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  43. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  44. . = ALIGN(4);
  45. } >FLASH
  46. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  47. .ARM : {
  48. __exidx_start = .;
  49. *(.ARM.exidx*)
  50. __exidx_end = .;
  51. } >FLASH
  52. .preinit_array :
  53. {
  54. PROVIDE_HIDDEN (__preinit_array_start = .);
  55. KEEP (*(.preinit_array*))
  56. PROVIDE_HIDDEN (__preinit_array_end = .);
  57. } >FLASH
  58. .init_array :
  59. {
  60. PROVIDE_HIDDEN (__init_array_start = .);
  61. KEEP (*(SORT(.init_array.*)))
  62. KEEP (*(.init_array*))
  63. PROVIDE_HIDDEN (__init_array_end = .);
  64. } >FLASH
  65. .fini_array :
  66. {
  67. PROVIDE_HIDDEN (__fini_array_start = .);
  68. KEEP (*(SORT(.fini_array.*)))
  69. KEEP (*(.fini_array*))
  70. PROVIDE_HIDDEN (__fini_array_end = .);
  71. } >FLASH
  72. /* used by the startup to initialize data */
  73. _sidata = LOADADDR(.data);
  74. /* Initialized data sections goes into RAM, load LMA copy after code */
  75. .data :
  76. {
  77. . = ALIGN(4);
  78. _sdata = .; /* create a global symbol at data start */
  79. *(.data) /* .data sections */
  80. *(.data*) /* .data* sections */
  81. . = ALIGN(4);
  82. _edata = .; /* define a global symbol at data end */
  83. } >RAM AT> FLASH
  84. /* Uninitialized data section */
  85. . = ALIGN(4);
  86. .bss :
  87. {
  88. /* This is used by the startup in order to initialize the .bss secion */
  89. _sbss = .; /* define a global symbol at bss start */
  90. __bss_start__ = _sbss;
  91. *(.bss)
  92. *(.bss*)
  93. *(COMMON)
  94. . = ALIGN(4);
  95. _ebss = .; /* define a global symbol at bss end */
  96. __bss_end__ = _ebss;
  97. } >RAM
  98. /* User_heap_stack section, used to check that there is enough RAM left */
  99. ._user_heap_stack :
  100. {
  101. . = ALIGN(4);
  102. PROVIDE ( end = . );
  103. PROVIDE ( _end = . );
  104. . = . + _Min_Heap_Size;
  105. . = . + _Min_Stack_Size;
  106. . = ALIGN(4);
  107. } >RAM
  108. /* Remove information from the standard libraries */
  109. /DISCARD/ :
  110. {
  111. libc.a ( * )
  112. libm.a ( * )
  113. libgcc.a ( * )
  114. }
  115. .ARM.attributes 0 : { *(.ARM.attributes) }
  116. }