Skip to content

Commit af20945

Browse files
committed
TARGET_Analog_Devices: ISR stack size unification
Unify ISR stack size for targets which support MBED 5 (or MBED 2 and MBED 5). MBED 5 : 2 boards ---------------- EV_COG_AD4050LZ EV_COG_AD3029LZ MBED 2, 5 : 0 boards ---------------- MBED 2 : 0 boards (skipped) ----------------
1 parent 543b86a commit af20945

File tree

9 files changed

+63
-29
lines changed

9 files changed

+63
-29
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,16 @@ const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) =
145145
ADUCM3029_VECTORS
146146
};
147147

148+
#ifdef __STACK_SIZE
149+
unsigned int Stack_Size = __STACK_SIZE;
150+
#else
151+
#if defined(MBED_CONF_RTOS_PRESENT)
152+
unsigned int Stack_Size = 0x400;
153+
#else
154+
unsigned int Stack_Size = 0x1000;
155+
#endif
156+
#endif
157+
148158
/*----------------------------------------------------------------------------
149159
* Initialize .bss and .data for GNU
150160
*----------------------------------------------------------------------------*/

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_ARM_STD/ADuCM3029.sct

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#! armcc -E
2+
#include "mbed_config.h"
3+
24
;******************************************************************************
35
; File: ADuCM3029.sct
46
; Scatter loading file for Analog Devices ADuCM3029 processor
@@ -45,6 +47,16 @@
4547

4648
#define ADUCM_VECTOR_SIZE 0x1A0
4749

50+
#if (defined(__stack_size__))
51+
#define Stack_Size __stack_size__
52+
#else
53+
#if (defined(MBED_CONF_RTOS_PRESENT))
54+
#define Stack_Size 0x0400
55+
#else
56+
#define Stack_Size 0x1000
57+
#endif
58+
#endif
59+
4860
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
4961
FLASH0 MBED_APP_START ADUCM_VECTOR_SIZE {
5062
*(.vectors, +First)
@@ -63,11 +75,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
6375
.ANY (+RW)
6476
}
6577

