Skip to content

Commit ec98017

Browse files
AlessandroAmeriac
authored andcommitted
Add uVisor-specific sections to linker script
1 parent 7818102 commit ec98017

File tree

1 file changed

+70
-4
lines changed
  • hal/targets/cmsis/TARGET_Freescale/TARGET_MCU_K64F/TOOLCHAIN_GCC_ARM

1 file changed

+70
-4
lines changed

hal/targets/cmsis/TARGET_Freescale/TARGET_MCU_K64F/TOOLCHAIN_GCC_ARM/K64FN1M0xxx12.ld

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,41 @@ SECTIONS
5555
. = ALIGN(4);
5656
} > FLASH_PROTECTION
5757

58+
/* Ensure that the uVisor .bss is the first section in the public SRAM. */
59+
.uvisor.bss (NOLOAD):
60+
{
61+
. = ALIGN(32);
62+
__uvisor_bss_start = .;
63+
64+
/* uVisor main .bss (protected) */
65+
. = ALIGN(32);
66+
__uvisor_bss_main_start = .;
67+
KEEP(*(.keep.uvisor.bss.main))
68+
. = ALIGN(32);
69+
__uvisor_bss_main_end = .;
70+
71+
/* Secure boxes .bss (protected) */
72+
. = ALIGN(32);
73+
__uvisor_bss_boxes_start = .;
74+
KEEP(*(.keep.uvisor.bss.boxes))
75+
. = ALIGN(32);
76+
__uvisor_bss_boxes_end = .;
77+
78+
. = ALIGN(32);
79+
__uvisor_bss_end = .;
80+
} > RAM
81+
5882
.text :
5983
{
84+
/* uVisor code and data */
85+
/* Note: This is the location of the uVisor binary in flash. Make sure
86+
* this position correspond to the FLASH_OFFSET set in the uVisor
87+
* configuration. */
88+
. = ALIGN(4);
89+
__uvisor_main_start = .;
90+
*(.uvisor.main)
91+
__uvisor_main_end = .;
92+
6093
*(.text*)
6194

6295
KEEP(*(.init))
@@ -93,10 +126,10 @@ SECTIONS
93126
} > FLASH
94127
__exidx_end = .;
95128

96-
__etext = .;
97-
98-
.data : AT (__etext)
129+
.data :
99130
{
131+
PROVIDE( __etext = LOADADDR(.data) );
132+
100133
__data_start__ = .;
101134
*(vtable)
102135
*(.data*)
@@ -126,7 +159,32 @@ SECTIONS
126159
/* All data end */
127160
__data_end__ = .;
128161

129-
} > RAM
162+
} > RAM AT>FLASH
163+
164+
/* uVisor configuration data */
165+
.uvisor.secure :
166+
{
167+
. = ALIGN(32);
168+
__uvisor_secure_start = .;
169+
170+
/* Secure boxes configuration tables (protected) */
171+
. = ALIGN(32);
172+
__uvisor_cfgtbl_start = .;
173+
KEEP(*(.keep.uvisor.cfgtbl))
174+
. = ALIGN(32);
175+
__uvisor_cfgtbl_end = .;
176+
177+
/* Pointers to the secure boxes configuration tables (protected) */
178+
/* Note: Do not add any further alignment here, as we use this pointer
179+
* table to enumerate boxes. */
180+
__uvisor_cfgtbl_ptr_start = .;
181+
KEEP(*(.keep.uvisor.cfgtbl_ptr_first))
182+
KEEP(*(.keep.uvisor.cfgtbl_ptr))
183+
__uvisor_cfgtbl_ptr_end = .;
184+
185+
. = ALIGN(32);
186+
__uvisor_secure_end = .;
187+
} >FLASH
130188

131189
.bss :
132190
{
@@ -160,5 +218,13 @@ SECTIONS
160218

161219
/* Check if data + heap + stack exceeds RAM limit */
162220
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
221+
222+
/* Provide physical memory boundaries for uVisor. */
223+
__uvisor_flash_start = ORIGIN(VECTORS);
224+
__uvisor_flash_offset = ORIGIN(FLASH);
225+
__uvisor_flash_end = ORIGIN(FLASH) + LENGTH(FLASH);
226+
__uvisor_sram_start = ORIGIN(RAM) - 0x200;
227+
__uvisor_sram_offset = ORIGIN(RAM);
228+
__uvisor_sram_end = ORIGIN(RAM) + LENGTH(RAM);
163229
}
164230

0 commit comments

Comments
 (0)