Skip to content

Commit 13da158

Browse files
committed
[TOSHIBA] Support boot stack size configuration option
1 parent 93ed18e commit 13da158

File tree

15 files changed

+109
-17
lines changed

15 files changed

+109
-17
lines changed

targets/TARGET_TOSHIBA/TARGET_TMPM066/device/TOOLCHAIN_ARM_STD/tmpm066fwug.sct

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;; TMPM066FWUG scatter file
24

35
;; Vector table starts at 0
@@ -13,6 +15,12 @@
1315

1416
;; Compatible with ISSM model
1517

18+
#if !defined(MBED_BOOT_STACK_SIZE)
19+
#define MBED_BOOT_STACK_SIZE 0x400
20+
#endif
21+
22+
#define Stack_Size MBED_BOOT_STACK_SIZE
23+
1624
LR_IROM1 0x00000000 0x20000
1725
{
1826
ER_IROM1 0x00000000 0x20000
@@ -25,8 +33,11 @@ LR_IROM1 0x00000000 0x20000
2533
}
2634

2735
/* 8_byte_aligned(32 + 16 vect * 4 bytes) = 8_byte_aligned(0xC0) */
28-
RW_IRAM1 0x200000C0 (0x4000 - 0xC0)
36+
RW_IRAM1 0x200000C0 (0x4000 - 0xC0 - Stack_Size)
2937
{
3038
.ANY (+RW, +ZI)
3139
}
40+
41+
ARM_LIB_STACK (0x200000C0+0x4000) EMPTY -Stack_Size { ; stack
42+
}
3243
}

targets/TARGET_TOSHIBA/TARGET_TMPM066/device/TOOLCHAIN_GCC_ARM/tmpm066fwug.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* Linker script for Toshiba TMPM066 */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
39
/* Linker script to configure memory regions. */
410
MEMORY
511
{
@@ -142,7 +148,7 @@ SECTIONS
142148
/* Set stack top to end of RAM, and stack limit move down by
143149
* size of stack_dummy section */
144150
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
145-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
151+
__StackLimit = __StackTop - STACK_SIZE;
146152
PROVIDE(__stack = __StackTop);
147153

148154
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_TOSHIBA/TARGET_TMPM066/device/TOOLCHAIN_IAR/tmpm066fwug.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0001FFFF;
99
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
1010
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
1111
/*-Sizes-*/
12-
define symbol __ICFEDIT_size_cstack__ = 0x400;
12+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
13+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
14+
}
15+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1316
define symbol __ICFEDIT_size_heap__ = 0xC00;
1417
/**** End of ICF editor section. ###ICF###*/
1518

targets/TARGET_TOSHIBA/TARGET_TMPM3H6/device/TOOLCHAIN_ARM_STD/tmpm3h6fwfg.sct

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;; TMPM3H6FWFG scatter file
24

35
;; Vector table starts at 0
@@ -13,6 +15,12 @@
1315

1416
;; Compatible with ISSM model
1517

18+
#if !defined(MBED_BOOT_STACK_SIZE)
19+
#define MBED_BOOT_STACK_SIZE 0x400
20+
#endif
21+
22+
#define Stack_Size MBED_BOOT_STACK_SIZE
23+
1624
LR_IROM1 0x00000000 0x20000
1725
{
1826
ER_IROM1 0x00000000 0x20000
@@ -22,8 +30,11 @@ LR_IROM1 0x00000000 0x20000
2230
.ANY (+RO)
2331
}
2432
; 8_byte_aligned(117 + 16 vect * 4 bytes) = 8_byte_aligned(0x214) = 0x218
25-
RW_IRAM1 (0x20000000 + 0x218) (0x4000 - 0x218)
33+
RW_IRAM1 (0x20000000 + 0x218) (0x4000 - 0x218 - Stack_Size)
2634
{
2735
.ANY (+RW, +ZI)
2836
}
37+
38+
ARM_LIB_STACK (0x20000000+0x4000) EMPTY -Stack_Size { ; stack
39+
}
2940
}

