9
9
/* Version 4.2.0 */
10
10
/* */
11
11
12
+ STACK_SIZE = 0x400;
13
+ HEAP_SIZE = 0xC00;
14
+
12
15
MEMORY
13
16
{
14
17
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
@@ -53,6 +56,11 @@ __vector_size = 0xDC;
53
56
*/
54
57
ENTRY (Reset_Handler )
55
58
59
+ /* Note : The uVisor expects the text section at a fixed location, as specified
60
+ by the porting process configuration parameter : FLASH_OFFSET. */
61
+ __UVISOR_TEXT_OFFSET = 0x100;
62
+ __UVISOR_TEXT_START = ORIGIN (FLASH) + __UVISOR_TEXT_OFFSET;
63
+
56
64
SECTIONS
57
65
{
58
66
.text :
@@ -62,6 +70,13 @@ SECTIONS
62
70
__Vectors_Size = __Vectors_End - __Vectors;
63
71
__end__ = .;
64
72
73
+ /* uVisor code and data */
74
+ . = __UVISOR_TEXT_OFFSET;
75
+ . = ALIGN (4);
76
+ __uvisor_main_start = .;
77
+ *(.uvisor.main)
78
+ __uvisor_main_end = .;
79
+
65
80
*(.text*)
66
81
67
82
KEEP(*(.init))
@@ -132,10 +147,51 @@ SECTIONS
132
147
} > FLASH
133
148
*/
134
149
135
- __etext = .;
150
+ /* Ensure that the uVisor BSS section is put first in SRAM. */
151
+ /* Note : The uVisor expects this section at a fixed location, as specified
152
+ by the porting process configuration parameter : SRAM_OFFSET. */
153
+ __UVISOR_SRAM_OFFSET = 0x0;
154
+ __UVISOR_BSS_START = ORIGIN (RAM) + __UVISOR_SRAM_OFFSET;
155
+ .uvisor.bss __UVISOR_BSS_START (NOLOAD) :
156
+ {
157
+ . = ALIGN (32);
158
+ __uvisor_bss_start = .;
159
+
160
+ /* uVisor main BSS section */
161
+ . = ALIGN (32);
162
+ __uvisor_bss_main_start = .;
163
+ KEEP(*(.keep.uvisor.bss.main))
164
+ . = ALIGN (32);
165
+ __uvisor_bss_main_end = .;
136
166
137
- .data : AT (__etext)
167
+ /* Secure boxes BSS section */
168
+ . = ALIGN (32);
169
+ __uvisor_bss_boxes_start = .;
170
+ KEEP(*(.keep.uvisor.bss.boxes))
171
+ . = ALIGN (32);
172
+ __uvisor_bss_boxes_end = .;
173
+
174
+ . = ALIGN (32);
175
+ __uvisor_bss_end = .;
176
+ } > RAM
177
+
178
+ /* Heap space for the page allocator */
179
+ .page_heap (NOLOAD) :
138
180
{
181
+ . = ALIGN (32);
182
+ __uvisor_page_start = .;
183
+ KEEP(*(.keep.uvisor.page_heap))
184
+
185
+ . = ALIGN ( (1 << LOG2CEIL(LENGTH (RAM))) / 8);
186
+
187
+ __uvisor_page_end = .;
188
+ } > RAM
189
+
190
+ .data :
191
+ {
192
+ PROVIDE (__etext = LOADADDR (.data)); /* Define a global symbol at end of code, */
193
+ PROVIDE (__DATA_ROM = LOADADDR (.data)); /* Symbol is used by startup for data initialization. */
194
+
139
195
__data_start__ = .;
140
196
*("dma")
141
197
PROVIDE ( __start_vector_table__ = .);
@@ -171,6 +227,51 @@ SECTIONS
171
227
/* All data end */
172
228
__data_end__ = .;
173
229
230
+ } > RAM AT > FLASH
231
+
232
+ /* uVisor configuration section
233
+ * This section must be located after all other flash regions. */
234
+ .uvisor.secure :
235
+ {
236
+ . = ALIGN (32);
237
+ __uvisor_secure_start = .;
238
+
239
+ /* uVisor secure boxes configuration tables */
240
+ . = ALIGN (32);
241
+ __uvisor_cfgtbl_start = .;
242
+ KEEP(*(.keep.uvisor.cfgtbl))
243
+ . = ALIGN (32);
244
+ __uvisor_cfgtbl_end = .;
245
+
246
+ /* Pointers to the uVisor secure boxes configuration tables */
247
+ /* Note : Do not add any further alignment here, as uVisor will need to
248
+ have access to the exact list of pointers. */
249
+ __uvisor_cfgtbl_ptr_start = .;
250
+ KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
251
+ KEEP(*(.keep.uvisor.cfgtbl_ptr))
252
+ __uvisor_cfgtbl_ptr_end = .;
253
+
254
+ /* Pointers to all boxes register gateways. These are grouped here to
255
+ allow discoverability and firmware verification. */
256
+ __uvisor_register_gateway_ptr_start = .;
257
+ KEEP(*(.keep.uvisor.register_gateway_ptr))
258
+ __uvisor_register_gateway_ptr_end = .;
259
+
260
+ . = ALIGN (32);
261
+ __uvisor_secure_end = .;
262
+ } > FLASH
263
+
264
+ /* Uninitialized data section
265
+ * This region is not initialized by the C/C++ library and can be used to
266
+ * store state across soft reboots. */
267
+ .uninitialized (NOLOAD) :
268
+ {
269
+ . = ALIGN (32);
270
+ __uninitialized_start = .;
271
+ *(.uninitialized)
272
+ KEEP(*(.keep.uninitialized))
273
+ . = ALIGN (32);
274
+ __uninitialized_end = .;
174
275
} > RAM
175
276
176
277
.bss :
@@ -183,33 +284,29 @@ SECTIONS
183
284
__bss_end__ = .;
184
285
} > RAM
185
286
186
- .heap (COPY) :
287
+ __StackTop = ORIGIN (RAM) + LENGTH (RAM);
288
+ __stack = __StackTop;
289
+ __StackLimit = __StackTop - STACK_SIZE;
290
+
291
+ .heap (NOLOAD) :
187
292
{
293
+ __uvisor_heap_start = .;
188
294
__HeapBase = .;
189
295
__end__ = .;
190
296
end = __end__;
191
297
_end = __end__;
192
- KEEP(*(.heap*))
193
- __HeapLimit = .;
298
+ . += HEAP_SIZE;
194
299
} > RAM
195
300
196
- /* .stack_dummy section doesn't contains any symbols. It is only
197
- * used for linker to calculate size of stack sections, and assign
198
- * values to stack symbols later */
199
- .stack_dummy (COPY) :
200
- {
201
- KEEP(*(.stack*))
202
- } > RAM
203
-
204
- /* Set stack top to end of RAM, and stack limit move down by
205
- * size of stack_dummy section */
206
- __StackTop = ORIGIN (RAM) + LENGTH (RAM);
207
- __StackLimit = __StackTop - SIZEOF (.stack_dummy);
208
- PROVIDE (__stack = __StackTop);
301
+ __HeapLimit = __StackLimit;
302
+ __uvisor_heap_end = __StackLimit;
209
303
210
- /* Check if data + heap + stack exceeds RAM limit */
211
- ASSERT (__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
304
+ /* Provide physical memory boundaries for uVisor. */
305
+ __uvisor_flash_start = ORIGIN (FLASH);
306
+ __uvisor_flash_end = ORIGIN (FLASH) + LENGTH (FLASH);
307
+ __uvisor_sram_start = ORIGIN (RAM);
308
+ __uvisor_sram_end = ORIGIN (RAM) + LENGTH (RAM);
212
309
213
- /* Check if FLASH usage exceeds FLASH size */
214
- ASSERT ( LENGTH (FLASH) >= (__etext + SIZEOF (.data)) , "FLASH memory overflowed !")
310
+ /* Check if FLASH usage exceeds FLASH size. */
311
+ ASSERT (LENGTH (FLASH) >= __uvisor_secure_end , "FLASH memory overflowed!")
215
312
}
0 commit comments