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