gd32_rom.ld 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. * linker script for GD32F1xx with GNU ld
  3. *
  4. * Change Logs:
  5. * Date Author Notes
  6. * 2009-10-14 bernard.xiong first implementation
  7. * 2021-01-02 iysheng modify to suite gd32f103c
  8. */
  9. /* Program Entry, set to mark it as "used" and avoid gc */
  10. MEMORY
  11. {
  12. CODE (rx) : ORIGIN = 0x08000000, LENGTH = 256k /* 256KB flash */
  13. DATA (rw) : ORIGIN = 0x20000000, LENGTH = 48k /* 48KB sram */
  14. }
  15. ENTRY(Reset_Handler)
  16. _system_stack_size = 0x200;
  17. SECTIONS
  18. {
  19. .text :
  20. {
  21. . = ALIGN(4);
  22. _stext = .;
  23. KEEP(*(.isr_vector)) /* Startup code */
  24. . = ALIGN(4);
  25. *(.text) /* remaining code */
  26. *(.text.*) /* remaining code */
  27. *(.rodata) /* read-only data (constants) */
  28. *(.rodata*)
  29. *(.glue_7)
  30. *(.glue_7t)
  31. *(.gnu.linkonce.t*)
  32. /* section information for finsh shell */
  33. . = ALIGN(4);
  34. __fsymtab_start = .;
  35. KEEP(*(FSymTab))
  36. __fsymtab_end = .;
  37. . = ALIGN(4);
  38. __vsymtab_start = .;
  39. KEEP(*(VSymTab))
  40. __vsymtab_end = .;
  41. . = ALIGN(4);
  42. /* section information for initial. */
  43. . = ALIGN(4);
  44. __rt_init_start = .;
  45. KEEP(*(SORT(.rti_fn*)))
  46. __rt_init_end = .;
  47. . = ALIGN(4);
  48. . = ALIGN(4);
  49. _etext = .;
  50. } > CODE = 0
  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. . = ALIGN(4);
  70. /* This is used by the startup in order to initialize the .data secion */
  71. _edata = . ;
  72. } >DATA
  73. .stack :
  74. {
  75. . = . + _system_stack_size;
  76. . = ALIGN(4);
  77. _estack = .;
  78. } >DATA
  79. __bss_start = .;
  80. .bss :
  81. {
  82. . = ALIGN(4);
  83. /* This is used by the startup in order to initialize the .bss secion */
  84. _sbss = .;
  85. *(.bss)
  86. *(.bss.*)
  87. *(COMMON)
  88. . = ALIGN(4);
  89. /* This is used by the startup in order to initialize the .bss secion */
  90. _ebss = . ;
  91. *(.bss.init)
  92. } > DATA
  93. __bss_end = .;
  94. _end = .;
  95. /* Stabs debugging sections. */
  96. .stab 0 : { *(.stab) }
  97. .stabstr 0 : { *(.stabstr) }
  98. .stab.excl 0 : { *(.stab.excl) }
  99. .stab.exclstr 0 : { *(.stab.exclstr) }
  100. .stab.index 0 : { *(.stab.index) }
  101. .stab.indexstr 0 : { *(.stab.indexstr) }
  102. .comment 0 : { *(.comment) }
  103. /* DWARF debug sections.
  104. * Symbols in the DWARF debugging sections are relative to the beginning
  105. * of the section so we begin them at 0. */
  106. /* DWARF 1 */
  107. .debug 0 : { *(.debug) }
  108. .line 0 : { *(.line) }
  109. /* GNU DWARF 1 extensions */
  110. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  111. .debug_sfnames 0 : { *(.debug_sfnames) }
  112. /* DWARF 1.1 and DWARF 2 */
  113. .debug_aranges 0 : { *(.debug_aranges) }
  114. .debug_pubnames 0 : { *(.debug_pubnames) }
  115. /* DWARF 2 */
  116. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  117. .debug_abbrev 0 : { *(.debug_abbrev) }
  118. .debug_line 0 : { *(.debug_line) }
  119. .debug_frame 0 : { *(.debug_frame) }
  120. .debug_str 0 : { *(.debug_str) }
  121. .debug_loc 0 : { *(.debug_loc) }
  122. .debug_macinfo 0 : { *(.debug_macinfo) }
  123. /* SGI/MIPS DWARF 2 extensions */
  124. .debug_weaknames 0 : { *(.debug_weaknames) }
  125. .debug_funcnames 0 : { *(.debug_funcnames) }
  126. .debug_typenames 0 : { *(.debug_typenames) }
  127. .debug_varnames 0 : { *(.debug_varnames) }
  128. }