Skip to content

Commit c3c661d

Browse files
committed
[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
1 parent 04f7237 commit c3c661d

File tree

4 files changed

+49
-15
lines changed

4 files changed

+49
-15
lines changed

targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_MICRO/M2351.sct

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
*/
2222
#define NU_TZ_NSC_REGION_BASE (MBED_APP_START + MBED_APP_SIZE - 0x2000 - NU_TZ_NSC_REGION_SIZE)
2323

24+
/* Initial/ISR stack size */
25+
#if (! defined(NU_INITIAL_STACK_SIZE))
26+
#if defined(__DOMAIN_NS) && __DOMAIN_NS
27+
#define NU_INITIAL_STACK_SIZE 0x800
28+
#else
29+
#define NU_INITIAL_STACK_SIZE 0x800
30+
#endif
31+
#endif
32+
2433
#if defined(__DOMAIN_NS) && __DOMAIN_NS
2534

2635
#if (! defined(MBED_APP_START))
@@ -41,12 +50,15 @@ LR_IROM1 MBED_APP_START
4150
.ANY (+RO)
4251
}
4352

44-
ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY 0x800
53+
ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY NU_INITIAL_STACK_SIZE
4554
{
4655
}
4756

48-
/* Reserve for vectors */
49-
ER_IRAMVEC 0x30000800 + NU_TZ_SECURE_SRAM_SIZE EMPTY (4*(16 + 102))
57+
/* Reserve for vectors
58+
*
59+
* Vector table base address is required to be 128-byte aligned at a minimum.
60+
* A PE might impose further restrictions on it. */
61+
ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102))
5062
{
5163
}
5264

@@ -84,12 +96,15 @@ LR_IROM1 MBED_APP_START
8496
.ANY (+RO)
8597
}
8698

87-
ARM_LIB_STACK 0x20000000 EMPTY 0x800
99+
ARM_LIB_STACK 0x20000000 EMPTY NU_INITIAL_STACK_SIZE
88100
{
89101
}
90102

91-
/* Reserve for vectors */
92-
ER_IRAMVEC 0x20000800 EMPTY (4*(16 + 102))
103+
/* Reserve for vectors
104+
*
105+
* Vector table base address is required to be 128-byte aligned at a minimum.
106+
* A PE might impose further restrictions on it. */
107+
ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102))
93108
{
94109
}
95110

targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_ARM_STD/M2351.sct

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@
2121
*/
2222
#define NU_TZ_NSC_REGION_BASE (MBED_APP_START + MBED_APP_SIZE - 0x2000 - NU_TZ_NSC_REGION_SIZE)
2323

24+
/* Initial/ISR stack size */
25+
#if (! defined(NU_INITIAL_STACK_SIZE))
26+
#if defined(__DOMAIN_NS) && __DOMAIN_NS
27+
#define NU_INITIAL_STACK_SIZE 0x800
28+
#else
29+
#define NU_INITIAL_STACK_SIZE 0x800
30+
#endif
31+
#endif
32+
2433
#if defined(__DOMAIN_NS) && __DOMAIN_NS
2534

2635
#if (! defined(MBED_APP_START))
@@ -41,12 +50,15 @@ LR_IROM1 MBED_APP_START
4150
.ANY (+RO)
4251
}
4352

44-
ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY 0x800
53+
ARM_LIB_STACK 0x30000000 + NU_TZ_SECURE_SRAM_SIZE EMPTY NU_INITIAL_STACK_SIZE
4554
{
4655
}
4756

48-
/* Reserve for vectors */
49-
ER_IRAMVEC 0x30000800 + NU_TZ_SECURE_SRAM_SIZE EMPTY (4*(16 + 102))
57+
/* Reserve for vectors
58+
*
59+
* Vector table base address is required to be 128-byte aligned at a minimum.
60+
* A PE might impose further restrictions on it. */
61+
ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102))
5062
{
5163
}
5264

@@ -84,12 +96,15 @@ LR_IROM1 MBED_APP_START
8496
.ANY (+RO)
8597
}
8698

87-
ARM_LIB_STACK 0x20000000 EMPTY 0x800
99+
ARM_LIB_STACK 0x20000000 EMPTY NU_INITIAL_STACK_SIZE
88100
{
89101
}
90102

91-
/* Reserve for vectors */
92-
ER_IRAMVEC 0x20000800 EMPTY (4*(16 + 102))
103+
/* Reserve for vectors
104+
*
105+
* Vector table base address is required to be 128-byte aligned at a minimum.
106+
* A PE might impose further restrictions on it. */
107+
ER_IRAMVEC AlignExpr(+0, 128) EMPTY (4*(16 + 102))
93108
{
94109
}
95110

targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_GCC_ARM/M2351.ld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
* Nuvoton M2351 GCC linker script file
33
*/
44

5+
#if defined(__DOMAIN_NS) && __DOMAIN_NS
6+
StackSize = 0x800;
7+
#else
58
StackSize = 0x800;
9+
#endif
610

711
#include "partition_M2351_sub.h"
812

targets/TARGET_NUVOTON/TARGET_M2351/device/TOOLCHAIN_IAR/M2351.icf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ if (isdefinedsymbol(__DOMAIN_NS)) {
2525

2626
/*-Sizes-*/
2727
define symbol __ICFEDIT_size_cstack__ = 0x800;
28-
define symbol __ICFEDIT_size_heap__ = 0x4000;
28+
define symbol __ICFEDIT_size_heap__ = 0x8000;
2929

3030
} else {
3131

@@ -61,8 +61,8 @@ if (isdefinedsymbol(__DOMAIN_NS)) {
6161
export symbol __NU_TZ_NSC_REGION_SIZE__ = NU_TZ_NSC_REGION_SIZE;
6262

6363
/*-Sizes-*/
64-
define symbol __ICFEDIT_size_cstack__ = 0x800;
65-
define symbol __ICFEDIT_size_heap__ = 0x1000;
64+
define symbol __ICFEDIT_size_cstack__ = 0x800;
65+
define symbol __ICFEDIT_size_heap__ = 0x4000;
6666
}
6767

6868
/**** End of ICF editor section. ###ICF###*/

0 commit comments

Comments
 (0)