From c3c661da8dacec158f9900128ccf1e7fdb4543e9 Mon Sep 17 00:00:00 2001 From: ccli8 Date: Thu, 3 May 2018 17:22:36 +0800 Subject: [PATCH] [M2351] Change secure/non-secure stack/heap size 1. Change RTOS-less main stack/RTOS ISR stack size to 2KiB 2. Change secure/non-secure heap size to 16KiB/32KiB for IAR --- .../device/TOOLCHAIN_ARM_MICRO/M2351.sct | 27 ++++++++++++++----- .../device/TOOLCHAIN_ARM_STD/M2351.sct | 27 ++++++++++++++----- .../device/TOOLCHAIN_GCC_ARM/M2351.ld | 4 +++ .../device/TOOLCHAIN_IAR/M2351.icf | 6 ++--- 4 files changed, 49 insertions(+), 15 deletions(-) diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/M2351.sct b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/M2351.sct index a85969c79d..b547c0284b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/M2351.sct +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/M2351.sct @@ -21,6 +21,15 @@ */ #define NU_TZ_NSC_REGION_BASE (MBED_APP_START + MBED_APP_SIZE - 0x2000 - NU_TZ_NSC_REGION_SIZE) +/* Initial/ISR stack size */ +#if (! defined(NU_INITIAL_STACK_SIZE)) +#if defined(__DOMAIN_NS) && __DOMAIN_NS +#define NU_INITIAL_STACK_SIZE 0x800 +#else +#define NU_INITIAL_STACK_SIZE 0x800 +#endif +#endif + #if defined(__DOMAIN_NS) && __DOMAIN_NS #if (! defined(MBED_APP_START)) @@ -41,12 +50,15 @@ LR_IROM1 MBED_APP_START .ANY (+RO) } - ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY 0x800 + ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY NU_INITIAL_STACK_SIZE { } - /* Reserve for vectors */ - ER_IRAMVEC 0x30000800 + NU_TZ_SECURE_SRAM_SIZE EMPTY (4*(16 + 102)) + /* Reserve for vectors + * + * Vector table base address is required to be 128-byte aligned at a minimum. + * A PE might impose further restrictions on it. */ + ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102)) { } @@ -84,12 +96,15 @@ LR_IROM1 MBED_APP_START .ANY (+RO) } - ARM_LIB_STACK 0x20000000 EMPTY 0x800 + ARM_LIB_STACK 0x20000000 EMPTY NU_INITIAL_STACK_SIZE { } - /* Reserve for vectors */ - ER_IRAMVEC 0x20000800 EMPTY (4*(16 + 102)) + /* Reserve for vectors + * + * Vector table base address is required to be 128-byte aligned at a minimum. + * A PE might impose further restrictions on it. */ + ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102)) { } diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/M2351.sct b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/M2351.sct index a85969c79d..b547c0284b 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/M2351.sct +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/M2351.sct @@ -21,6 +21,15 @@ */ #define NU_TZ_NSC_REGION_BASE (MBED_APP_START + MBED_APP_SIZE - 0x2000 - NU_TZ_NSC_REGION_SIZE) +/* Initial/ISR stack size */ +#if (! defined(NU_INITIAL_STACK_SIZE)) +#if defined(__DOMAIN_NS) && __DOMAIN_NS +#define NU_INITIAL_STACK_SIZE 0x800 +#else +#define NU_INITIAL_STACK_SIZE 0x800 +#endif +#endif + #if defined(__DOMAIN_NS) && __DOMAIN_NS #if (! defined(MBED_APP_START)) @@ -41,12 +50,15 @@ LR_IROM1 MBED_APP_START .ANY (+RO) } - ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY 0x800 + ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY NU_INITIAL_STACK_SIZE { } - /* Reserve for vectors */ - ER_IRAMVEC 0x30000800 + NU_TZ_SECURE_SRAM_SIZE EMPTY (4*(16 + 102)) + /* Reserve for vectors + * + * Vector table base address is required to be 128-byte aligned at a minimum. + * A PE might impose further restrictions on it. */ + ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102)) { } @@ -84,12 +96,15 @@ LR_IROM1 MBED_APP_START .ANY (+RO) } - ARM_LIB_STACK 0x20000000 EMPTY 0x800 + ARM_LIB_STACK 0x20000000 EMPTY NU_INITIAL_STACK_SIZE { } - /* Reserve for vectors */ - ER_IRAMVEC 0x20000800 EMPTY (4*(16 + 102)) + /* Reserve for vectors + * + * Vector table base address is required to be 128-byte aligned at a minimum. + * A PE might impose further restrictions on it. */ + ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102)) { } diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld index 42f1717ed8..a043991b1c 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld @@ -2,7 +2,11 @@ * Nuvoton M2351 GCC linker script file */ +#if defined(__DOMAIN_NS) && __DOMAIN_NS StackSize = 0x800; +#else +StackSize = 0x800; +#endif #include "partition_M2351_sub.h" diff --git a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf index fea35af90e..de28498778 100644 --- a/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf +++ b/targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf @@ -25,7 +25,7 @@ if (isdefinedsymbol(__DOMAIN_NS)) { /*-Sizes-*/ define symbol __ICFEDIT_size_cstack__ = 0x800; - define symbol __ICFEDIT_size_heap__ = 0x4000; + define symbol __ICFEDIT_size_heap__ = 0x8000; } else { @@ -61,8 +61,8 @@ if (isdefinedsymbol(__DOMAIN_NS)) { export symbol __NU_TZ_NSC_REGION_SIZE__ = NU_TZ_NSC_REGION_SIZE; /*-Sizes-*/ - define symbol __ICFEDIT_size_cstack__ = 0x800; - define symbol __ICFEDIT_size_heap__ = 0x1000; + define symbol __ICFEDIT_size_cstack__ = 0x800; + define symbol __ICFEDIT_size_heap__ = 0x4000; } /**** End of ICF editor section. ###ICF###*/