Skip to content

Commit eb31883

Browse files
committed
TARGET_TOSHIBA: ISR stack size unification
Unify ISR stack size for targets which support MBED 5 (or MBED 2 and MBED 5). MBED 5 : 3 boards ---------------- TMPM3H6 TMPM46B TMPM066 MBED 2, 5 : 0 boards ---------------- MBED 2 : 0 boards (skipped) ----------------
1 parent d2cf36f commit eb31883

File tree

12 files changed

+76
-40
lines changed

12 files changed

+76
-40
lines changed

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

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

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

1416
;; Compatible with ISSM model
1517

18+
#if (defined(__stack_size__))
19+
#define Stack_Size __stack_size__
20+
#else
21+
#if (defined(MBED_CONF_RTOS_PRESENT))
22+
#define Stack_Size 0x0400
23+
#else
24+
#define Stack_Size 0x1000
25+
#endif
26+
#endif
27+
1628
LR_IROM1 0x00000000 0x20000
1729
{
1830
ER_IROM1 0x00000000 0x20000
@@ -25,8 +37,11 @@ LR_IROM1 0x00000000 0x20000
2537
}
2638

2739
/* 8_byte_aligned(32 + 16 vect * 4 bytes) = 8_byte_aligned(0xC0) */
28-
RW_IRAM1 0x200000C0 (0x4000 - 0xC0)
40+
RW_IRAM1 0x200000C0 (0x4000 - 0xC0 - Stack_Size)
2941
{
3042
.ANY (+RW, +ZI)
3143
}
44+
45+
ARM_LIB_STACK 0x200000C0+0x4000 EMPTY -Stack_Size { ; Stack region growing down
46+
}
3247
}

targets/TARGET_TOSHIBA/TARGET_TMPM066/device/TOOLCHAIN_GCC_ARM/startup_TMPM066.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@
2626
.section .stack
2727
.align 3
2828
#ifdef __STACK_SIZE
29-
.equ Stack_Size, __STACK_SIZE
29+
.equ Stack_Size, __STACK_SIZE
3030
#else
31-
.equ Stack_Size, 0x400
31+
#if defined(MBED_CONF_RTOS_PRESENT)
32+
.equ Stack_Size, 0x400
33+
#else
34+
.equ Stack_Size, 0x1000
35+
#endif
3236
#endif
3337
.globl __StackTop
3438
.globl __StackLimit
3539
__StackLimit:
36-
.space Stack_Size
40+
.globl Stack_Size
3741
.size __StackLimit, . - __StackLimit
3842
__StackTop:
3943
.size __StackTop, . - __StackTop

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ SECTIONS
128128
__end__ = .;
129129
end = __end__;
130130
*(.heap*)
131+
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
131132
__HeapLimit = .;
132133
} > RAM
133134

@@ -137,12 +138,13 @@ SECTIONS
137138
.stack_dummy :
138139
{
139140
*(.stack)
141+
. += Stack_Size;
140142
} > RAM
141143

142144
/* Set stack top to end of RAM, and stack limit move down by
143145
* size of stack_dummy section */
144146
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
145-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
147+
__StackLimit = __StackTop - Stack_Size;
146148
PROVIDE(__stack = __StackTop);
147149

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

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ 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__ = 0x200;
12+
define symbol __ICFEDIT_size_cstack__ = 0x400;
1313
define symbol __ICFEDIT_size_heap__ = 0x1400;
1414
/**** End of ICF editor section. ###ICF###*/
1515

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
#include "mbed_config.h"
13
;; TMPM3H6FWFG scatter file
24

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

1416
;; Compatible with ISSM model
1517

18+
#if (defined(__stack_size__))
19+
#define Stack_Size __stack_size__
20+
#else
21+
#if (defined(MBED_CONF_RTOS_PRESENT))
22+
#define Stack_Size 0x0400
23+
#else
24+
#define Stack_Size 0x1000
25+
#endif
26+
#endif
27+
1628
LR_IROM1 0x00000000 0x20000
1729
{
1830
ER_IROM1 0x00000000 0x20000
@@ -26,4 +38,6 @@ LR_IROM1 0x00000000 0x20000
2638
{
2739
.ANY (+RW, +ZI)
2840
}
41+
ARM_LIB_STACK 0x20000000+0x4000 EMPTY -Stack_Size { ; Stack region growing down
42+
}
2943
}

targets/TARGET_TOSHIBA/TARGET_TMPM3H6/device/TOOLCHAIN_GCC_ARM/startup_TMPM3H6.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@
2424
*/
2525

