link.lds 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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. * 0x10200000 - 0x10201000: Bootloader
  15. * 0x10201000 - 0x10A00000: Kernel
  16. * 0x10A00000 - 0x11200000: Heap
  17. */
  18. MEMORY
  19. {
  20. SRAM : ORIGIN = 0x40400000, LENGTH = 60M
  21. }
  22. ENTRY(_start)
  23. SECTIONS
  24. {
  25. . = 0x40400000 ;
  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. . = ALIGN(8);
  110. .osdebug :
  111. {
  112. _osdebug_start = .;
  113. . += 87K;
  114. _osdebug_end = .;
  115. } > SRAM
  116. . = ALIGN(8);
  117. .sbss :
  118. {
  119. __bss_start = .;
  120. *(.sbss)
  121. *(.sbss.*)
  122. *(.dynsbss)
  123. *(.scommon)
  124. } > SRAM
  125. .bss :
  126. {
  127. *(.bss)
  128. *(.bss.*)
  129. *(.dynbss)
  130. *(COMMON)
  131. __bss_end = .;
  132. } > SRAM
  133. _end = .;
  134. /* Stabs debugging sections. */
  135. .stab 0 : { *(.stab) }
  136. .stabstr 0 : { *(.stabstr) }
  137. .stab.excl 0 : { *(.stab.excl) }
  138. .stab.exclstr 0 : { *(.stab.exclstr) }
  139. .stab.index 0 : { *(.stab.index) }
  140. .stab.indexstr 0 : { *(.stab.indexstr) }
  141. .comment 0 : { *(.comment) }
  142. /* DWARF debug sections.
  143. * Symbols in the DWARF debugging sections are relative to the beginning
  144. * of the section so we begin them at 0. */
  145. /* DWARF 1 */
  146. .debug 0 : { *(.debug) }
  147. .line 0 : { *(.line) }
  148. /* GNU DWARF 1 extensions */
  149. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  150. .debug_sfnames 0 : { *(.debug_sfnames) }
  151. /* DWARF 1.1 and DWARF 2 */
  152. .debug_aranges 0 : { *(.debug_aranges) }
  153. .debug_pubnames 0 : { *(.debug_pubnames) }
  154. /* DWARF 2 */
  155. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  156. .debug_abbrev 0 : { *(.debug_abbrev) }
  157. .debug_line 0 : { *(.debug_line) }
  158. .debug_frame 0 : { *(.debug_frame) }
  159. .debug_str 0 : { *(.debug_str) }
  160. .debug_loc 0 : { *(.debug_loc) }
  161. .debug_macinfo 0 : { *(.debug_macinfo) }
  162. /* SGI/MIPS DWARF 2 extensions */
  163. .debug_weaknames 0 : { *(.debug_weaknames) }
  164. .debug_funcnames 0 : { *(.debug_funcnames) }
  165. .debug_typenames 0 : { *(.debug_typenames) }
  166. .debug_varnames 0 : { *(.debug_varnames) }
  167. }