link.lds 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * linker script for APM32F103x8 with GNU ld
  3. */
  4. /* Program Entry, set to mark it as "used" and avoid gc */
  5. MEMORY
  6. {
  7. ROM (rx) : ORIGIN =0x08032000,LENGTH =312k
  8. RAM (rw) : ORIGIN =0x20000000,LENGTH =128k
  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 utest */
  37. . = ALIGN(4);
  38. __rt_utest_tc_tab_start = .;
  39. KEEP(*(UtestTcTab))
  40. __rt_utest_tc_tab_end = .;
  41. /* section information for at server */
  42. . = ALIGN(4);
  43. __rtatcmdtab_start = .;
  44. KEEP(*(RtAtCmdTab))
  45. __rtatcmdtab_end = .;
  46. . = ALIGN(4);
  47. /* section information for initial. */
  48. . = ALIGN(4);
  49. __rt_init_start = .;
  50. KEEP(*(SORT(.rti_fn*)))
  51. __rt_init_end = .;
  52. . = ALIGN(4);
  53. PROVIDE(__ctors_start__ = .);
  54. KEEP (*(SORT(.init_array.*)))
  55. KEEP (*(.init_array))
  56. PROVIDE(__ctors_end__ = .);
  57. . = ALIGN(4);
  58. _etext = .;
  59. } > ROM = 0
  60. /* .ARM.exidx is sorted, so has to go in its own output section. */
  61. __exidx_start = .;
  62. .ARM.exidx :
  63. {
  64. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  65. /* This is used by the startup in order to initialize the .data secion */
  66. _sidata = .;
  67. _start_address_init_data = .;
  68. } > ROM
  69. __exidx_end = .;
  70. /* .data section which is used for initialized data */
  71. .data : AT (_sidata)
  72. {
  73. . = ALIGN(4);
  74. /* This is used by the startup in order to initialize the .data secion */
  75. _sdata = . ;
  76. _start_address_data = .;
  77. *(.data)
  78. *(.data.*)
  79. *(.gnu.linkonce.d*)
  80. PROVIDE(__dtors_start__ = .);
  81. KEEP(*(SORT(.dtors.*)))
  82. KEEP(*(.dtors))
  83. PROVIDE(__dtors_end__ = .);
  84. . = ALIGN(4);
  85. /* This is used by the startup in order to initialize the .data secion */
  86. _edata = . ;
  87. _end_address_data = .;
  88. } >RAM
  89. .stack :
  90. {
  91. . = ALIGN(4);
  92. _sstack = .;
  93. . = . + _system_stack_size;
  94. . = ALIGN(4);
  95. _estack = .;
  96. _end_stack = .;
  97. } >RAM
  98. __bss_start = .;
  99. _start_address_bss = .;
  100. .bss :
  101. {
  102. . = ALIGN(4);
  103. /* This is used by the startup in order to initialize the .bss secion */
  104. _sbss = .;
  105. *(.bss)
  106. *(.bss.*)
  107. *(COMMON)
  108. . = ALIGN(4);
  109. /* This is used by the startup in order to initialize the .bss secion */
  110. _ebss = . ;
  111. *(.bss.init)
  112. } > RAM
  113. __bss_end = .;
  114. _end_address_bss = .;
  115. _end = .;
  116. /* Stabs debugging sections. */
  117. .stab 0 : { *(.stab) }
  118. .stabstr 0 : { *(.stabstr) }
  119. .stab.excl 0 : { *(.stab.excl) }
  120. .stab.exclstr 0 : { *(.stab.exclstr) }
  121. .stab.index 0 : { *(.stab.index) }
  122. .stab.indexstr 0 : { *(.stab.indexstr) }
  123. .comment 0 : { *(.comment) }
  124. /* DWARF debug sections.
  125. * Symbols in the DWARF debugging sections are relative to the beginning
  126. * of the section so we begin them at 0. */
  127. /* DWARF 1 */
  128. .debug 0 : { *(.debug) }
  129. .line 0 : { *(.line) }
  130. /* GNU DWARF 1 extensions */
  131. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  132. .debug_sfnames 0 : { *(.debug_sfnames) }
  133. /* DWARF 1.1 and DWARF 2 */
  134. .debug_aranges 0 : { *(.debug_aranges) }
  135. .debug_pubnames 0 : { *(.debug_pubnames) }
  136. /* DWARF 2 */
  137. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  138. .debug_abbrev 0 : { *(.debug_abbrev) }
  139. .debug_line 0 : { *(.debug_line) }
  140. .debug_frame 0 : { *(.debug_frame) }
  141. .debug_str 0 : { *(.debug_str) }
  142. .debug_loc 0 : { *(.debug_loc) }
  143. .debug_macinfo 0 : { *(.debug_macinfo) }
  144. /* SGI/MIPS DWARF 2 extensions */
  145. .debug_weaknames 0 : { *(.debug_weaknames) }
  146. .debug_funcnames 0 : { *(.debug_funcnames) }
  147. .debug_typenames 0 : { *(.debug_typenames) }
  148. .debug_varnames 0 : { *(.debug_varnames) }
  149. }