mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			EFM32: Add support for uVisor
							parent
							
								
									371d652a04
								
							
						
					
					
						commit
						eb86d12aee
					
				| 
						 | 
				
			
			@ -9,6 +9,9 @@
 | 
			
		|||
/* Version 4.2.0 */
 | 
			
		||||
/*                                                                  */
 | 
			
		||||
 | 
			
		||||
STACK_SIZE = 0x400;
 | 
			
		||||
HEAP_SIZE = 0xC00;
 | 
			
		||||
 | 
			
		||||
MEMORY
 | 
			
		||||
{
 | 
			
		||||
  FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 1048576
 | 
			
		||||
| 
						 | 
				
			
			@ -53,6 +56,11 @@ __vector_size = 0xDC;
 | 
			
		|||
 */
 | 
			
		||||
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
 | 
			
		||||
{
 | 
			
		||||
  .text :
 | 
			
		||||
| 
						 | 
				
			
			@ -62,6 +70,13 @@ SECTIONS
 | 
			
		|||
    __Vectors_Size = __Vectors_End - __Vectors;
 | 
			
		||||
    __end__ = .;
 | 
			
		||||
 | 
			
		||||
    /* uVisor code and data */
 | 
			
		||||
    . = __UVISOR_TEXT_OFFSET;
 | 
			
		||||
    . = ALIGN(4);
 | 
			
		||||
    __uvisor_main_start = .;
 | 
			
		||||
    *(.uvisor.main)
 | 
			
		||||
    __uvisor_main_end = .;
 | 
			
		||||
 | 
			
		||||
    *(.text*)
 | 
			
		||||
 | 
			
		||||
    KEEP(*(.init))
 | 
			
		||||
| 
						 | 
				
			
			@ -132,10 +147,51 @@ SECTIONS
 | 
			
		|||
  } > FLASH
 | 
			
		||||
  */
 | 
			
		||||
 | 
			
		||||
  __etext = .;
 | 
			
		||||
 | 
			
		||||
  .data : AT (__etext)
 | 
			
		||||
  /* Ensure that the uVisor BSS section is put first in SRAM. */
 | 
			
		||||
  /* Note: The uVisor expects this section at a fixed location, as specified
 | 
			
		||||
           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__ = .;
 | 
			
		||||
    *("dma")
 | 
			
		||||
    PROVIDE( __start_vector_table__ = .);
 | 
			
		||||
| 
						 | 
				
			
			@ -171,6 +227,51 @@ SECTIONS
 | 
			
		|||
    /* All 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
 | 
			
		||||
 | 
			
		||||
  .bss :
 | 
			
		||||
| 
						 | 
				
			
			@ -183,33 +284,29 @@ SECTIONS
 | 
			
		|||
    __bss_end__ = .;
 | 
			
		||||
  } > RAM
 | 
			
		||||
 | 
			
		||||
  .heap (COPY):
 | 
			
		||||
  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
 | 
			
		||||
  __stack = __StackTop;
 | 
			
		||||
  __StackLimit = __StackTop - STACK_SIZE;
 | 
			
		||||
 | 
			
		||||
  .heap (NOLOAD):
 | 
			
		||||
  {
 | 
			
		||||
    __uvisor_heap_start = .;
 | 
			
		||||
    __HeapBase = .;
 | 
			
		||||
    __end__ = .;
 | 
			
		||||
    end = __end__;
 | 
			
		||||
    _end = __end__;
 | 
			
		||||
    KEEP(*(.heap*))
 | 
			
		||||
    __HeapLimit = .;
 | 
			
		||||
    . += HEAP_SIZE;
 | 
			
		||||
  } > RAM
 | 
			
		||||
 | 
			
		||||
  /* .stack_dummy section doesn't contains any symbols. It is only
 | 
			
		||||
   * used for linker to calculate size of stack sections, and assign
 | 
			
		||||
   * values to stack symbols later */
 | 
			
		||||
  .stack_dummy (COPY):
 | 
			
		||||
  {
 | 
			
		||||
    KEEP(*(.stack*))
 | 
			
		||||
  } > RAM
 | 
			
		||||
  __HeapLimit = __StackLimit;
 | 
			
		||||
  __uvisor_heap_end = __StackLimit;
 | 
			
		||||
 | 
			
		||||
  /* Set stack top to end of RAM, and stack limit move down by
 | 
			
		||||
   * size of stack_dummy section */
 | 
			
		||||
  __StackTop = ORIGIN(RAM) + LENGTH(RAM);
 | 
			
		||||
  __StackLimit = __StackTop - SIZEOF(.stack_dummy);
 | 
			
		||||
  PROVIDE(__stack = __StackTop);
 | 
			
		||||
  /* Provide physical memory boundaries for uVisor. */
 | 
			
		||||
  __uvisor_flash_start = ORIGIN(FLASH);
 | 
			
		||||
  __uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
 | 
			
		||||
  __uvisor_sram_start = ORIGIN(RAM);
 | 
			
		||||
  __uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
 | 
			
		||||
 | 
			
		||||
  /* Check if data + heap + stack exceeds RAM limit */
 | 
			
		||||
  ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
 | 
			
		||||
 | 
			
		||||
  /* Check if FLASH usage exceeds FLASH size */
 | 
			
		||||
  ASSERT( LENGTH(FLASH) >= (__etext + SIZEOF(.data)), "FLASH memory overflowed !")
 | 
			
		||||
  /* Check if FLASH usage exceeds FLASH size. */
 | 
			
		||||
  ASSERT(LENGTH(FLASH) >= __uvisor_secure_end, "FLASH memory overflowed!")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,23 +49,6 @@ __StackLimit:
 | 
			
		|||
__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
 | 
			
		||||
    .align      2
 | 
			
		||||
    .globl      __Vectors
 | 
			
		||||
| 
						 | 
				
			
			@ -144,6 +127,11 @@ Reset_Handler:
 | 
			
		|||
    blx     r0
 | 
			
		||||
#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
 | 
			
		||||
 *  to copy. One can copy more than one sections. Another can only copy
 | 
			
		||||
 *  one section.  The former scheme needs more instructions and read-only
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue