@@ -92,6 +92,12 @@ SECTIONS
92
92
/* The program code and other data goes into internal flash */
93
93
.text :
94
94
{
95
+ /* uVisor code and data */
96
+ . = ALIGN (4);
97
+ __uvisor_main_start = .;
98
+ *(.uvisor.main)
99
+ __uvisor_main_end = .;
100
+
95
101
. = ALIGN (4);
96
102
*(.text) /* .text sections (code) */
97
103
*(.text*) /* .text* sections (code) */
@@ -175,9 +181,6 @@ SECTIONS
175
181
PROVIDE_HIDDEN (__fini_array_end = .);
176
182
} > m_text
177
183
178
- __etext = .; /* define a global symbol at end of code */
179
- __DATA_ROM = .; /* Symbol is used by startup for data initialization */
180
-
181
184
.interrupts_ram :
182
185
{
183
186
. = ALIGN (4);
@@ -189,11 +192,44 @@ SECTIONS
189
192
__interrupts_ram_end__ = .; /* Define a global symbol at data end */
190
193
} > m_data
191
194
195
+ /* Ensure that the uVisor BSS section is put first after the relocated
196
+ * interrupt table in SRAM. */
197
+ /* Note : The uVisor expects this section at a fixed location, as specified by
198
+ * the porting process configuration parameter : SRAM_OFFSET. */
199
+ __UVISOR_SRAM_OFFSET = 0x400;
200
+ __UVISOR_BSS_START = ORIGIN (m_data) + __UVISOR_SRAM_OFFSET;
201
+ ASSERT (__interrupts_ram_end__ <= __UVISOR_BSS_START,
202
+ "The ISR relocation region overlaps with the uVisor BSS section.")
203
+ .uvisor.bss (NOLOAD) :
204
+ {
205
+ . = ALIGN (32);
206
+ __uvisor_bss_start = .;
207
+
208
+ /* protected uvisor main bss */
209
+ . = ALIGN (32);
210
+ __uvisor_bss_main_start = .;
211
+ KEEP(*(.keep.uvisor.bss.main))
212
+ . = ALIGN (32);
213
+ __uvisor_bss_main_end = .;
214
+
215
+ /* protected uvisor secure boxes bss */
216
+ . = ALIGN (32);
217
+ __uvisor_bss_boxes_start = .;
218
+ KEEP(*(.keep.uvisor.bss.boxes))
219
+ . = ALIGN (32);
220
+ __uvisor_bss_boxes_end = .;
221
+
222
+ . = ALIGN (32);
223
+ __uvisor_bss_end = .;
224
+ } > m_data
225
+
192
226
__VECTOR_RAM = DEFINED (__ram_vector_table__) ? __VECTOR_RAM__ : ORIGIN (m_interrupts);
193
227
__RAM_VECTOR_TABLE_SIZE_BYTES = DEFINED (__ram_vector_table__) ? (__interrupts_ram_end__ - __interrupts_ram_start__) : 0x0;
194
228
195
- .data : AT(__DATA_ROM)
229
+ .data :
196
230
{
231
+ PROVIDE (__etext = LOADADDR (.data)); /* Define a global symbol at end of code, */
232
+ PROVIDE (__DATA_ROM = LOADADDR (.data)); /* Symbol is used by startup for data initialization. */
197
233
. = ALIGN (4);
198
234
__DATA_RAM = .;
199
235
__data_start__ = .; /* create a global symbol at data start */
@@ -202,12 +238,57 @@ SECTIONS
202
238
KEEP(*(.jcr*))
203
239
. = ALIGN (4);
204
240
__data_end__ = .; /* define a global symbol at data end */
205
- } > m_data_2
241
+ } > m_data_2 AT > m_text
206
242
207
243
__DATA_END = __DATA_ROM + (__data_end__ - __data_start__);
208
244
text_end = ORIGIN (m_text) + LENGTH (m_text);
209
245
ASSERT (__DATA_END <= text_end, "region m_text overflowed with text and data")
210
246
247
+ /* uVisor configuration section
248
+ * This section must be located after all other flash regions. */
249
+ .uvisor.secure :
250
+ {
251
+ . = ALIGN (32);
252
+ __uvisor_secure_start = .;
253
+
254
+ /* uVisor secure boxes configuration tables */
255
+ . = ALIGN (32);
256
+ __uvisor_cfgtbl_start = .;
257
+ KEEP(*(.keep.uvisor.cfgtbl))
258
+ . = ALIGN (32);
259
+ __uvisor_cfgtbl_end = .;
260
+
261
+ /* Pointers to the uVisor secure boxes configuration tables */
262
+ /* Note : Do not add any further alignment here, as uVisor will need to have
263
+ * access to the exact list of pointers. */
264
+ __uvisor_cfgtbl_ptr_start = .;
265
+ KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
266
+ KEEP(*(.keep.uvisor.cfgtbl_ptr))
267
+ __uvisor_cfgtbl_ptr_end = .;
268
+
269
+ /* Pointers to all boxes register gateways. These are grouped here to allow
270
+ * discoverability and firmware verification. */
271
+ __uvisor_register_gateway_ptr_start = .;
272
+ KEEP(*(.keep.uvisor.register_gateway_ptr))
273
+ __uvisor_register_gateway_ptr_end = .;
274
+
275
+ . = ALIGN (32);
276
+ __uvisor_secure_end = .;
277
+ } > m_text
278
+
279
+ /* Uninitialized data section
280
+ * This region is not initialized by the C/C++ library and can be used to
281
+ * store state across soft reboots. */
282
+ .uninitialized (NOLOAD) :
283
+ {
284
+ . = ALIGN (32);
285
+ __uninitialized_start = .;
286
+ *(.uninitialized)
287
+ KEEP(*(.keep.uninitialized))
288
+ . = ALIGN (32);
289
+ __uninitialized_end = .;
290
+ } > m_data_2
291
+
211
292
USB_RAM_GAP = DEFINED (__usb_ram_size__) ? __usb_ram_size__ : 0x800;
212
293
/* Uninitialized data section */
213
294
.bss :
@@ -263,5 +344,11 @@ SECTIONS
263
344
.ARM.attributes 0 : { *(.ARM.attributes) }
264
345
265
346
ASSERT (__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap")
347
+
348
+ /* Provide the physical memory boundaries for uVisor. */
349
+ __uvisor_flash_start = ORIGIN (m_interrupts);
350
+ __uvisor_flash_end = ORIGIN (m_text) + LENGTH (m_text);
351
+ __uvisor_sram_start = ORIGIN (m_data);
352
+ __uvisor_sram_end = ORIGIN (m_data_2) + LENGTH (m_data_2);
266
353
}
267
354
0 commit comments