link_smart.lds 4.6 KB

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