9
9
/* Version 4.2.0 */
10
10
/* */
11
11
12
- STACK_SIZE = 0x400;
13
- HEAP_SIZE = 0xC00;
14
-
15
12
MEMORY
16
13
{
17
14
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
@@ -56,11 +53,6 @@ __vector_size = 0xDC;
56
53
*/
57
54
ENTRY (Reset_Handler )
58
55
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
-
64
56
SECTIONS
65
57
{
66
58
.text :
@@ -70,13 +62,6 @@ SECTIONS
70
62
__Vectors_Size = __Vectors_End - __Vectors;
71
63
__end__ = .;
72
64
73
- /* uVisor code and data */
74
- . = __UVISOR_TEXT_OFFSET;
75
- . = ALIGN (4);
76
- __uvisor_main_start = .;
77
- *(.uvisor.main)
78
- __uvisor_main_end = .;
79
-
80
65
*(.text*)
81
66
82
67
KEEP(*(.init))
@@ -147,51 +132,10 @@ SECTIONS
147
132
} > FLASH
148
133
*/
149
134
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 = .;
135
+ __etext = .;
166
136
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) :
137
+ .data : AT (__etext)
180
138
{
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
-
195
139
__data_start__ = .;
196
140
*("dma")
197
141
PROVIDE ( __start_vector_table__ = .);
@@ -227,51 +171,6 @@ SECTIONS
227
171
/* All data end */
228
172
__data_end__ = .;
229
173
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 = .;
275
174
} > RAM
276
175
277
176
.bss :
@@ -284,29 +183,33 @@ SECTIONS
284
183
__bss_end__ = .;
285
184
} > RAM
286
185
287
- __StackTop = ORIGIN (RAM) + LENGTH (RAM);
288
- __stack = __StackTop;
289
- __StackLimit = __StackTop - STACK_SIZE;
290
-
291
- .heap (NOLOAD) :
186
+ .heap (COPY) :
292
187
{
293
- __uvisor_heap_start = .;
294
188
__HeapBase = .;
295
189
__end__ = .;
296
190
end = __end__;
297
191
_end = __end__;
298
- . += HEAP_SIZE;
192
+ KEEP(*(.heap*))
193
+ __HeapLimit = .;
299
194
} > RAM
300
195
301
- __HeapLimit = __StackLimit;
302
- __uvisor_heap_end = __StackLimit;
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);
303
209
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);
210
+ /* Check if data + heap + stack exceeds RAM limit */
211
+ ASSERT (__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
309
212
310
- /* Check if FLASH usage exceeds FLASH size. */
311
- ASSERT (LENGTH (FLASH) >= __uvisor_secure_end , "FLASH memory overflowed!")
213
+ /* Check if FLASH usage exceeds FLASH size */
214
+ ASSERT ( LENGTH (FLASH) >= (__etext + SIZEOF (.data)) , "FLASH memory overflowed !")
312
215
}
0 commit comments