stm32f4.ld.in 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
  14. }
  15. /* Define output sections */
  16. SECTIONS
  17. {
  18. /* The startup code goes first into FLASH */
  19. .isr_vector :
  20. {
  21. . = ALIGN(4);
  22. KEEP(*(.isr_vector)) /* Startup code */
  23. . = ALIGN(4);
  24. } >FLASH
  25. /* The program code and other data goes into FLASH */
  26. .text :
  27. {
  28. . = ALIGN(4);
  29. *(.text) /* .text sections (code) */
  30. *(.text*) /* .text* sections (code) */
  31. *(.glue_7) /* glue arm to thumb code */
  32. *(.glue_7t) /* glue thumb to arm code */
  33. *(.eh_frame)
  34. KEEP (*(.init))
  35. KEEP (*(.fini))
  36. . = ALIGN(4);
  37. _etext = .; /* define a global symbols at end of code */
  38. } >FLASH
  39. /* Constant data goes into FLASH */
  40. .rodata :
  41. {
  42. . = ALIGN(4);
  43. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  44. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  45. . = ALIGN(4);
  46. } >FLASH
  47. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  48. .ARM : {
  49. __exidx_start = .;
  50. *(.ARM.exidx*)
  51. __exidx_end = .;
  52. } >FLASH
  53. .preinit_array :
  54. {
  55. PROVIDE_HIDDEN (__preinit_array_start = .);
  56. KEEP (*(.preinit_array*))
  57. PROVIDE_HIDDEN (__preinit_array_end = .);
  58. } >FLASH
  59. .init_array :
  60. {
  61. PROVIDE_HIDDEN (__init_array_start = .);
  62. KEEP (*(SORT(.init_array.*)))
  63. KEEP (*(.init_array*))
  64. PROVIDE_HIDDEN (__init_array_end = .);
  65. } >FLASH
  66. .fini_array :
  67. {
  68. PROVIDE_HIDDEN (__fini_array_start = .);
  69. KEEP (*(SORT(.fini_array.*)))
  70. KEEP (*(.fini_array*))
  71. PROVIDE_HIDDEN (__fini_array_end = .);
  72. } >FLASH
  73. /* used by the startup to initialize data */
  74. _sidata = LOADADDR(.data);
  75. /* Initialized data sections goes into RAM, load LMA copy after code */
  76. .data :
  77. {
  78. . = ALIGN(4);
  79. _sdata = .; /* create a global symbol at data start */
  80. *(.data) /* .data sections */
  81. *(.data*) /* .data* sections */
  82. . = ALIGN(4);
  83. _edata = .; /* define a global symbol at data end */
  84. } >RAM AT> FLASH
  85. _siccmram = LOADADDR(.ccmram);
  86. /* CCM-RAM section
  87. *
  88. * IMPORTANT NOTE!
  89. * If initialized variables will be placed in this section,
  90. * the startup code needs to be modified to copy the init-values.
  91. */
  92. .ccmram :
  93. {
  94. . = ALIGN(4);
  95. _sccmram = .; /* create a global symbol at ccmram start */
  96. *(.ccmram)
  97. *(.ccmram*)
  98. . = ALIGN(4);
  99. _eccmram = .; /* create a global symbol at ccmram end */
  100. } >CCMRAM AT> FLASH
  101. /* Uninitialized data section */
  102. . = ALIGN(4);
  103. .bss :
  104. {
  105. /* This is used by the startup in order to initialize the .bss secion */
  106. _sbss = .; /* define a global symbol at bss start */
  107. __bss_start__ = _sbss;
  108. *(.bss)
  109. *(.bss*)
  110. *(COMMON)
  111. . = ALIGN(4);
  112. _ebss = .; /* define a global symbol at bss end */
  113. __bss_end__ = _ebss;
  114. } >RAM
  115. /* User_heap_stack section, used to check that there is enough RAM left */
  116. ._user_heap_stack :
  117. {
  118. . = ALIGN(4);
  119. PROVIDE ( end = . );
  120. PROVIDE ( _end = . );
  121. . = . + _Min_Heap_Size;
  122. . = . + _Min_Stack_Size;
  123. . = ALIGN(4);
  124. } >RAM
  125. /* Remove information from the standard libraries */
  126. /DISCARD/ :
  127. {
  128. libc.a ( * )
  129. libm.a ( * )
  130. libgcc.a ( * )
  131. }
  132. .ARM.attributes 0 : { *(.ARM.attributes) }
  133. }