link.lds 4.3 KB

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