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