From 694838b7069e5cdc22393083ca7b5e2a20187eb5 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Mon, 12 Jun 2017 15:04:30 +0800 Subject: [PATCH] [M487] Guard from initial stack allocated on SPIM CCM memory not initialized yet Not add this guard in IAR toolchain due to its unsupported ILINK syntax --- .../TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct | 7 ++++++- .../TARGET_M480/device/TOOLCHAIN_ARM_STD/M487.sct | 6 +++++- .../TARGET_M480/device/TOOLCHAIN_GCC_ARM/M487.ld | 5 +++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct index c191a142c9..95d7b4a61b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_MICRO/M487.sct @@ -8,6 +8,9 @@ #define MBED_APP_SIZE 0x00080000 #endif +#define SPIM_CCM_START 0x20020000 +#define SPIM_CCM_END 0x20028000 + LR_IROM1 MBED_APP_START { ER_IROM1 MBED_APP_START { ; load address = execution address *(RESET, +First) @@ -34,4 +37,6 @@ LR_IROM1 MBED_APP_START { } ScatterAssert(LoadLimit(LR_IROM1) <= (MBED_APP_START + MBED_APP_SIZE)) ; 512 KB APROM ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= 0x20028000) ; 160 KB SRAM - +ScatterAssert(ImageLimit(ARM_LIB_STACK) <= SPIM_CCM_START) ; Guard from initial stack allocated on SPIM CCM memory + ; which is not initialized yet + diff --git a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_STD/M487.sct b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_STD/M487.sct index c191a142c9..7fa6e2b8d5 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_STD/M487.sct +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_ARM_STD/M487.sct @@ -8,6 +8,9 @@ #define MBED_APP_SIZE 0x00080000 #endif +#define SPIM_CCM_START 0x20020000 +#define SPIM_CCM_END 0x20028000 + LR_IROM1 MBED_APP_START { ER_IROM1 MBED_APP_START { ; load address = execution address *(RESET, +First) @@ -34,4 +37,5 @@ LR_IROM1 MBED_APP_START { } ScatterAssert(LoadLimit(LR_IROM1) <= (MBED_APP_START + MBED_APP_SIZE)) ; 512 KB APROM ScatterAssert(ImageLimit(ARM_LIB_HEAP) <= 0x20028000) ; 160 KB SRAM - +ScatterAssert(ImageLimit(ARM_LIB_STACK) <= SPIM_CCM_START) ; Guard from initial stack allocated on SPIM CCM memory + ; which is not initialized yet diff --git a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/M487.ld b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/M487.ld index a96fdc06c5..e3f6dbaa9b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/M487.ld +++ b/targets/TARGET_NUVOTON/TARGET_M480/device/TOOLCHAIN_GCC_ARM/M487.ld @@ -11,6 +11,8 @@ #endif StackSize = 0x800; +SPIM_CCM_START = 0x20020000; +SPIM_CCM_END = 0x20028000; MEMORY { @@ -171,6 +173,9 @@ SECTIONS __StackLimit = ADDR(.stack); PROVIDE(__stack = __StackTop); + /* Guard from initial stack allocated on SPIM CCM memory which is not initialized yet */ + ASSERT(__StackTop <= SPIM_CCM_START, "SPIM CCM memory not initialized yet for initial stack") + /* Relocate vector table in SRAM */ .isr_vector.reloc (NOLOAD) : {