2626
#ifdef __STACK_SIZE
27-
.equ Stack_Size, __STACK_SIZE
27+
.equ Stack_Size, __STACK_SIZE
2828
#else
29-
.equ Stack_Size, 0x400
29+
#if defined(MBED_CONF_RTOS_PRESENT)
30+
.equ Stack_Size, 0x400
31+
#else
32+
.equ Stack_Size, 0x1000
33+
#endif
3034
#endif
3135
.globl __StackTop
3236
.globl __StackLimit
3337
__StackLimit:
34-
.space Stack_Size
38+
.globl Stack_Size
3539
.size __StackLimit, . - __StackLimit
3640
__StackTop:
3741
.size __StackTop, . - __StackTop

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ SECTIONS
140140
__end__ = .;
141141
end = __end__;
142142
KEEP(*(.heap*))
143+
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
143144
__HeapLimit = .;
144145
} > RAM
145146

@@ -149,12 +150,13 @@ SECTIONS
149150
.stack_dummy (COPY):
150151
{
151152
KEEP(*(.stack*))
153+
. += Stack_Size;
152154
} > RAM
153155

154156
/* Set stack top to end of RAM, and stack limit move down by
155157
* size of stack_dummy section */
156158
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
157-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
159+
__StackLimit = __StackTop - Stack_Size;
158160
PROVIDE(__stack = __StackTop);
159161

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

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! armcc -E -I. --cpu Cortex-M4
2+
#include "mbed_config.h"
23
;; TMPM46BF10 scatter file
34

45
;; Vector table starts at 0
@@ -14,6 +15,16 @@
1415

1516
;; Compatible with ISSM model
1617

18+
#if (defined(__stack_size__))
19+
#define Stack_Size __stack_size__
20+
#else
21+
#if (defined(MBED_CONF_RTOS_PRESENT))
22+
#define Stack_Size 0x0400
23+
#else
24+
#define Stack_Size 0x1000
25+
#endif
26+
#endif
27+
1728
#if !defined(MBED_APP_START)
1829
#define MBED_APP_START 0x00000000
1930
#endif
@@ -38,4 +49,7 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE ; load region size_region
3849
tmpm46b_fc.o(+RO)
3950
.ANY (+RW, +ZI)
4051
}
52+
53+
ARM_LIB_STACK 0x200001E0+0x80000 EMPTY -Stack_Size { ; Stack region growing down
54+
}
4155
}

targets/TARGET_TOSHIBA/TARGET_TMPM46B/device/TOOLCHAIN_GCC_ARM/startup_TMPM46b.S

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,18 @@
2424
*/
2525

2626
#ifdef __STACK_SIZE
27-
.equ Stack_Size, __STACK_SIZE
27+
.equ Stack_Size, __STACK_SIZE
2828
#else
29-
.equ Stack_Size, 0x400
29+
#if defined(MBED_CONF_RTOS_PRESENT)
30+
.equ Stack_Size, 0x400
31+
#else
32+
.equ Stack_Size, 0x1000
33+
#endif
3034
#endif
3135
.globl __StackTop
3236
.globl __StackLimit
3337
__StackLimit:
34-
.space Stack_Size
38+
.globl Stack_Size
3539
.size __StackLimit, . - __StackLimit
3640
__StackTop:
3741
.size __StackTop, . - __StackTop

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ SECTIONS
185185
__end__ = .;
186186
end = __end__;
187187
KEEP(*(.heap*))
188+
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
188189
__HeapLimit = .;
189190
} > RAM
190191

@@ -194,12 +195,13 @@ SECTIONS
194195
.stack_dummy (COPY):
195196
{
196197
KEEP(*(.stack*))
198+
. += Stack_Size;
197199
} > RAM
198200

199201
/* Set stack top to end of RAM, and stack limit move down by
200202
* size of stack_dummy section */
201203
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
202-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
204+
__StackLimit = __StackTop - Stack_Size;
203205
PROVIDE(__stack = __StackTop);
204206

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

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ 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+
define symbol __ICFEDIT_size_cstack__ = 0x400;
1817
define symbol __ICFEDIT_size_heap__ = 0x20000;
1918
/**** End of ICF editor section. ###ICF###*/
2019

targets/TARGET_TOSHIBA/mbed_rtx.h

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,4 @@
1717
#ifndef MBED_MBED_RTX_H
1818
#define MBED_MBED_RTX_H
1919

20-
#if defined(TARGET_TMPM066)
21-
22-
#ifndef INITIAL_SP
23-
#define INITIAL_SP (0x20004000UL)
24-
#endif
25-
26-
#endif
27-
28-
#if defined(TARGET_TMPM46B)
29-
30-
#ifndef INITIAL_SP
31-
#define INITIAL_SP (0x20080000UL)
32-
#endif
33-
34-
#endif
35-
36-
#if defined(TARGET_TMPM3H6)
37-
38-
#ifndef INITIAL_SP
39-
#define INITIAL_SP (0x20004000UL)
40-
#endif
41-
42-
#endif
43-
4420
#endif // MBED_MBED_RTX_H

0 commit comments

Comments
 (0)