link.lds 4.3 KB

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