link.lds 4.1 KB

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