blob: 84579f26ae2d2d34101d24b69970e01d754da2c2 [file] [log] [blame]
Kristofer Jonsson6e9fdc02022-01-14 16:38:17 +01001/*
2 * Copyright (c) 2019-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#define ITCM_START 0x10000000
90#define ITCM_SIZE 0x00008000
91
92#define BRAM_START 0x11000000
93#define BRAM_SIZE 0x00200000
94
95#define DTCM_START 0x30000000
96#define DTCM_SIZE 0x00008000
97
98#define SRAM_START 0x31000000
99#define SRAM_SIZE 0x00200000
100
101#define DDR_START 0x70000000
102#define DDR_SIZE 0x10000000
103
104/* ----------------------------------------------------------------------------
105 Stack seal size definition
106 *----------------------------------------------------------------------------*/
107
108APP_IMAGE ITCM_START ITCM_SIZE
109{
110 ; ITCM 32kB
111 rom_exec ITCM_START ITCM_SIZE
112 {
113 *.o (RESET, +First)
114 *(InRoot$$Sections)
115 ; Make sure reset_handler ends up in root segment, when split across
116 ; ITCM and DTCM
117 startup_ARMCM55.o
118 system_ARMCM55.o
119 target.o
120 }
121
122 ; DTCM 32kB
123 ARM_LIB_STACK DTCM_START EMPTY ALIGN 8 STACK_SIZE {}
124
125 ; Place heap at end of SSE-300 SRAM
126 ARM_LIB_HEAP (SRAM_START + SRAM_SIZE - HEAP_SIZE) EMPTY ALIGN 8 HEAP_SIZE {}
127}
128
129; Place all SRAM, BRAM and DDR execution regions in DDR. We have plenty of DDR
130; and can perform scatter loading from here.
131LOAD_REGION_DDR DDR_START DDR_SIZE
132{
133 ; Place model and its affiliates in DRAM
134 rom_dram DDR_START
135 {
136#if (ETHOSU_MODEL == 1)
137 * (network_model_sec)
138#endif
139 * (input_data_sec)
140 * (expected_output_data_sec)
141 * (output_data_sec)
142 }
143
144#if (ETHOSU_ARENA == 1)
145 ; Place tensor arena in DRAM if we have a fast memory area
146 ARENA +0 UNINIT ALIGN 16
147 {
148 * (.bss.tensor_arena)
149 }
150#endif
151
152 ; 2MB SSE-300 SRAM (3 cycles read latency) from M55/U55
153 SRAM SRAM_START (SRAM_SIZE - HEAP_SIZE)
154 {
155#if (ETHOSU_MODEL == 0)
156 ; Place network model in SRAM
157 * (network_model_sec)
158#endif
159
160#if (ETHOSU_ARENA == 0)
161 ; Place tensor arena in SRAM
162 * (.bss.tensor_arena)
163#endif
164
165 ; Place scratch buffer in SRAM
166 * (.bss.ethosu_scratch)
167 }
168
169 ; MPS3 BRAM
170 BRAM BRAM_START BRAM_SIZE
171 {
172 .ANY1 (+RO +RW +ZI)
173 * (.sram.data)
174 }
175}