efm32gg.ld 2.9 KB

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