link.lds 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020/12/12 bernard The first version
  9. */
  10. INCLUDE "link_stacksize.lds"
  11. OUTPUT_ARCH( "riscv" )
  12. /*
  13. * Memory layout:
  14. * 0x80000000 - 0x80200000: SBI
  15. * 0x80200000 - 0x81200000: Kernel
  16. */
  17. MEMORY
  18. {
  19. SRAM : ORIGIN = 0x80200000, LENGTH = 0x1000000
  20. }
  21. ENTRY(_start)
  22. SECTIONS
  23. {
  24. . = 0x80200000 ;
  25. /* __STACKSIZE__ = 4096; */
  26. __text_start = .;
  27. .start :
  28. {
  29. *(.start);
  30. } > SRAM
  31. . = ALIGN(8);
  32. .text :
  33. {
  34. *(.text) /* remaining code */
  35. *(.text.*) /* remaining code */
  36. *(.rodata) /* read-only data (constants) */
  37. *(.rodata*)
  38. *(.glue_7)
  39. *(.glue_7t)
  40. *(.gnu.linkonce.t*)
  41. /* section information for finsh shell */
  42. . = ALIGN(8);
  43. __fsymtab_start = .;
  44. KEEP(*(FSymTab))
  45. __fsymtab_end = .;
  46. . = ALIGN(8);
  47. __vsymtab_start = .;
  48. KEEP(*(VSymTab))
  49. __vsymtab_end = .;
  50. . = ALIGN(8);
  51. /* section information for initial. */
  52. . = ALIGN(8);
  53. __rt_init_start = .;
  54. KEEP(*(SORT(.rti_fn*)))
  55. __rt_init_end = .;
  56. . = ALIGN(8);
  57. __rt_utest_tc_tab_start = .;
  58. KEEP(*(UtestTcTab))
  59. __rt_utest_tc_tab_end = .;
  60. . = ALIGN(8);
  61. _etext = .;
  62. } > SRAM
  63. .eh_frame_hdr :
  64. {
  65. *(.eh_frame_hdr)
  66. *(.eh_frame_entry)
  67. } > SRAM
  68. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } > SRAM
  69. . = ALIGN(8);
  70. __text_end = .;
  71. __text_size = __text_end - __text_start;
  72. .data :
  73. {
  74. *(.data)
  75. *(.data.*)
  76. *(.data1)
  77. *(.data1.*)
  78. . = ALIGN(8);
  79. PROVIDE( __global_pointer$ = . + 0x800 );
  80. *(.sdata)
  81. *(.sdata.*)
  82. } > SRAM
  83. . = ALIGN(8);
  84. .ctors :
  85. {
  86. PROVIDE(__ctors_start__ = .);
  87. KEEP(*(SORT(.init_array.*)))
  88. KEEP(*(.init_array))
  89. PROVIDE(__ctors_end__ = .);
  90. } > SRAM
  91. .dtors :
  92. {
  93. PROVIDE(__dtors_start__ = .);
  94. KEEP(*(SORT(.fini_array.*)))
  95. KEEP(*(.fini_array))
  96. PROVIDE(__dtors_end__ = .);
  97. } > SRAM
  98. /* stack for dual core */
  99. .stack :
  100. {
  101. . = ALIGN(64);
  102. __stack_start__ = .;
  103. . += __STACKSIZE__;
  104. __stack_cpu0 = .;
  105. . += __STACKSIZE__;
  106. __stack_cpu1 = .;
  107. } > SRAM
  108. .sbss :
  109. {
  110. __bss_start = .;
  111. *(.sbss)
  112. *(.sbss.*)
  113. *(.dynsbss)
  114. *(.scommon)
  115. } > SRAM
  116. .bss :
  117. {
  118. *(.bss)
  119. *(.bss.*)
  120. *(.dynbss)
  121. *(COMMON)
  122. __bss_end = .;
  123. } > SRAM
  124. _end = .;
  125. /* Stabs debugging sections. */
  126. .stab 0 : { *(.stab) }
  127. .stabstr 0 : { *(.stabstr) }
  128. .stab.excl 0 : { *(.stab.excl) }
  129. .stab.exclstr 0 : { *(.stab.exclstr) }
  130. .stab.index 0 : { *(.stab.index) }
  131. .stab.indexstr 0 : { *(.stab.indexstr) }
  132. .comment 0 : { *(.comment) }
  133. /* DWARF debug sections.
  134. * Symbols in the DWARF debugging sections are relative to the beginning
  135. * of the section so we begin them at 0. */
  136. /* DWARF 1 */
  137. .debug 0 : { *(.debug) }
  138. .line 0 : { *(.line) }
  139. /* GNU DWARF 1 extensions */
  140. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  141. .debug_sfnames 0 : { *(.debug_sfnames) }
  142. /* DWARF 1.1 and DWARF 2 */
  143. .debug_aranges 0 : { *(.debug_aranges) }
  144. .debug_pubnames 0 : { *(.debug_pubnames) }
  145. /* DWARF 2 */
  146. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  147. .debug_abbrev 0 : { *(.debug_abbrev) }
  148. .debug_line 0 : { *(.debug_line) }
  149. .debug_frame 0 : { *(.debug_frame) }
  150. .debug_str 0 : { *(.debug_str) }
  151. .debug_loc 0 : { *(.debug_loc) }
  152. .debug_macinfo 0 : { *(.debug_macinfo) }
  153. /* SGI/MIPS DWARF 2 extensions */
  154. .debug_weaknames 0 : { *(.debug_weaknames) }
  155. .debug_funcnames 0 : { *(.debug_funcnames) }
  156. .debug_typenames 0 : { *(.debug_typenames) }
  157. .debug_varnames 0 : { *(.debug_varnames) }
  158. }