link.lds 3.7 KB

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