targets/TARGET_TOSHIBA/TARGET_TMPM3H6/device/TOOLCHAIN_GCC_ARM/tmpm3h6fwfg.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* Linker script for Toshiba TMPM3H6 */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
39
/* Linker script to configure memory regions. */
410
MEMORY
511
{
@@ -154,7 +160,7 @@ SECTIONS
154160
/* Set stack top to end of RAM, and stack limit move down by
155161
* size of stack_dummy section */
156162
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
157-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
163+
__StackLimit = __StackTop - STACK_SIZE;
158164
PROVIDE(__stack = __StackTop);
159165

160166
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_TOSHIBA/TARGET_TMPM3H6/device/TOOLCHAIN_IAR/tmpm3h6fwfg.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ define symbol __ICFEDIT_region_ROM_end__ = 0x0001FFFF;
99
define symbol __ICFEDIT_region_RAM_start__ = 0x20000218; /* 8_byte_aligned(117 + 16 vect * 4 bytes) */
1010
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
1111
/*-Sizes-*/
12-
define symbol __ICFEDIT_size_cstack__ = 0x400;
12+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
13+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
14+
}
15+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1316
define symbol __ICFEDIT_size_heap__ = 0xC00;
1417
/**** End of ICF editor section. ###ICF###*/
1518

targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/device/TOOLCHAIN_ARM_STD/tmpm3hqfdfg.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@
2323
#define MBED_APP_SIZE 0x00080000
2424
#endif
2525

26+
#if !defined(MBED_BOOT_STACK_SIZE)
27+
#define MBED_BOOT_STACK_SIZE 0x400
28+
#endif
29+
30+
#define Stack_Size MBED_BOOT_STACK_SIZE
31+
2632
LR_IROM1 MBED_APP_START MBED_APP_SIZE
2733
{
2834
ER_IROM1 MBED_APP_START MBED_APP_SIZE
@@ -32,8 +38,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE
3238
.ANY (+RO)
3339
}
3440

35-
RW_IRAM1 0x200002D8 (0x10000 - 0x2D8)
41+
RW_IRAM1 0x200002D8 (0x10000 - 0x2D8 - Stack_Size)
3642
{
3743
.ANY (+RW, +ZI)
3844
}
45+
46+
ARM_LIB_STACK (0x200002D8+0x10000) EMPTY -Stack_Size { ; stack
47+
}
3948
}

targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/device/TOOLCHAIN_GCC_ARM/tmpm3hqfdfg.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
#define MBED_APP_SIZE 512K
99
#endif
1010

11+
#if !defined(MBED_BOOT_STACK_SIZE)
12+
#define MBED_BOOT_STACK_SIZE 0x400
13+
#endif
14+
15+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
16+
1117
/* Linker script to configure memory regions. */
1218
MEMORY
1319
{
@@ -162,7 +168,7 @@ SECTIONS
162168
/* Set stack top to end of RAM, and stack limit move down by
163169
* size of stack_dummy section */
164170
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
165-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
171+
__StackLimit = __StackTop - STACK_SIZE;
166172
PROVIDE(__stack = __StackTop);
167173

168174
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_TOSHIBA/TARGET_TMPM3HQ/device/TOOLCHAIN_IAR/tmpm3hqfdfg.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
1313
define symbol __ICFEDIT_region_RAM_start__ = 0x200002D8;
1414
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
1515
/*Heap 1/4 of ram and stack 1/8*/
16-
define symbol __ICFEDIT_size_cstack__ = 0x400;
16+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
17+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
18+
}
19+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1720
define symbol __ICFEDIT_size_heap__ = 0x2000;
1821
/**** End of ICF editor section. ###ICF###*/
1922

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/TOOLCHAIN_ARM_STD/tmpm46bf10fg.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#define MBED_APP_SIZE 0x100000
2323
#endif
2424

25+
#if !defined(MBED_BOOT_STACK_SIZE)
26+
#define MBED_BOOT_STACK_SIZE 0x400
27+
#endif
28+
29+
#define Stack_Size MBED_BOOT_STACK_SIZE
30+
2531
; TMPM46B: 1024 KB FLASH (0x100000) + 512 KB SRAM (0x80000)
2632

2733
LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
@@ -33,9 +39,12 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
3339
.ANY (+RO)
3440
}
3541

