STM32L432XX.ld 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #if !defined(MBED_APP_START)
  2. #define MBED_APP_START 0x08000000
  3. #endif
  4. #if !defined(MBED_APP_SIZE)
  5. #define MBED_APP_SIZE 256k
  6. #endif
  7. /* Linker script to configure memory regions. */
  8. MEMORY
  9. {
  10. FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
  11. SRAM1 (rwx) : ORIGIN = 0x20000188, LENGTH = 64k - 0x188
  12. }
  13. /* Linker script to place sections and symbol values. Should be used together
  14. * with other linker script that defines memory regions FLASH and RAM.
  15. * It references following symbols, which must be defined in code:
  16. * Reset_Handler : Entry of reset handler
  17. *
  18. * It defines following symbols, which code can use without definition:
  19. * __exidx_start
  20. * __exidx_end
  21. * __etext
  22. * __data_start__
  23. * __preinit_array_start
  24. * __preinit_array_end
  25. * __init_array_start
  26. * __init_array_end
  27. * __fini_array_start
  28. * __fini_array_end
  29. * __data_end__
  30. * __bss_start__
  31. * __bss_end__
  32. * __end__
  33. * end
  34. * __HeapLimit
  35. * __StackLimit
  36. * __StackTop
  37. * __stack
  38. * _estack
  39. */
  40. ENTRY(Reset_Handler)
  41. SECTIONS
  42. {
  43. .text :
  44. {
  45. KEEP(*(.isr_vector))
  46. *(.text*)
  47. KEEP(*(.init))
  48. KEEP(*(.fini))
  49. /* .ctors */
  50. *crtbegin.o(.ctors)
  51. *crtbegin?.o(.ctors)
  52. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  53. *(SORT(.ctors.*))
  54. *(.ctors)
  55. /* .dtors */
  56. *crtbegin.o(.dtors)
  57. *crtbegin?.o(.dtors)
  58. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  59. *(SORT(.dtors.*))
  60. *(.dtors)
  61. *(.rodata*)
  62. KEEP(*(.eh_frame*))
  63. } > FLASH
  64. .ARM.extab :
  65. {
  66. *(.ARM.extab* .gnu.linkonce.armextab.*)
  67. } > FLASH
  68. __exidx_start = .;
  69. .ARM.exidx :
  70. {
  71. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  72. } > FLASH
  73. __exidx_end = .;
  74. __etext = .;
  75. _sidata = .;
  76. .data : AT (__etext)
  77. {
  78. __data_start__ = .;
  79. _sdata = .;
  80. *(vtable)
  81. *(.data*)
  82. . = ALIGN(4);
  83. /* preinit data */
  84. PROVIDE_HIDDEN (__preinit_array_start = .);
  85. KEEP(*(.preinit_array))
  86. PROVIDE_HIDDEN (__preinit_array_end = .);
  87. . = ALIGN(4);
  88. /* init data */
  89. PROVIDE_HIDDEN (__init_array_start = .);
  90. KEEP(*(SORT(.init_array.*)))
  91. KEEP(*(.init_array))
  92. PROVIDE_HIDDEN (__init_array_end = .);
  93. . = ALIGN(4);
  94. /* finit data */
  95. PROVIDE_HIDDEN (__fini_array_start = .);
  96. KEEP(*(SORT(.fini_array.*)))
  97. KEEP(*(.fini_array))
  98. PROVIDE_HIDDEN (__fini_array_end = .);
  99. KEEP(*(.jcr*))
  100. . = ALIGN(4);
  101. /* All data end */
  102. __data_end__ = .;
  103. _edata = .;
  104. } > SRAM1
  105. .bss :
  106. {
  107. . = ALIGN(4);
  108. __bss_start__ = .;
  109. _sbss = .;
  110. *(.bss*)
  111. *(COMMON)
  112. . = ALIGN(4);
  113. __bss_end__ = .;
  114. _ebss = .;
  115. } > SRAM1
  116. .heap (COPY):
  117. {
  118. __end__ = .;
  119. end = __end__;
  120. *(.heap*)
  121. __HeapLimit = .;
  122. } > SRAM1
  123. /* .stack_dummy section doesn't contains any symbols. It is only
  124. * used for linker to calculate size of stack sections, and assign
  125. * values to stack symbols later */
  126. .stack_dummy (COPY):
  127. {
  128. *(.stack*)
  129. } > SRAM1
  130. /* Set stack top to end of RAM, and stack limit move down by
  131. * size of stack_dummy section */
  132. __StackTop = ORIGIN(SRAM1) + LENGTH(SRAM1);
  133. _estack = __StackTop;
  134. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  135. PROVIDE(__stack = __StackTop);
  136. /* Check if data + heap + stack exceeds RAM limit */
  137. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  138. }