link_smart.lds 4.2 KB

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