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