1/*
2 * Copyright (c) 2006-2024, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date           Author       Notes
8 * 2024/01/11     flyingcys    The first version
9 */
10INCLUDE ./cvi_board_memmap.ld
11
12_STACK_SIZE = DEFINED(_STACK_SIZE) ? _STACK_SIZE : 0x20000;
13/* _HEAP_SIZE = DEFINED(_HEAP_SIZE) ? _HEAP_SIZE : 0x1000000; */
14/*_HEAP_SIZE =  0x20000;*/
15
16_EL0_STACK_SIZE = DEFINED(_EL0_STACK_SIZE) ? _EL0_STACK_SIZE : 1024;
17_EL1_STACK_SIZE = DEFINED(_EL1_STACK_SIZE) ? _EL1_STACK_SIZE : 2048;
18_EL2_STACK_SIZE = DEFINED(_EL2_STACK_SIZE) ? _EL2_STACK_SIZE : 1024;
19
20/* Define Memories in the system */
21
22MEMORY
23{
24   psu_ddr_0_MEM_0 : ORIGIN = CVIMMAP_FREERTOS_ADDR , LENGTH = CVIMMAP_FREERTOS_SIZE
25}
26
27/* Specify the default entry point to the program */
28
29/*ENTRY(_vector_table)*/
30ENTRY(_start)
31
32/* Define the sections, and where they are mapped in memory */
33
34SECTIONS
35{
36.text : {
37   KEEP (*(.vectors))
38   *(.boot)
39   *(.text)
40   *(.text.*)
41   *(.gnu.linkonce.t.*)
42   *(.plt)
43   *(.gnu_warning)
44   *(.gcc_execpt_table)
45   *(.glue_7)
46   *(.glue_7t)
47   *(.ARM.extab)
48   *(.gnu.linkonce.armextab.*)
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} > psu_ddr_0_MEM_0
72
73.init (ALIGN(64)) : {
74   KEEP (*(.init))
75} > psu_ddr_0_MEM_0
76
77.fini (ALIGN(64)) : {
78   KEEP (*(.fini))
79} > psu_ddr_0_MEM_0
80
81.interp : {
82   KEEP (*(.interp))
83} > psu_ddr_0_MEM_0
84
85.note-ABI-tag : {
86   KEEP (*(.note-ABI-tag))
87} > psu_ddr_0_MEM_0
88
89.rodata : {
90   . = ALIGN(64);
91   __rodata_start = .;
92   *(.rodata)
93   *(.rodata.*)
94   *(.srodata*)
95   *(.gnu.linkonce.r.*)
96   __rodata_end = .;
97} > psu_ddr_0_MEM_0
98
99.rodata1 : {
100   . = ALIGN(64);
101   __rodata1_start = .;
102   *(.rodata1)
103   *(.rodata1.*)
104   __rodata1_end = .;
105} > psu_ddr_0_MEM_0
106
107.data : {
108   . = ALIGN(64);
109   _data = .;
110   *(.data)
111   *(.data.*)
112   *(.sdata)
113   *(.sdata.*)
114   *(.gnu.linkonce.d.*)
115   *(.jcr)
116   *(.got)
117   *(.got.plt)
118   _edata = .;
119} > psu_ddr_0_MEM_0
120
121.data1 : {
122   . = ALIGN(64);
123   __data1_start = .;
124   *(.data1)
125   *(.data1.*)
126   __data1_end = .;
127} > psu_ddr_0_MEM_0
128
129.got : {
130   *(.got)
131} > psu_ddr_0_MEM_0
132
133.got1 : {
134   *(.got1)
135} > psu_ddr_0_MEM_0
136
137.got2 : {
138   *(.got2)
139} > psu_ddr_0_MEM_0
140
141.ctors : {
142   . = ALIGN(64);
143   __CTOR_LIST__ = .;
144   ___CTORS_LIST___ = .;
145   KEEP (*crtbegin.o(.ctors))
146   KEEP (*(EXCLUDE_FILE(*crtend.o) .ctors))
147   KEEP (*(SORT(.ctors.*)))
148   KEEP (*(.ctors))
149   __CTOR_END__ = .;
150   ___CTORS_END___ = .;
151} > psu_ddr_0_MEM_0
152
153.dtors : {
154   . = ALIGN(64);
155   __DTOR_LIST__ = .;
156   ___DTORS_LIST___ = .;
157   KEEP (*crtbegin.o(.dtors))
158   KEEP (*(EXCLUDE_FILE(*crtend.o) .dtors))
159   KEEP (*(SORT(.dtors.*)))
160   KEEP (*(.dtors))
161   __DTOR_END__ = .;
162   ___DTORS_END___ = .;
163} > psu_ddr_0_MEM_0
164
165.fixup : {
166   __fixup_start = .;
167   *(.fixup)
168   __fixup_end = .;
169} > psu_ddr_0_MEM_0
170
171.eh_frame : {
172   *(.eh_frame)
173} > psu_ddr_0_MEM_0
174
175.eh_framehdr : {
176   __eh_framehdr_start = .;
177   *(.eh_framehdr)
178   __eh_framehdr_end = .;
179} > psu_ddr_0_MEM_0
180
181.gcc_except_table : {
182   *(.gcc_except_table)
183} > psu_ddr_0_MEM_0
184
185.bss (NOLOAD) : {
186   . = ALIGN(64);
187   _bss = .;
188   *(.bss)
189   *(.bss.*)
190   *(.sbss)
191   *(.sbss.*)
192   *(.gnu.linkonce.b.*)
193   *(COMMON)
194   . = ALIGN(64);
195   _ebss = .;
196} > psu_ddr_0_MEM_0
197
198/*_SDA_BASE_ = __sdata_start + ((__sbss_end - __sdata_start) / 2 );*/
199    _data_lma = LOADADDR(.data);
200
201/* Generate Stack and Heap definitions */
202.stack (NOLOAD) : {
203   . = ALIGN(64);
204   _stack_end_end = .;
205   . += _STACK_SIZE;
206   _stack_top = .;
207  __rt_rvstack = .;
208} > psu_ddr_0_MEM_0
209
210.heap (NOLOAD) : {
211   . = ALIGN(64);
212   _heap = .;
213   HeapBase = .;
214   _heap_start = .;
215   *(.heap*)
216   /*. += _HEAP_SIZE;*/
217   /*_heap_size = _HEAP_SIZE; */
218   _heap_end = .;
219   HeapLimit = .;
220} > psu_ddr_0_MEM_0
221
222HeapLimit = ORIGIN(psu_ddr_0_MEM_0) + LENGTH(psu_ddr_0_MEM_0);
223_end = .;
224}
225
226