36-
RW_IRAM1 0x200001E0 (0x80000 - 0x1E0)
42+
RW_IRAM1 0x200001E0 (0x80000 - 0x1E0 - Stack_Size)
3743
{
3844
tmpm46b_fc.o(+RO)
3945
.ANY (+RW, +ZI)
4046
}
47+
48+
ARM_LIB_STACK (0x200001E0+0x80000) EMPTY -Stack_Size { ; stack
49+
}
4150
}

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/TOOLCHAIN_GCC_ARM/tmpm46bf10fg.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
/* Linker script for Toshiba TMPM46B */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x400
5+
#endif
6+
7+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
8+
39
/* Linker script to configure memory regions. */
410

511
#if !defined(MBED_APP_START)
@@ -199,7 +205,7 @@ SECTIONS
199205
/* Set stack top to end of RAM, and stack limit move down by
200206
* size of stack_dummy section */
201207
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
202-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
208+
__StackLimit = __StackTop - STACK_SIZE;
203209
PROVIDE(__stack = __StackTop);
204210

205211
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/TOOLCHAIN_IAR/tmpm46bf10fg.icf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ define symbol __ICFEDIT_region_RAM_end__ = 0x2006FFFF;
1313
define symbol __ICFEDIT_region_BRAM_start__ = 0x20070000;
1414
define symbol __ICFEDIT_region_BRAM_end__ = 0x200807FF;
1515
/*-Sizes-*/
16-
/*Heap 1/4 of ram and stack 1/8*/
17-
define symbol __ICFEDIT_size_cstack__ = 0x10000;
16+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
17+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
18+
}
19+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1820
define symbol __ICFEDIT_size_heap__ = 0x20000;
1921
/**** End of ICF editor section. ###ICF###*/
2022

targets/TARGET_TOSHIBA/TARGET_TMPM4G9/device/TOOLCHAIN_ARM_STD/tmpm4g9f15.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
#define MBED_APP_SIZE 0x000180000
2323
#endif
2424

25+
#if !defined(MBED_BOOT_STACK_SIZE)
26+
#define MBED_BOOT_STACK_SIZE 0x400
27+
#endif
28+
29+
#define Stack_Size MBED_BOOT_STACK_SIZE
30+
2531
; TMPM4G9: 1536 KB FLASH (0x180000) + 192 KB SRAM (0x30000)
2632

2733
LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
@@ -33,9 +39,12 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
3339
.ANY (+RO)
3440
}
3541

36-
RW_IRAM1 0x20000320 (0x30000 - 0x320)
42+
RW_IRAM1 0x20000320 (0x30000 - 0x320 - -Stack_Size)
3743
{
3844
tmpm4g9_fc.o (+RO)
3945
.ANY (+RW, +ZI)
4046
}
47+
48+
ARM_LIB_STACK (0x20000320+0x30000) EMPTY -Stack_Size { ; stack
49+
}
4150
}

targets/TARGET_TOSHIBA/TARGET_TMPM4G9/device/TOOLCHAIN_GCC_ARM/tmpm4g9f15fg.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@
1010
#define MBED_APP_SIZE 0x180000
1111
#endif
1212

13+
#if !defined(MBED_BOOT_STACK_SIZE)
14+
#define MBED_BOOT_STACK_SIZE 0x400
15+
#endif
16+
17+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
18+
1319
MEMORY
1420
{
1521
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
@@ -199,7 +205,7 @@ SECTIONS
199205
/* Set stack top to end of RAM, and stack limit move down by
200206
* size of stack_dummy section */
201207
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
202-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
208+
__StackLimit = __StackTop - STACK_SIZE;
203209
PROVIDE(__stack = __StackTop);
204210

205211
/* Check if data + heap + stack exceeds RAM limit */

targets/TARGET_TOSHIBA/TARGET_TMPM4G9/device/TOOLCHAIN_IAR/tmpm4g9f15.icf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;
1313
define symbol __ICFEDIT_region_BRAM_start__ = 0x20030000;
1414
define symbol __ICFEDIT_region_BRAM_end__ = 0x200307FF;
1515
/*-Sizes-*/
16-
/*Heap 1/4 of ram and stack 1/8*/
17-
define symbol __ICFEDIT_size_cstack__ = 0x0400;
16+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
17+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
18+
}
19+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1820
define symbol __ICFEDIT_size_heap__ = 0x6000;
1921
/**** End of ICF editor section. ###ICF###*/
2022

0 commit comments

Comments
 (0)