1+ /*
2+ * Copyright (C) 2017-2024 Alibaba Group Holding Limited
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ *
6+ * Licensed under the Apache License, Version 2.0 (the "License");
7+ * you may not use this file except in compliance with the License.
8+ * You may obtain a copy of the License at
9+ *
10+ * http://www.apache.org/licenses/LICENSE-2.0
11+ *
12+ * Unless required by applicable law or agreed to in writing, software
13+ * distributed under the License is distributed on an "AS IS" BASIS,
14+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+ * See the License for the specific language governing permissions and
16+ * limitations under the License.
17+ */
18+
19+ /* *****************************************************************************
20+ * @file gcc_csky.ld
21+ * @brief csky linker file
22+ * @version V1.0
23+ * @date 02. June 2017
24+ ******************************************************************************/
25+ MEMORY
26+ {
27+ ISRAM : ORIGIN = 0x00000000 , LENGTH = 0x20000 /* ISRAM 128KB*/
28+ DSRAM : ORIGIN = 0x20000000 , LENGTH = 0x80000 /* DSRAM 512KB*/
29+ SRAM : ORIGIN = 0x60000000 , LENGTH = 0x20000 /* SRAM 128KB, no cacheable*/
30+ }
31+
32+ __min_heap_size = 0x200 ;
33+ PROVIDE (__ram_end = 0x20080000 );
34+ PROVIDE (__heap_end = __ram_end);
35+
36+ REGION_ALIAS (" REGION_TEXT" , ISRAM);
37+ REGION_ALIAS (" REGION_RODATA" , ISRAM);
38+ REGION_ALIAS (" REGION_DATA" , DSRAM);
39+ REGION_ALIAS (" REGION_BSS" , DSRAM);
40+
41+ ENTRY (Reset_Handler)
42+ SECTIONS
43+ {
44+ .text : {
45+ . = ALIGN (0x4 ) ;
46+ __stext = . ;
47+ KEEP (*startup.o (*.text ))
48+ KEEP (*startup.o (*.vectors ))
49+ KEEP (*vectors.o (*.text ))
50+ KEEP (*(.text .entry ))
51+ *(.text *)
52+ *(.gnu .warning )
53+ *(.stub )
54+ *(.gnu .linkonce .t *)
55+ *(.glue_7t )
56+ *(.glue_7 )
57+ *(.jcr )
58+ KEEP (*(.init ))
59+ KEEP (*(.fini ))
60+ . = ALIGN (0x4 ) ;
61+ PROVIDE (__ctbp = .);
62+ *(.call_table_data )
63+ *(.call_table_text )
64+ . = ALIGN (0x10 ) ;
65+ __etext = . ;
66+ } > REGION_TEXT
67+ .eh_frame_hdr : {
68+ *(.eh_frame_hdr )
69+ } > REGION_TEXT
70+ .eh_frame : ONLY_IF_RO {
71+ KEEP (*(.eh_frame ))
72+ } > REGION_TEXT
73+ .rodata : {
74+ . = ALIGN (0x4 ) ;
75+ __srodata = .;
76+ *(.rdata )
77+ *(.rdata *)
78+ *(.rdata1 )
79+ *(.rdata .*)
80+ *(.rodata *)
81+ *(.srodata *)
82+ . = ALIGN (0x4 ) ;
83+ __init_array_start = .;
84+ __ctors_start__ = .;
85+ KEEP (*(SORT (.init_array .*)))
86+ KEEP (*(.init_array ))
87+ __init_array_end = .;
88+ __ctors_end__ = .;
89+
90+ __fini_array_start = .;
91+ __dtors_start__ = .;
92+ KEEP (*(SORT (.fini_array .*)))
93+ KEEP (*(.fini_array ))
94+ __fini_array_end = .;
95+ __dtors_end__ = .;
96+ . = ALIGN (0x4 ) ;
97+
98+ __ctor_start__ = .;
99+ KEEP (*(SORT (.ctors .*)))
100+ KEEP (*(.ctors ))
101+ __ctor_end__ = .;
102+ KEEP (*(SORT (.dtors .*)))
103+ KEEP (*(.dtors ))
104+ __dtor_end__ = .;
105+ . = ALIGN (0x4 ) ;
106+ /* ****************************************/
107+ /* section information for finsh shell */
108+ . = ALIGN (0x4 );
109+ __fsymtab_start = .;
110+ KEEP (*(FSymTab))
111+ __fsymtab_end = .;
112+ . = ALIGN (0x4 );
113+ __vsymtab_start = .;
114+ KEEP (*(VSymTab))
115+ __vsymtab_end = .;
116+ . = ALIGN (0x4 );
117+
118+ /* section information for initial. */
119+ __rt_init_start = .;
120+ KEEP (*(SORT (.rti_fn *)))
121+ __rt_init_end = .;
122+ . = ALIGN (0x4 ) ;
123+
124+ /* section information for at utest */
125+ __rt_utest_tc_tab_start = .;
126+ KEEP (*(UtestTcTab))
127+ __rt_utest_tc_tab_end = .;
128+ . = ALIGN (0x4 );
129+
130+ /* section information for at server */
131+ . = ALIGN (0x4 );
132+ __rtatcmdtab_start = .;
133+ KEEP (*(RtAtCmdTab))
134+ __rtatcmdtab_end = .;
135+ . = ALIGN (0x4 );
136+
137+ /* section information for modules */
138+ . = ALIGN (0x4 );
139+ __rtmsymtab_start = .;
140+ KEEP (*(RTMSymTab))
141+ __rtmsymtab_end = .;
142+
143+ /* section information for uPRC */
144+ . = ALIGN (0x4 );
145+ __uRPCSvcTab_start = .;
146+ KEEP (*(uRPCSvcTab))
147+ __uRPCSvcTab_end = .;
148+
149+ /* section information for var export */
150+ . = ALIGN (0x4 );
151+ __ve_table_start = .;
152+ KEEP (*(SORT (*.VarExpTab .*)))
153+ __ve_table_end = .;
154+ /* ****************************************/
155+ /* ************* added drivers **************/
156+ _cli_region_begin = .;
157+ KEEP (*(CliRegion))
158+ . = ALIGN (0x4 );
159+ _cli_region_end = .;
160+
161+ __core_driver_start__ = .;
162+ KEEP (*(.core_driver_entry ))
163+ . = ALIGN (0x4 );
164+ __core_driver_end__ = .;
165+
166+ __bus_driver_start__ = .;
167+ KEEP (*(*.bus_driver_entry ))
168+ __bus_driver_end__ = .;
169+
170+ __early_driver_start__ = .;
171+ KEEP (*(*.early_driver_entry ))
172+ __early_driver_end__ = .;
173+
174+ __vfs_driver_start__ = .;
175+ KEEP (*(*.vfs_driver_entry ))
176+ __vfs_driver_end__ = .;
177+
178+ __level0_driver_start__ = .;
179+ KEEP (*(*.level0_driver_entry ))
180+ __level0_driver_end__ = .;
181+
182+ __level1_driver_start__ = .;
183+ KEEP (*(*.level1_driver_entry ))
184+ __level1_driver_end__ = .;
185+
186+ __level2_driver_start__ = .;
187+ KEEP (*(*.level2_driver_entry ))
188+ __level2_driver_end__ = .;
189+
190+ __level3_driver_start__ = .;
191+ KEEP (*(*.level3_driver_entry ))
192+ __level3_driver_end__ = .;
193+
194+ __post_driver_start__ = .;
195+ KEEP (*(*.post_driver_entry ))
196+ __post_driver_end__ = .;
197+ /* ************* end of drivers *********/
198+ . = ALIGN (0x40 ) ;
199+ __jvt_base$ = .;
200+ KEEP (*(*.riscv .jvt ))
201+ . = ALIGN (0x8 ) ;
202+ __erodata = .;
203+ __rodata_end__ = .;
204+ } > REGION_RODATA
205+ .data : {
206+ . = ALIGN (0x4 ) ;
207+ __sdata = . ;
208+ __data_start__ = . ;
209+ data_start = . ;
210+ *(.got .plt )
211+ *(.got )
212+ *(.gnu .linkonce .r *)
213+ *(.data *)
214+ *(.gnu .linkonce .d *)
215+ *(.gcc_except_table *)
216+ __start_init_call = .;
217+ *(.initcall .init )
218+ __stop_init_call = .;
219+ __start_cmd = .;
220+ *(.bootloaddata .cmd )
221+ . = ALIGN (0x4 ) ;
222+ __stop_cmd = .;
223+ __global_pointer$ = .;
224+ *(.sdata )
225+ *(.sdata .*)
226+ *(.sdata2 .*)
227+ *(.gnu .linkonce .s .*)
228+ *(__libc_atexit)
229+ *(__libc_subinit)
230+ *(__libc_subfreeres)
231+ *(.note .ABI -tag)
232+ . = ALIGN (0x4 ) ;
233+ __edata = .;
234+ __data_end__ = .;
235+ } > REGION_DATA AT > REGION_RODATA
236+ ._ram_code : {
237+ . = ALIGN (0x4 ) ;
238+ __ram_code_start__ = .;
239+ *(.ram .code *)
240+ . = ALIGN (0x4 ) ;
241+ __ram_code_end__ = .;
242+ } > REGION_DATA AT > REGION_RODATA
243+ .bss : {
244+ . = ALIGN (0x4 ) ;
245+ __sbss = ALIGN (0x4 ) ;
246+ __bss_start__ = . ;
247+ *(.dynsbss )
248+ *(.sbss )
249+ *(.sbss .*)
250+ *(.scommon )
251+ *(.dynbss )
252+ *(.bss *)
253+ *(COMMON)
254+ . = ALIGN (0x4 ) ;
255+ __ebss = . ;
256+ __bss_end__ = .;
257+ __end = . ;
258+ end = . ;
259+ } > REGION_BSS AT > REGION_BSS
260+ ._user_heap (NOLOAD) : {
261+ . = ALIGN (0x4 ) ;
262+ *(.stack *)
263+ . = ALIGN (0x4 ) ;
264+ __heap_start = .;
265+ . += __min_heap_size;
266+ . = ALIGN (0x4 ) ;
267+ } > REGION_BSS AT > REGION_BSS
268+ }
0 commit comments