link.lds 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * linker script for ACM32F4xx with GNU ld
  3. */
  4. /* describes the location and size of blocks of memory in the target. */
  5. MEMORY
  6. {
  7. CODE (rx) : ORIGIN = 0x00000000, LENGTH = 512k /* 512KB flash */
  8. DATA (rw) : ORIGIN = 0x20000000, LENGTH = 192k /* 192KB sram */
  9. }
  10. /* Program Entry, set to mark it as "used" and avoid gc */
  11. ENTRY(Reset_Handler)
  12. _system_stack_size = 0x800;
  13. SECTIONS
  14. {
  15. .text :
  16. {
  17. . = ALIGN(4);
  18. _stext = .;
  19. KEEP(*(.isr_vector)) /* Startup code */
  20. . = ALIGN(4);
  21. *(.text) /* remaining code */
  22. *(.text.*) /* remaining code */
  23. *(.rodata) /* read-only data (constants) */
  24. *(.rodata*)
  25. *(.glue_7)
  26. *(.glue_7t)
  27. *(.gnu.linkonce.t*)
  28. /* section information for finsh shell */
  29. . = ALIGN(4);
  30. __fsymtab_start = .;
  31. KEEP(*(FSymTab))
  32. __fsymtab_end = .;
  33. . = ALIGN(4);
  34. __vsymtab_start = .;
  35. KEEP(*(VSymTab))
  36. __vsymtab_end = .;
  37. . = ALIGN(4);
  38. /* section information for initial. */
  39. . = ALIGN(4);
  40. __rt_init_start = .;
  41. KEEP(*(SORT(.rti_fn*)))
  42. __rt_init_end = .;
  43. . = ALIGN(4);
  44. PROVIDE(__ctors_start__ = .);
  45. KEEP (*(SORT(.init_array.*)))
  46. KEEP (*(.init_array))
  47. PROVIDE(__ctors_end__ = .);
  48. . = ALIGN(4);
  49. _etext = .;
  50. } > CODE
  51. /* .ARM.exidx is sorted, so has to go in its own output section. */
  52. __exidx_start = .;
  53. .ARM.exidx :
  54. {
  55. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  56. /* This is used by the startup in order to initialize the .data secion */
  57. _sidata = .;
  58. } > CODE
  59. __exidx_end = .;
  60. /* .data section which is used for initialized data */
  61. .data : AT (_sidata)
  62. {
  63. . = ALIGN(4);
  64. /* This is used by the startup in order to initialize the .data secion */
  65. _sdata = . ;
  66. *(.data)
  67. *(.data.*)
  68. *(.gnu.linkonce.d*)
  69. PROVIDE(__dtors_start__ = .);
  70. KEEP(*(SORT(.dtors.*)))
  71. KEEP(*(.dtors))
  72. PROVIDE(__dtors_end__ = .);
  73. . = ALIGN(4);
  74. /* This is used by the startup in order to initialize the .data secion */
  75. _edata = . ;
  76. } >DATA
  77. .stack :
  78. {
  79. . = ALIGN(8);
  80. _sstack = .;
  81. . = . + _system_stack_size;
  82. . = ALIGN(8);
  83. _estack = .;
  84. } >DATA
  85. __bss_start = .;
  86. .bss :
  87. {
  88. . = ALIGN(4);
  89. /* This is used by the startup in order to initialize the .bss secion */
  90. _sbss = .;
  91. *(.bss)
  92. *(.bss.*)
  93. *(COMMON)
  94. . = ALIGN(4);
  95. /* This is used by the startup in order to initialize the .bss secion */
  96. _ebss = . ;
  97. *(.bss.init)
  98. } > DATA
  99. __bss_end = .;
  100. _end = .;
  101. /* Stabs debugging sections. */
  102. .stab 0 : { *(.stab) }
  103. .stabstr 0 : { *(.stabstr) }
  104. .stab.excl 0 : { *(.stab.excl) }
  105. .stab.exclstr 0 : { *(.stab.exclstr) }
  106. .stab.index 0 : { *(.stab.index) }
  107. .stab.indexstr 0 : { *(.stab.indexstr) }
  108. .comment 0 : { *(.comment) }
  109. /* DWARF debug sections.
  110. * Symbols in the DWARF debugging sections are relative to the beginning
  111. * of the section so we begin them at 0. */
  112. /* DWARF 1 */
  113. .debug 0 : { *(.debug) }
  114. .line 0 : { *(.line) }
  115. /* GNU DWARF 1 extensions */
  116. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  117. .debug_sfnames 0 : { *(.debug_sfnames) }
  118. /* DWARF 1.1 and DWARF 2 */
  119. .debug_aranges 0 : { *(.debug_aranges) }
  120. .debug_pubnames 0 : { *(.debug_pubnames) }
  121. /* DWARF 2 */
  122. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  123. .debug_abbrev 0 : { *(.debug_abbrev) }
  124. .debug_line 0 : { *(.debug_line) }
  125. .debug_frame 0 : { *(.debug_frame) }
  126. .debug_str 0 : { *(.debug_str) }
  127. .debug_loc 0 : { *(.debug_loc) }
  128. .debug_macinfo 0 : { *(.debug_macinfo) }
  129. /* SGI/MIPS DWARF 2 extensions */
  130. .debug_weaknames 0 : { *(.debug_weaknames) }
  131. .debug_funcnames 0 : { *(.debug_funcnames) }
  132. .debug_typenames 0 : { *(.debug_typenames) }
  133. .debug_varnames 0 : { *(.debug_varnames) }
  134. }