blob: 3880da004d7058c4992dc1a0d5769e7dee0aade7 [file] [log] [blame]
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +01001/*
2 * Copyright (c) 2009-2022 Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Licensed under the Apache License, Version 2.0 (the License); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * 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, WITHOUT
14 * 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 * Corstone-Polaris is the next generation Corstone-300 where the CPU
21 * has been upgraded to Cortex Olympus.
22 *
23 * This is a simplified picture of the Corstone-300 memory system.
24 * Please refer to the Corstone SSE-300 Technical Reference Manual for
25 * further information.
26 *
27 * https://developer.arm.com/ip-products/subsystem/corstone/corstone-300
28 *
29 * +---------------+ +---------------+ +------+
30 * | Ethos-U55 | | Cortex-M55 +--+ ITCM |
31 * | | | | +------+
32 * | | | |
33 * | | | | +------+
34 * | M1 M0 | | +--+ DTCM |
35 * +---+-------+---+ +-------+-------+ +------+
36 * | | |
37 * | +---+---------------+-----+
38 * | | AMBA AXI NIC-400-Lite |
39 * | +---+-----------------+---+
40 * | | |
41 * +---+-------+------------+ +--+-------+
42 * | AMBA AXI NIC-400 | | SSE-300 |
43 * +---+--------+--------+--+ | SRAM |
44 * | | | +----------+
45 * +---+---+ +--+---+ +--+--+
46 * | Flash | | BRAM | | DDR |
47 * +-------+ +------+ +-----+
48 *
49 * +-----------------------+-------------+-------------+----+--------------------------------------+
50 * | Memory region name | Base addr | Size |IDAU| MCC load address + remarks |
51 * +-----------------------+-------------+-------------+----+--------------------------------------+
52 * | ITCM | 0x0000_0000 | 0x0000_8000 | NS | 0x0000_0000; 32 kiB |
53 * | ITCM | 0x1000_0000 | 0x0000_8000 | S | Secure alias for NS ITCM |
54 * | FPGA Data SRAM; BRAM | 0x0100_0000 | 0x0020_0000 | NS | 0x0100_0000; 2 MiB |
55 * | FPGA data SRAM; BRAM | 0x1100_0000 | 0x0020_0000 | S | Secure alias for NS BRAM |
56 * | DTCM | 0x2000_0000 | 0x0000_8000 | NS | 32 kiB; |
57 * | DTCM | 0x3000_0000 | 0x0000_8000 | S | Secure alias for NS DTCM |
58 * | SSE-300 internal SRAM | 0x2100_0000 | 0x0020_0000 | NS | 1 bank of 2 MiB; 3cc latency) |
59 * | SSE-300 internal SRAM | 0x3100_0000 | 0x0020_0000 | S | Secure alias for NS internal SRAM |
60 * | DDR | 0x6000_0000 | 0x1000_0000 | NS | 0x0800_0000; 256 MiB bank |
61 * | DDR | 0x7000_0000 | 0x1000_0000 | S | 0x0C00_0000; 256 MiB bank |
62 * +-----------------------+-------------+-------------+----+--------------------------------------+
63 *
64 * Note: Ethos-U55 can access BRAM, internal SRAM and the DDR sections => activation buffers and
65 * the model should only be placed in those regions.
66 *
67 * Note: Alias regions means that secure and non-secure addresses are mapped to the same physical
68 * memory banks.
69 */
70
71/* default value - '1', for DRAM */
72#ifndef ETHOSU_MODEL
73#define ETHOSU_MODEL 1
74#endif
75
76/* default value - '1', for DRAM */
77#ifndef ETHOSU_ARENA
78#define ETHOSU_ARENA 1
79#endif
80
81#ifndef STACK_SIZE
82#define STACK_SIZE 0x8000
83#endif
84
85#ifndef HEAP_SIZE
86#define HEAP_SIZE 0x10000
87#endif
88
89__STACK_SIZE = STACK_SIZE;
90__HEAP_SIZE = HEAP_SIZE;
91
92MEMORY
93{
94 ITCM (rx) : ORIGIN = 0x10000000, LENGTH = 0x00008000
95 BRAM (rw) : ORIGIN = 0x11000000, LENGTH = 0x00200000
96 DTCM (rw) : ORIGIN = 0x30000000, LENGTH = 0x00008000
97 SRAM (rw) : ORIGIN = 0x31000000, LENGTH = 0x00200000
98 QSPI (rw) : ORIGIN = 0x38000000, LENGTH = 0x00800000
99 DDR (rwx) : ORIGIN = 0x70000000, LENGTH = 0x10000000
100}
101
102PHDRS
103{
104 rom_exec PT_LOAD;
105 rom_dram PT_LOAD;
106 null PT_NULL;
107}
108
109/* Linker script to place sections and symbol values. Should be used together
110 * with other linker script that defines memory regions ITCM and RAM.
111 * It references following symbols, which must be defined in code:
112 * Reset_Handler : Entry of reset handler
113 *
114 * It defines following symbols, which code can use without definition:
115 * __exidx_start
116 * __exidx_end
117 * __copy_table_start__
118 * __copy_table_end__
119 * __zero_table_start__
120 * __zero_table_end__
121 * __etext
122 * __data_start__
123 * __preinit_array_start
124 * __preinit_array_end
125 * __init_array_start
126 * __init_array_end
127 * __fini_array_start
128 * __fini_array_end
129 * __data_end__
130 * __bss_start__
131 * __bss_end__
132 * __end__
133 * end
134 * __HeapLimit
135 * __StackLimit
136 * __StackTop
137 * __stack
138 */
139
140ENTRY(Reset_Handler)
141
142SECTIONS
143{
144 .text :
145 {
146 KEEP(*(.vectors))
147 *crt* (.text*)
148 *startup_ARMCM55.c.obj (.text*)
149 *system_ARMCM55.c.obj (.text*)
150 *target.cpp.obj (.text*)
151
152 KEEP(*(.init))
153 KEEP(*(.fini))
154
155 /* .ctors */
156 *crtbegin.o(.ctors)
157 *crtbegin?.o(.ctors)
158 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
159 *(SORT(.ctors.*))
160 *(.ctors)
161
162 /* .dtors */
163 *crtbegin.o(.dtors)
164 *crtbegin?.o(.dtors)
165 *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
166 *(SORT(.dtors.*))
167 *(.dtors)
168
169 KEEP(*(.eh_frame*))
170 } > ITCM :rom_exec
171
172 /*
173 * SG veneers:
174 * All SG veneers are placed in the special output section .gnu.sgstubs. Its start address
175 * must be set, either with the command line option '--section-start' or in a linker script,
176 * to indicate where to place these veneers in memory.
177 */
178/*
179 .gnu.sgstubs :
180 {
181 . = ALIGN(32);
182 } > ITCM :rom_exec
183*/
184 .ARM.extab :
185 {
186 *(.ARM.extab* .gnu.linkonce.armextab.*)
187 } > ITCM :rom_exec
188
189 .ARM.exidx :
190 {
191 __exidx_start = .;
192 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
193 __exidx_end = .;
194 } > ITCM :rom_exec
195
196 .copy.table :
197 {
198 . = ALIGN(4);
199 __copy_table_start__ = .;
200
201 LONG (LOADADDR(.sram))
202 LONG (ADDR(.sram))
Davide Grohmann8b53aad2022-05-05 17:15:19 +0200203 LONG (SIZEOF(.sram) / 4)
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +0100204
205 LONG (LOADADDR(.bram))
206 LONG (ADDR(.bram))
Davide Grohmann8b53aad2022-05-05 17:15:19 +0200207 LONG (SIZEOF(.bram) / 4)
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +0100208
209 __copy_table_end__ = .;
210 } > ITCM :rom_exec
211
212 .zero.table :
213 {
214 . = ALIGN(4);
215 __zero_table_start__ = .;
216
217 LONG (ADDR(.bss))
Davide Grohmann8b53aad2022-05-05 17:15:19 +0200218 LONG (SIZEOF(.bss) / 4)
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +0100219
220 LONG (ADDR(.sram.bss))
Davide Grohmann8b53aad2022-05-05 17:15:19 +0200221 LONG (SIZEOF(.sram.bss) / 4)
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +0100222
223 __zero_table_end__ = .;
224 } > ITCM :rom_exec
225
226 .sram : AT(__etext)
227 {
228 *(.text*)
229 *(.ARM.exidx* .gnu.linkonce.armexidx.*)
230
231 *(vtable)
232 *(.data)
233 *(.data.*)
234 *(.rodata*)
235
236#if (ETHOSU_MODEL == 0)
237 . = ALIGN(16);
238 *(network_model_sec)
239#endif
240
241 . = ALIGN(4);
242 /* preinit data */
243 PROVIDE_HIDDEN (__preinit_array_start = .);
244 KEEP(*(.preinit_array))
245 PROVIDE_HIDDEN (__preinit_array_end = .);
246
247 . = ALIGN(4);
248 /* init data */
249 PROVIDE_HIDDEN (__init_array_start = .);
250 KEEP(*(SORT(.init_array.*)))
251 KEEP(*(.init_array))
252 PROVIDE_HIDDEN (__init_array_end = .);
253
254 . = ALIGN(4);
255 /* finit data */
256 PROVIDE_HIDDEN (__fini_array_start = .);
257 KEEP(*(SORT(.fini_array.*)))
258 KEEP(*(.fini_array))
259 PROVIDE_HIDDEN (__fini_array_end = .);
260
261 KEEP(*(.jcr*))
262 } > SRAM :rom_dram
263
264 .bram : AT(LOADADDR(.sram) + SIZEOF(.sram))
265 {
266 . = ALIGN(16);
267 *(.sram.data)
268 } > BRAM :rom_dram
269
270 .sram.bss :
271 {
272#if (ETHOSU_ARENA == 0)
273 . = ALIGN(16);
274 *(.bss.tensor_arena)
275#endif
276
277 . = ALIGN(16);
278 *(.bss.ethosu_scratch);
279 } > SRAM :null
280
281 .ddr :
282 {
283#if (ETHOSU_ARENA == 1)
284 . = ALIGN(16);
285 *(.bss.tensor_arena)
286#endif
287
288#if (ETHOSU_MODEL == 1)
289 . = ALIGN(16);
290 *(network_model_sec)
291#endif
292
293 . = ALIGN(4);
294 *(input_data_sec)
295 *(expected_output_data_sec)
296 *(output_data_sec)
297
298 *(ethosu_core_in_queue ethosu_core_out_queue)
299
300 /* Place data for scatter loading here */
301 __etext = .;
302 } > DDR :rom_dram
303
304 .bss :
305 {
306 . = ALIGN(4);
307 __bss_start__ = .;
308 *(.bss)
309 *(.bss.*)
310 *(COMMON)
311 . = ALIGN(4);
312 __bss_end__ = .;
313 } > SRAM :null
314
315 .heap (COPY) :
316 {
317 . = ALIGN(8);
318 __end__ = .;
319 PROVIDE(end = .);
320 . = . + __HEAP_SIZE;
321 . = ALIGN(8);
322 __HeapLimit = .;
323 } > SRAM :null
324
325 .stack (ORIGIN(DTCM) + LENGTH(DTCM) - __STACK_SIZE) (COPY) :
326 {
327 . = ALIGN(8);
328 __StackLimit = .;
329 . = . + __STACK_SIZE;
330 . = ALIGN(8);
331 __StackTop = .;
332 } > DTCM :null
333 PROVIDE(__stack = __StackTop);
334
335 /* Check if data + heap + stack exceeds DTCM limit */
336 ASSERT(LENGTH(DTCM) >= __STACK_SIZE, "region DTCM overflowed with stack")
337}