mirror of https://github.com/ARMmbed/mbed-os.git
EFM32: Add support for uVisor
parent
b01b7c5019
commit
f818aa17a2
|
@ -9,6 +9,9 @@
|
||||||
/* Version 4.2.0 */
|
/* Version 4.2.0 */
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
STACK_SIZE = 0x400;
|
||||||
|
HEAP_SIZE = 0xC00;
|
||||||
|
|
||||||
MEMORY
|
MEMORY
|
||||||
{
|
{
|
||||||
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
|
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
|
||||||
|
@ -53,6 +56,11 @@ __vector_size = 0xDC;
|
||||||
*/
|
*/
|
||||||
ENTRY(Reset_Handler)
|
ENTRY(Reset_Handler)
|
||||||
|
|
||||||
|
/* Note: The uVisor expects the text section at a fixed location, as specified
|
||||||
|
by the porting process configuration parameter: FLASH_OFFSET. */
|
||||||
|
__UVISOR_TEXT_OFFSET = 0x100;
|
||||||
|
__UVISOR_TEXT_START = ORIGIN(FLASH) + __UVISOR_TEXT_OFFSET;
|
||||||
|
|
||||||
SECTIONS
|
SECTIONS
|
||||||
{
|
{
|
||||||
.text :
|
.text :
|
||||||
|
@ -62,6 +70,13 @@ SECTIONS
|
||||||
__Vectors_Size = __Vectors_End - __Vectors;
|
__Vectors_Size = __Vectors_End - __Vectors;
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
|
|
||||||
|
/* uVisor code and data */
|
||||||
|
. = __UVISOR_TEXT_OFFSET;
|
||||||
|
. = ALIGN(4);
|
||||||
|
__uvisor_main_start = .;
|
||||||
|
*(.uvisor.main)
|
||||||
|
__uvisor_main_end = .;
|
||||||
|
|
||||||
*(.text*)
|
*(.text*)
|
||||||
|
|
||||||
KEEP(*(.init))
|
KEEP(*(.init))
|
||||||
|
@ -132,10 +147,51 @@ SECTIONS
|
||||||
} > FLASH
|
} > FLASH
|
||||||
*/
|
*/
|
||||||
|
|
||||||
__etext = .;
|
/* Ensure that the uVisor BSS section is put first in SRAM. */
|
||||||
|
/* Note: The uVisor expects this section at a fixed location, as specified
|
||||||
.data : AT (__etext)
|
by the porting process configuration parameter: SRAM_OFFSET. */
|
||||||
|
__UVISOR_SRAM_OFFSET = 0x0;
|
||||||
|
__UVISOR_BSS_START = ORIGIN(RAM) + __UVISOR_SRAM_OFFSET;
|
||||||
|
.uvisor.bss __UVISOR_BSS_START (NOLOAD):
|
||||||
{
|
{
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_start = .;
|
||||||
|
|
||||||
|
/* uVisor main BSS section */
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_main_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.bss.main))
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_main_end = .;
|
||||||
|
|
||||||
|
/* Secure boxes BSS section */
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_boxes_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.bss.boxes))
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_boxes_end = .;
|
||||||
|
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_bss_end = .;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
/* Heap space for the page allocator */
|
||||||
|
.page_heap (NOLOAD) :
|
||||||
|
{
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_page_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.page_heap))
|
||||||
|
|
||||||
|
. = ALIGN( (1 << LOG2CEIL(LENGTH(RAM))) / 8);
|
||||||
|
|
||||||
|
__uvisor_page_end = .;
|
||||||
|
} > RAM
|
||||||
|
|
||||||
|
.data :
|
||||||
|
{
|
||||||
|
PROVIDE(__etext = LOADADDR(.data)); /* Define a global symbol at end of code, */
|
||||||
|
PROVIDE(__DATA_ROM = LOADADDR(.data)); /* Symbol is used by startup for data initialization. */
|
||||||
|
|
||||||
__data_start__ = .;
|
__data_start__ = .;
|
||||||
*("dma")
|
*("dma")
|
||||||
PROVIDE( __start_vector_table__ = .);
|
PROVIDE( __start_vector_table__ = .);
|
||||||
|
@ -171,6 +227,51 @@ SECTIONS
|
||||||
/* All data end */
|
/* All data end */
|
||||||
__data_end__ = .;
|
__data_end__ = .;
|
||||||
|
|
||||||
|
} > RAM AT > FLASH
|
||||||
|
|
||||||
|
/* uVisor configuration section
|
||||||
|
* This section must be located after all other flash regions. */
|
||||||
|
.uvisor.secure :
|
||||||
|
{
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_secure_start = .;
|
||||||
|
|
||||||
|
/* uVisor secure boxes configuration tables */
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_cfgtbl_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.cfgtbl))
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_cfgtbl_end = .;
|
||||||
|
|
||||||
|
/* Pointers to the uVisor secure boxes configuration tables */
|
||||||
|
/* Note: Do not add any further alignment here, as uVisor will need to
|
||||||
|
have access to the exact list of pointers. */
|
||||||
|
__uvisor_cfgtbl_ptr_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
|
||||||
|
KEEP(*(.keep.uvisor.cfgtbl_ptr))
|
||||||
|
__uvisor_cfgtbl_ptr_end = .;
|
||||||
|
|
||||||
|
/* Pointers to all boxes register gateways. These are grouped here to
|
||||||
|
allow discoverability and firmware verification. */
|
||||||
|
__uvisor_register_gateway_ptr_start = .;
|
||||||
|
KEEP(*(.keep.uvisor.register_gateway_ptr))
|
||||||
|
__uvisor_register_gateway_ptr_end = .;
|
||||||
|
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uvisor_secure_end = .;
|
||||||
|
} > FLASH
|
||||||
|
|
||||||
|
/* Uninitialized data section
|
||||||
|
* This region is not initialized by the C/C++ library and can be used to
|
||||||
|
* store state across soft reboots. */
|
||||||
|
.uninitialized (NOLOAD):
|
||||||
|
{
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uninitialized_start = .;
|
||||||
|
*(.uninitialized)
|
||||||
|
KEEP(*(.keep.uninitialized))
|
||||||
|
. = ALIGN(32);
|
||||||
|
__uninitialized_end = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
.bss :
|
.bss :
|
||||||
|
@ -183,33 +284,29 @@ SECTIONS
|
||||||
__bss_end__ = .;
|
__bss_end__ = .;
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
.heap (COPY):
|
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
__stack = __StackTop;
|
||||||
|
__StackLimit = __StackTop - STACK_SIZE;
|
||||||
|
|
||||||
|
.heap (NOLOAD):
|
||||||
{
|
{
|
||||||
|
__uvisor_heap_start = .;
|
||||||
__HeapBase = .;
|
__HeapBase = .;
|
||||||
__end__ = .;
|
__end__ = .;
|
||||||
end = __end__;
|
end = __end__;
|
||||||
_end = __end__;
|
_end = __end__;
|
||||||
KEEP(*(.heap*))
|
. += HEAP_SIZE;
|
||||||
__HeapLimit = .;
|
|
||||||
} > RAM
|
} > RAM
|
||||||
|
|
||||||
/* .stack_dummy section doesn't contains any symbols. It is only
|
__HeapLimit = __StackLimit;
|
||||||
* used for linker to calculate size of stack sections, and assign
|
__uvisor_heap_end = __StackLimit;
|
||||||
* values to stack symbols later */
|
|
||||||
.stack_dummy (COPY):
|
|
||||||
{
|
|
||||||
KEEP(*(.stack*))
|
|
||||||
} > RAM
|
|
||||||
|
|
||||||
/* Set stack top to end of RAM, and stack limit move down by
|
/* Provide physical memory boundaries for uVisor. */
|
||||||
* size of stack_dummy section */
|
__uvisor_flash_start = ORIGIN(FLASH);
|
||||||
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
|
__uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
|
||||||
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
|
__uvisor_sram_start = ORIGIN(RAM);
|
||||||
PROVIDE(__stack = __StackTop);
|
__uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
|
||||||
|
|
||||||
/* Check if data + heap + stack exceeds RAM limit */
|
/* Check if FLASH usage exceeds FLASH size. */
|
||||||
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
|
ASSERT(LENGTH(FLASH) >= __uvisor_secure_end, "FLASH memory overflowed!")
|
||||||
|
|
||||||
/* Check if FLASH usage exceeds FLASH size */
|
|
||||||
ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,23 +49,6 @@ __StackLimit:
|
||||||
__StackTop:
|
__StackTop:
|
||||||
.size __StackTop, . - __StackTop
|
.size __StackTop, . - __StackTop
|
||||||
|
|
||||||
.section .heap
|
|
||||||
.align 3
|
|
||||||
#ifdef __HEAP_SIZE
|
|
||||||
.equ Heap_Size, __HEAP_SIZE
|
|
||||||
#else
|
|
||||||
.equ Heap_Size, 0x00000C00
|
|
||||||
#endif
|
|
||||||
.globl __HeapBase
|
|
||||||
.globl __HeapLimit
|
|
||||||
__HeapBase:
|
|
||||||
.if Heap_Size
|
|
||||||
.space Heap_Size
|
|
||||||
.endif
|
|
||||||
.size __HeapBase, . - __HeapBase
|
|
||||||
__HeapLimit:
|
|
||||||
.size __HeapLimit, . - __HeapLimit
|
|
||||||
|
|
||||||
.section .vectors
|
.section .vectors
|
||||||
.align 2
|
.align 2
|
||||||
.globl __Vectors
|
.globl __Vectors
|
||||||
|
@ -144,6 +127,11 @@ Reset_Handler:
|
||||||
blx r0
|
blx r0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(FEATURE_UVISOR) && defined(TARGET_UVISOR_SUPPORTED)
|
||||||
|
ldr r0, =uvisor_init
|
||||||
|
blx r0
|
||||||
|
#endif /* defined(FEATURE_UVISOR) && defined(UVISOR_SUPPORTED) */
|
||||||
|
|
||||||
/* Firstly it copies data from read only memory to RAM. There are two schemes
|
/* Firstly it copies data from read only memory to RAM. There are two schemes
|
||||||
* to copy. One can copy more than one sections. Another can only copy
|
* to copy. One can copy more than one sections. Another can only copy
|
||||||
* one section. The former scheme needs more instructions and read-only
|
* one section. The former scheme needs more instructions and read-only
|
||||||
|
|
Loading…
Reference in New Issue