link.lds 4.3 KB

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