diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld index d775bfaaf7..242e212e5b 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld @@ -93,9 +93,9 @@ SECTIONS /* The program code and other data goes into internal flash */ /* Note: The uVisor expects this section at a fixed location, as specified by * the porting process configuration parameter: FLASH_OFFSET. */ - __UVISOR_TEXT_OFFSET = 0x410; - __UVISOR_TEXT_START = ORIGIN(m_interrupts) + __UVISOR_TEXT_OFFSET; - .text __UVISOR_TEXT_START : + __UVISOR_FLASH_OFFSET = 0x410; + __UVISOR_FLASH_START = ORIGIN(m_interrupts) + __UVISOR_FLASH_OFFSET; + .text __UVISOR_FLASH_START : { /* uVisor code and data */ . = ALIGN(4); @@ -197,27 +197,26 @@ SECTIONS __interrupts_ram_end__ = .; /* Define a global symbol at data end */ } > m_data - /* Ensure that the uVisor BSS section is put first after the relocated - * interrupt table in SRAM. */ - /* Note: The uVisor expects this section at a fixed location, as specified by - * the porting process configuration parameter: SRAM_OFFSET. */ + /* uVisor own memory and private box memories + /* If uVisor shares the SRAM with the OS/app, ensure that this section is + * the first one after the VTOR relocation section. */ + /* Note: The uVisor expects this section at a fixed location, as specified + by the porting process configuration parameter: SRAM_OFFSET. */ __UVISOR_SRAM_OFFSET = 0x400; - __UVISOR_BSS_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET; - ASSERT(__interrupts_ram_end__ <= __UVISOR_BSS_START, - "The ISR relocation region overlaps with the uVisor BSS section.") - .uvisor.bss __UVISOR_BSS_START (NOLOAD): + __UVISOR_SRAM_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET; + .uvisor.bss __UVISOR_SRAM_START (NOLOAD): { . = ALIGN(32); __uvisor_bss_start = .; - /* protected uvisor main bss */ + /* Protected uVisor own BSS section */ . = ALIGN(32); __uvisor_bss_main_start = .; KEEP(*(.keep.uvisor.bss.main)) . = ALIGN(32); __uvisor_bss_main_end = .; - /* protected uvisor secure boxes bss */ + /* Protected uVisor boxes' static memories */ . = ALIGN(32); __uvisor_bss_boxes_start = .; KEEP(*(.keep.uvisor.bss.boxes)) @@ -228,7 +227,10 @@ SECTIONS __uvisor_bss_end = .; } > m_data - /* Heap space for the page allocator */ + /* Heap space for the page allocator + /* If uVisor shares the SRAM with the OS/app, ensure that this section is + * the first one after the uVisor BSS section. Otherwise, ensure it is the + * first one after the VTOR relocation section. */ .page_heap (NOLOAD) : { . = ALIGN(32); @@ -305,6 +307,7 @@ SECTIONS } > m_data_2 USB_RAM_GAP = DEFINED(__usb_ram_size__) ? __usb_ram_size__ : 0x800; + /* Uninitialized data section */ .bss : { @@ -354,11 +357,13 @@ SECTIONS .ARM.attributes 0 : { *(.ARM.attributes) } - ASSERT(__StackLimit >= __HeapLimit, "region m_data_2 overflowed with stack and heap") + ASSERT(__StackLimit >= __HeapLimit, "Region m_data_2 overflowed with stack and heap") /* Provide the physical memory boundaries for uVisor. */ __uvisor_flash_start = ORIGIN(m_interrupts); __uvisor_flash_end = ORIGIN(m_text) + LENGTH(m_text); __uvisor_sram_start = ORIGIN(m_data); __uvisor_sram_end = ORIGIN(m_data_2) + LENGTH(m_data_2); + __uvisor_public_sram_start = __uvisor_sram_start; + __uvisor_public_sram_end = __uvisor_sram_end; } diff --git a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld index 85b009eeb5..d89a01aa2f 100644 --- a/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld +++ b/targets/TARGET_Silicon_Labs/TARGET_EFM32/TARGET_EFM32GG/device/TARGET_1024K/TOOLCHAIN_GCC_ARM/efm32gg.ld @@ -56,13 +56,12 @@ __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 { + /* Note: The uVisor expects the text section at a fixed location, as specified + by the porting process configuration parameter: FLASH_OFFSET. */ + __UVISOR_FLASH_OFFSET = 0x100; + __UVISOR_FLASH_START = ORIGIN(FLASH) + __UVISOR_FLASH_OFFSET; .text : { KEEP(*(.vectors)) @@ -71,7 +70,7 @@ SECTIONS __end__ = .; /* uVisor code and data */ - . = __UVISOR_TEXT_OFFSET; + . = __UVISOR_FLASH_OFFSET; . = ALIGN(4); __uvisor_main_start = .; *(.uvisor.main) @@ -147,24 +146,26 @@ SECTIONS } > FLASH */ - /* Ensure that the uVisor BSS section is put first in SRAM. */ + /* uVisor own memory and private box memories + /* If uVisor shares the SRAM with the OS/app, ensure that this section is + * the first one after the VTOR relocation section. */ /* 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): + __UVISOR_SRAM_START = ORIGIN(m_data) + __UVISOR_SRAM_OFFSET; + .uvisor.bss __UVISOR_SRAM_START (NOLOAD): { . = ALIGN(32); __uvisor_bss_start = .; - /* uVisor main BSS section */ + /* Protected uVisor own BSS section */ . = ALIGN(32); __uvisor_bss_main_start = .; KEEP(*(.keep.uvisor.bss.main)) . = ALIGN(32); __uvisor_bss_main_end = .; - /* Secure boxes BSS section */ + /* Protected uVisor boxes' static memories */ . = ALIGN(32); __uvisor_bss_boxes_start = .; KEEP(*(.keep.uvisor.bss.boxes)) @@ -175,15 +176,16 @@ SECTIONS __uvisor_bss_end = .; } > RAM - /* Heap space for the page allocator */ + /* Heap space for the page allocator + /* If uVisor shares the SRAM with the OS/app, ensure that this section is + * the first one after the uVisor BSS section. Otherwise, ensure it is the + * first one after the VTOR relocation section. */ .page_heap (NOLOAD) : { . = ALIGN(32); __uvisor_page_start = .; KEEP(*(.keep.uvisor.page_heap)) - . = ALIGN( (1 << LOG2CEIL(LENGTH(RAM))) / 8); - __uvisor_page_end = .; } > RAM @@ -284,10 +286,6 @@ SECTIONS __bss_end__ = .; } > RAM - __StackTop = ORIGIN(RAM) + LENGTH(RAM); - __stack = __StackTop; - __StackLimit = __StackTop - STACK_SIZE; - .heap (NOLOAD): { __uvisor_heap_start = .; @@ -296,17 +294,21 @@ SECTIONS end = __end__; _end = __end__; . += HEAP_SIZE; + __HeapLimit = .; + __uvisor_heap_end = .; } > RAM - __HeapLimit = __StackLimit; - __uvisor_heap_end = __StackLimit; + __StackTop = ORIGIN(RAM) + LENGTH(RAM); + __stack = __StackTop; + __StackLimit = __StackTop - STACK_SIZE; + + ASSERT(__StackLimit >= __HeapLimit, "Region RAM overflowed with stack and heap") /* 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 FLASH usage exceeds FLASH size. */ - ASSERT(LENGTH(FLASH) >= __uvisor_secure_end, "FLASH memory overflowed!") + __uvisor_public_sram_start = __uvisor_sram_start; + __uvisor_public_sram_end = __uvisor_sram_end; }