link.lds 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. /*
  2. * Copyright (c) 2006-2020, 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. /*
  13. * Memory layout:
  14. * See mem_layout.h
  15. */
  16. MEMORY
  17. {
  18. SRAM : ORIGIN = KERNEL_VADDR_START + MEM_OPENSBI_SIZE, LENGTH = MEM_KERNEL_SIZE
  19. }
  20. ENTRY(_start)
  21. SECTIONS
  22. {
  23. . = ORIGIN(SRAM) ;
  24. /* __STACKSIZE__ = 4096; */
  25. __sram_base = ORIGIN(SRAM);
  26. __sram_size = LENGTH(SRAM);
  27. __sram_end = __sram_base + __sram_size;
  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. /* stack for dual core */
  86. .stack :
  87. {
  88. . = ALIGN(64);
  89. __stack_start__ = .;
  90. . += __STACKSIZE__;
  91. __stack_cpu0 = .;
  92. . += __STACKSIZE__;
  93. __stack_cpu1 = .;
  94. } > SRAM
  95. . = ALIGN(8);
  96. .osdebug :
  97. {
  98. _osdebug_start = .;
  99. . += 87K;
  100. _osdebug_end = .;
  101. } > SRAM
  102. . = ALIGN(8);
  103. .sbss :
  104. {
  105. __bss_start = .;
  106. *(.sbss)
  107. *(.sbss.*)
  108. *(.dynsbss)
  109. *(.scommon)
  110. } > SRAM
  111. .bss :
  112. {
  113. *(.bss)
  114. *(.bss.*)
  115. *(.dynbss)
  116. *(COMMON)
  117. __bss_end = .;
  118. } > SRAM
  119. _end = .;
  120. /* Stabs debugging sections. */
  121. .stab 0 : { *(.stab) }
  122. .stabstr 0 : { *(.stabstr) }
  123. .stab.excl 0 : { *(.stab.excl) }
  124. .stab.exclstr 0 : { *(.stab.exclstr) }
  125. .stab.index 0 : { *(.stab.index) }
  126. .stab.indexstr 0 : { *(.stab.indexstr) }
  127. .comment 0 : { *(.comment) }
  128. /* DWARF debug sections.
  129. * Symbols in the DWARF debugging sections are relative to the beginning
  130. * of the section so we begin them at 0. */
  131. /* DWARF 1 */
  132. .debug 0 : { *(.debug) }
  133. .line 0 : { *(.line) }
  134. /* GNU DWARF 1 extensions */
  135. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  136. .debug_sfnames 0 : { *(.debug_sfnames) }
  137. /* DWARF 1.1 and DWARF 2 */
  138. .debug_aranges 0 : { *(.debug_aranges) }
  139. .debug_pubnames 0 : { *(.debug_pubnames) }
  140. /* DWARF 2 */
  141. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  142. .debug_abbrev 0 : { *(.debug_abbrev) }
  143. .debug_line 0 : { *(.debug_line) }
  144. .debug_frame 0 : { *(.debug_frame) }
  145. .debug_str 0 : { *(.debug_str) }
  146. .debug_loc 0 : { *(.debug_loc) }
  147. .debug_macinfo 0 : { *(.debug_macinfo) }
  148. /* SGI/MIPS DWARF 2 extensions */
  149. .debug_weaknames 0 : { *(.debug_weaknames) }
  150. .debug_funcnames 0 : { *(.debug_funcnames) }
  151. .debug_typenames 0 : { *(.debug_typenames) }
  152. .debug_varnames 0 : { *(.debug_varnames) }
  153. }