arm-gcc-link.ld 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  2. /* Internal Memory Map*/
  3. MEMORY
  4. {
  5. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K
  6. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
  7. }
  8. _estack = 0x20005000; /* end of RAM */
  9. SECTIONS
  10. {
  11. .text :
  12. {
  13. KEEP(*(.isr_vector))
  14. *(.text*)
  15. KEEP(*(.init))
  16. KEEP(*(.fini))
  17. /* .ctors */
  18. *crtbegin.o(.ctors)
  19. *crtbegin?.o(.ctors)
  20. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  21. *(SORT(.ctors.*))
  22. *(.ctors)
  23. /* .dtors */
  24. *crtbegin.o(.dtors)
  25. *crtbegin?.o(.dtors)
  26. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  27. *(SORT(.dtors.*))
  28. *(.dtors)
  29. *(.rodata*)
  30. KEEP(*(.eh_fram e*))
  31. } > FLASH
  32. .ARM.extab :
  33. {
  34. *(.ARM.extab* .gnu.linkonce.armextab.*)
  35. } > FLASH
  36. __exidx_start = .;
  37. .ARM.exidx :
  38. {
  39. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  40. } > FLASH
  41. __exidx_end = .;
  42. __etext = .;
  43. /* _sidata is used in coide startup code */
  44. _sidata = __etext;
  45. .data : AT (__etext)
  46. {
  47. __data_start__ = .;
  48. /* _sdata is used in coide startup code */
  49. _sdata = __data_start__;
  50. *(vtable)
  51. *(.data*)
  52. . = ALIGN(4);
  53. /* preinit data */
  54. PROVIDE_HIDDEN (__preinit_array_start = .);
  55. KEEP(*(.preinit_array))
  56. PROVIDE_HIDDEN (__preinit_array_end = .);
  57. . = ALIGN(4);
  58. /* init data */
  59. PROVIDE_HIDDEN (__init_array_start = .);
  60. KEEP(*(SORT(.init_array.*)))
  61. KEEP(*(.init_array))
  62. PROVIDE_HIDDEN (__init_array_end = .);
  63. . = ALIGN(4);
  64. /* finit data */
  65. PROVIDE_HIDDEN (__fini_array_start = .);
  66. KEEP(*(SORT(.fini_array.*)))
  67. KEEP(*(.fini_array))
  68. PROVIDE_HIDDEN (__fini_array_end = .);
  69. KEEP(*(.jcr*))
  70. . = ALIGN(4);
  71. /* All data end */
  72. __data_end__ = .;
  73. /* _edata is used in coide startup code */
  74. _edata = __data_end__;
  75. } > RAM
  76. .bss :
  77. {
  78. . = ALIGN(4);
  79. __bss_start__ = .;
  80. _sbss = __bss_start__;
  81. *(.bss*)
  82. *(COMMON)
  83. . = ALIGN(4);
  84. __bss_end__ = .;
  85. _ebss = __bss_end__;
  86. } > RAM
  87. .heap (COPY):
  88. {
  89. __end__ = .;
  90. _end = __end__;
  91. end = __end__;
  92. *(.heap*)
  93. __HeapLimit = .;
  94. } > RAM
  95. /* .stack_dummy section doesn't contains any symbols. It is only
  96. * used for linker to calculate size of stack sections, and assign
  97. * values to stack symbols later */
  98. .co_stack (NOLOAD):
  99. {
  100. . = ALIGN(8);
  101. *(.co_stack .co_stack.*)
  102. } > RAM
  103. /* Set stack top to end of ram , and stack limit move down by
  104. * size of stack_dummy section */
  105. __StackTop = ORIGIN(RAM ) + LENGTH(RAM );
  106. __StackLimit = __StackTop - SIZEOF(.co_stack);
  107. PROVIDE(__stack = __StackTop);
  108. /* Check if data + heap + stack exceeds ram limit */
  109. ASSERT(__StackLimit >= __HeapLimit, "region ram overflowed with stack")
  110. }