66-
ADUCM_HEAP AlignExpr(+0, 16) EMPTY
67-
(0x20003000 - AlignExpr(ImageLimit(RW_IRAM1), 16)) { ; heap
78+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY
79+
(0x20003000 - AlignExpr(ImageLimit(RW_IRAM1), 16) - Stack_Size) { ; heap
6880
}
6981

70-
ADUCM_STACK AlignExpr(+0, 16) EMPTY 0x1000 { ; stack
82+
ARM_LIB_STACK AlignExpr(+0, 16) EMPTY Stack_Size { ; stack
7183
}
7284

7385
ADUCM_IRAM2 0x20004000 0x4000 { ; bss section

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_GCC_ARM/ADuCM3029.ld

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ MEMORY
3232

3333
/* Library configurations */
3434
GROUP(libgcc.a libc.a libm.a libnosys.a)
35-
/* Custom stack and heap sizes */
36-
__stack_size__ = 0x1000;
37-
__heap_size__ = 0x2000;
38-
39-
/* select custom or default sizes for stack and heap */
40-
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
41-
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0C00;
4235

4336
/* Linker script to place sections and symbol values.
4437
* It references the following symbols, which must be defined in code:
@@ -220,14 +213,14 @@ SECTIONS
220213
__HeapBase = .;
221214
__end__ = .;
222215
end = __end__;
223-
. += HEAP_SIZE;
216+
. = ORIGIN(DSRAM_A) + LENGTH(DSRAM_A) - Stack_Size;
224217
__HeapLimit = .;
225218
} > DSRAM_A
226219

227220
/* Set stack top to end of DSRAM_A, and move stack limit down by
228221
* size of stack_dummy section */
229222
__StackTop = ORIGIN(DSRAM_C);
230-
__StackLimit = __StackTop - STACK_SIZE;
223+
__StackLimit = __StackTop - Stack_Size;
231224
PROVIDE(__stack = __StackTop);
232225

233226
/* Check if data + heap + stack exceeds DSRAM_A limit when they are both in DSRAM_A

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/TOOLCHAIN_IAR/ADuCM3029.icf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define region ROM_REGION = mem:[from MBED_APP_START+ADUCM_SECTO
4949
define region RAM_bank1_region = mem:[from 0x20000200 size 0x00003E00];
5050
define region RAM_bank2_region = mem:[from 0x20004000 size 0x00004000]
5151
| mem:[from 0x20040000 size 0x00007000];
52-
define block CSTACK with alignment = 16, size = 0x1000 { };
52+
define block CSTACK with alignment = 16, size = 0x400 { };
5353
define block HEAP with alignment = 16, size = 0x2000 { };
5454
do not initialize { section .noinit };
5555
initialize by copy { rw };

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ const pFunc SECTION_PLACE(IVT_NAME[104],VECTOR_SECTION) = {
149149
ADUCM4050_VECTORS
150150
};
151151

152+
#ifdef __STACK_SIZE
153+
unsigned int Stack_Size = __STACK_SIZE;
154+
#else
155+
#if defined(MBED_CONF_RTOS_PRESENT)
156+
unsigned int Stack_Size = 0x400;
157+
#else
158+
unsigned int Stack_Size = 0x1000;
159+
#endif
160+
#endif
161+
152162
/*----------------------------------------------------------------------------
153163
* Initialize .bss and .data for GNU
154164
*----------------------------------------------------------------------------*/

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_ARM_STD/ADuCM4050.sct

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#! armcc -E
2+
#include "mbed_config.h"
23
;******************************************************************************
34
; File: ADuCM4050.sct
45
; Scatter loading file for Analog Devices ADuCM4050 processor
@@ -42,6 +43,16 @@
4243

4344
#define ADUCM_VECTOR_SIZE 0x1A0
4445

46+
#if (defined(__stack_size__))
47+
#define Stack_Size __stack_size__
48+
#else
49+
#if (defined(MBED_CONF_RTOS_PRESENT))
50+
#define Stack_Size 0x0400
51+
#else
52+
#define Stack_Size 0x1000
53+
#endif
54+
#endif
55+
4556
LR_IROM1 MBED_APP_START MBED_APP_SIZE {
4657
FLASH0 MBED_APP_START ADUCM_VECTOR_SIZE {
4758
*(.vectors, +First)
@@ -62,6 +73,9 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
6273

6374
ADUCM_IRAM3 0x20048000 0x10000 { *(+ZI) }
6475

65-
ADUCM_HEAP AlignExpr(ImageLimit(RW_IRAM1), 16) EMPTY
66-
(ImageBase(ADUCM_IRAM3) - 0x2000 - AlignExpr(ImageLimit(RW_IRAM1), 16)) { } ; heap
76+
ARM_LIB_HEAP AlignExpr(ImageLimit(RW_IRAM1), 16) EMPTY
77+
(ImageBase(ADUCM_IRAM3) - Stack_Size - AlignExpr(ImageLimit(RW_IRAM1), 16)) { } ; heap
78+
79+
ARM_LIB_STACK AlignExpr(+0, 16) EMPTY Stack_Size { ; stack
80+
}
6781
}

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_GCC_ARM/ADuCM4050.ld

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ MEMORY
3333
/* Library configurations */
3434
GROUP(libgcc.a libc.a libm.a libnosys.a)
3535

36-
/* Custom stack and heap sizes */
37-
__stack_size__ = 0x2000;
38-
__heap_size__ = 0x6000;
39-
40-
/* select custom or default sizes for stack and heap */
41-
STACK_SIZE = DEFINED(__stack_size__) ? __stack_size__ : 0x0400;
42-
HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : 0x0C00;
43-
44-
4536
/* Linker script to place sections and symbol values.
4637
* It references the following symbols, which must be defined in code:
4738
* Reset_Handler : Entry of reset handler
@@ -207,10 +198,15 @@ SECTIONS
207198
__bss_end__ = .;
208199
} > DSRAM_B
209200

201+
.heap :
202+
{
203+
. = ALIGN(8);
204+
__HeapBase = .;
205+
} > DSRAM_B
206+
210207
__StackTop = ORIGIN(DSRAM_B);
211-
__StackLimit = __StackTop - STACK_SIZE;
208+
__StackLimit = __StackTop - Stack_Size;
212209
__HeapLimit = __StackLimit;
213-
__HeapBase = __HeapLimit - HEAP_SIZE;
214210
__end__ = __HeapBase;
215211
PROVIDE(end = __end__);
216212
PROVIDE(__stack = __StackTop);

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TOOLCHAIN_IAR/ADuCM4050.icf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ define region ROM_REGION = mem:[from MBED_APP_START+ADUCM_SECTO
4949
define region RAM_bank1_region = mem:[from 0x20040000 size 0x00008000];
5050
define region RAM_bank2_region = mem:[from 0x20000200 size 0x00006E00]
5151
| mem:[from 0x20048000 size 0x00010000];
52-
define block CSTACK with alignment = 16, size = 0x2000 { };
52+
define block CSTACK with alignment = 16, size = 0x400 { };
5353
define block HEAP with alignment = 16, size = 0x6000 { };
5454
do not initialize { section .noinit };
5555
initialize by copy { rw };

targets/TARGET_NXP/TARGET_LPC11U6X/device/TOOLCHAIN_IAR/TARGET_LPC11U68/LPC11U68.icf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ define symbol __ICFEDIT_region_NVIC_end__ = 0x100000FF;
1111
define symbol __ICFEDIT_region_RAM_start__ = 0x10000100;
1212
define symbol __ICFEDIT_region_RAM_end__ = 0x10007FDF;
1313
/*-Sizes-*/
14-
/*Heap 1/4 of ram and stack 1/8*/
15-
define symbol __ICFEDIT_size_cstack__ = 0x1000;
14+
define symbol __ICFEDIT_size_cstack__ = 0x400;
1615
define symbol __ICFEDIT_size_heap__ = 0x2000;
1716
/**** End of ICF editor section. ###ICF###*/
1817

0 commit comments

Comments
 (0)