Alessandro Angelino / target-mcu-k64f

Fork of target-mcu-k64f by Morpheus

Revision:
2:55d6ee55cf2a
Parent:
1:a2f6f231d859
Child:
3:45d1072eb12f
--- a/cmsis/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld	Mon Apr 04 13:47:22 2016 +0100
+++ b/cmsis/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld	Mon Apr 04 13:49:58 2016 +0100
@@ -55,8 +55,41 @@
          . = ALIGN(4);
     } > FLASH_PROTECTION
 
+    /* Ensure that the uVisor .bss is the first section in the public SRAM. */
+    .uvisor.bss (NOLOAD):
+    {
+        . = ALIGN(32);
+        __uvisor_bss_start = .;
+
+        /* uVisor main .bss (protected) */
+        . = ALIGN(32);
+        __uvisor_bss_main_start = .;
+        KEEP(*(.keep.uvisor.bss.main))
+        . = ALIGN(32);
+        __uvisor_bss_main_end = .;
+
+        /* Secure boxes .bss (protected) */
+        . = ALIGN(32);
+        __uvisor_bss_boxes_start = .;
+        KEEP(*(.keep.uvisor.bss.boxes))
+        . = ALIGN(32);
+        __uvisor_bss_boxes_end = .;
+
+        . = ALIGN(32);
+        __uvisor_bss_end = .;
+    } > RAM
+
     .text :
     {
+        /* uVisor code and data */
+        /* Note: This is the location of the uVisor binary in flash. Make sure
+         * this position correspond to the FLASH_OFFSET set in the uVisor
+         * configuration. */
+        . = ALIGN(4);
+        __uvisor_main_start = .;
+        *(.uvisor.main)
+        __uvisor_main_end = .;
+
         *(.text*)
 
         KEEP(*(.init))
@@ -93,10 +126,10 @@
     } > FLASH
     __exidx_end = .;
 
-    __etext = .;
+    .data :
+    {
+        PROVIDE( __etext = LOADADDR(.data) );
 
-    .data : AT (__etext)
-    {
         __data_start__ = .;
         *(vtable)
         *(.data*)
@@ -126,7 +159,32 @@
         /* All data end */
         __data_end__ = .;
 
-    } > RAM
+    } > RAM AT>FLASH
+
+    /* uVisor configuration data */
+    .uvisor.secure :
+    {
+        . = ALIGN(32);
+        __uvisor_secure_start = .;
+
+        /* Secure boxes configuration tables (protected) */
+        . = ALIGN(32);
+        __uvisor_cfgtbl_start = .;
+        KEEP(*(.keep.uvisor.cfgtbl))
+        . = ALIGN(32);
+        __uvisor_cfgtbl_end = .;
+
+        /* Pointers to the secure boxes configuration tables (protected) */
+        /* Note: Do not add any further alignment here, as we use this pointer
+         * table to enumerate boxes. */
+        __uvisor_cfgtbl_ptr_start = .;
+        KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
+        KEEP(*(.keep.uvisor.cfgtbl_ptr))
+        __uvisor_cfgtbl_ptr_end = .;
+
+        . = ALIGN(32);
+        __uvisor_secure_end = .;
+    } >FLASH
 
     .bss :
     {
@@ -160,5 +218,13 @@
 
     /* Check if data + heap + stack exceeds RAM limit */
     ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+
+    /* Provide physical memory boundaries for uVisor. */
+    __uvisor_flash_start = ORIGIN(VECTORS);
+    __uvisor_flash_offset = ORIGIN(FLASH);
+    __uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
+    __uvisor_sram_start = ORIGIN(RAM) - 0x200;
+    __uvisor_sram_offset = ORIGIN(RAM);
+    __uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
 }