Skip to content

Commit 888f49d

Browse files
committed
[NORDIC] Support boot stack size configuration option
1 parent 4a113d2 commit 888f49d

File tree

24 files changed

+122
-44
lines changed

24 files changed

+122
-44
lines changed

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NORDIC_32K/nRF51822.sct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;WITHOUT SOFTDEVICE:
24
;LR_IROM1 0x00000000 0x00040000 {
35
; ER_IROM1 0x00000000 0x00040000 {
@@ -12,6 +14,8 @@
1214
;
1315
;WITH SOFTDEVICE:
1416

17+
#define Stack_Size MBED_BOOT_STACK_SIZE
18+
1519
LR_IROM1 0x1C000 0x0024000 {
1620
ER_IROM1 0x1C000 0x0024000 {
1721
*.o (RESET, +First)
@@ -21,4 +25,6 @@ LR_IROM1 0x1C000 0x0024000 {
2125
RW_IRAM1 0x20002800 0x00005800 {
2226
.ANY (+RW +ZI)
2327
}
28+
ARM_LIB_STACK 0x20002800+0x00005800 EMPTY -Stack_Size { ; Stack region growing down
29+
}
2430
}

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NRF51_16K_S110/nRF51822.sct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;WITHOUT SOFTDEVICE:
24
;LR_IROM1 0x00000000 0x00040000 {
35
; ER_IROM1 0x00000000 0x00040000 {
@@ -12,6 +14,8 @@
1214
;
1315
;WITH SOFTDEVICE:
1416

17+
#define Stack_Size MBED_BOOT_STACK_SIZE
18+
1519
LR_IROM1 0x18000 0x0028000 {
1620
ER_IROM1 0x18000 0x0028000 {
1721
*.o (RESET, +First)
@@ -21,4 +25,6 @@ LR_IROM1 0x18000 0x0028000 {
2125
RW_IRAM1 0x20002000 0x00002000 {
2226
.ANY (+RW +ZI)
2327
}
28+
ARM_LIB_STACK 0x20002000+0x00002000 EMPTY -Stack_Size { ; Stack region growing down
29+
}
2430
}

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NRF51_16K_S130/nRF51822.sct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;WITHOUT SOFTDEVICE:
24
;LR_IROM1 0x00000000 0x00040000 {
35
; ER_IROM1 0x00000000 0x00040000 {
@@ -12,6 +14,8 @@
1214
;
1315
;WITH SOFTDEVICE:
1416

17+
#define Stack_Size MBED_BOOT_STACK_SIZE
18+
1519
LR_IROM1 0x1C000 0x0024000 {
1620
ER_IROM1 0x1C000 0x0024000 {
1721
*.o (RESET, +First)
@@ -21,4 +25,6 @@ LR_IROM1 0x1C000 0x0024000 {
2125
RW_IRAM1 0x20002800 0x00001800 {
2226
.ANY (+RW +ZI)
2327
}
28+
ARM_LIB_STACK 0x20002800+0x00001800 EMPTY -Stack_Size { ; Stack region growing down
29+
}
2430
}

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_GCC_ARM/TARGET_MCU_NORDIC_32K/NRF51822.ld

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* Linker script to configure memory regions. */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x800
5+
#endif
6+
37
MEMORY
48
{
59
FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
@@ -130,7 +134,7 @@ SECTIONS
130134
end = __end__;
131135
__HeapBase = .;
132136
*(.heap*)
133-
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
137+
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
134138
__HeapLimit = .;
135139
} > RAM
136140

@@ -145,7 +149,7 @@ SECTIONS
145149
/* Set stack top to end of RAM, and stack limit move down by
146150
* size of stack_dummy section */
147151
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
152+
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
149153
PROVIDE(__stack = __StackTop);
150154

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

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_GCC_ARM/TARGET_MCU_NRF51_16K_S110/NRF51822.ld

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* Linker script to configure memory regions. */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x800
5+
#endif
6+
37
MEMORY
48
{
59
FLASH (rx) : ORIGIN = 0x00018000, LENGTH = 0x28000
@@ -130,7 +134,7 @@ SECTIONS
130134
end = __end__;
131135
__HeapBase = .;
132136
*(.heap*)
133-
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
137+
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
134138
__HeapLimit = .;
135139
} > RAM
136140

@@ -145,7 +149,7 @@ SECTIONS
145149
/* Set stack top to end of RAM, and stack limit move down by
146150
* size of stack_dummy section */
147151
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
152+
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
149153
PROVIDE(__stack = __StackTop);
150154

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

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_GCC_ARM/TARGET_MCU_NRF51_16K_S130/NRF51822.ld

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
/* Linker script to configure memory regions. */
22

3+
#if !defined(MBED_BOOT_STACK_SIZE)
4+
#define MBED_BOOT_STACK_SIZE 0x800
5+
#endif
6+
37
MEMORY
48
{
59
FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
@@ -130,7 +134,7 @@ SECTIONS
130134
end = __end__;
131135
__HeapBase = .;
132136
*(.heap*)
133-
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
137+
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
134138
__HeapLimit = .;
135139
} > RAM
136140

@@ -145,7 +149,7 @@ SECTIONS
145149
/* Set stack top to end of RAM, and stack limit move down by
146150
* size of stack_dummy section */
147151
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
148-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
152+
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
149153
PROVIDE(__stack = __StackTop);
150154

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

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_GCC_ARM/startup_NRF51822.S

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,9 @@ expected to be copied into the application project folder prior to its use!
3838

3939
.section .stack
4040
.align 3
41-
#ifdef __STACK_SIZE
42-
.equ Stack_Size, __STACK_SIZE
43-
#else
44-
.equ Stack_Size, 2048
45-
#endif
46-
.globl Stack_Size
4741
.globl __StackTop
4842
.globl __StackLimit
4943
__StackLimit:
50-
.space Stack_Size
5144
.size __StackLimit, . - __StackLimit
5245
__StackTop:
5346
.size __StackTop, . - __StackTop

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_IAR/TARGET_MCU_NORDIC_16K/nRF51822_QFAA.icf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
44
/*-Specials-*/
55
define symbol __ICFEDIT_intvec_start__ = 0x00016000;
6+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
7+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
8+
}
69
/*-Memory Regions-*/
710
define symbol __ICFEDIT_region_ROM_start__ = 0x000160c0;
811
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
912
define symbol __ICFEDIT_region_RAM_start__ = 0x20002000;
1013
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
1114
/*-Sizes-*/
12-
define symbol __ICFEDIT_size_cstack__ = 0x400;
15+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1316
define symbol __ICFEDIT_size_heap__ = 0x900;
1417
/**** End of ICF editor section. ###ICF###*/
1518

targets/TARGET_NORDIC/TARGET_MCU_NRF51822/device/TOOLCHAIN_IAR/TARGET_MCU_NORDIC_32K/nRF51822_QFAA.icf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
44
/*-Specials-*/
55
define symbol __ICFEDIT_intvec_start__ = 0x00016000;
6+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
7+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
8+
}
69
/*-Memory Regions-*/
710
define symbol __ICFEDIT_region_ROM_start__ = 0x000160c0;
811
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
912
define symbol __ICFEDIT_region_RAM_start__ = 0x20002000;
1013
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
1114
/*-Sizes-*/
12-
/*Heap 1/4 of ram and stack 1/8*/
13-
define symbol __ICFEDIT_size_cstack__ = 0xc00;
15+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1416
define symbol __ICFEDIT_size_heap__ = 0x1800;
1517
/**** End of ICF editor section. ###ICF###*/
1618

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF51/TARGET_MCU_NRF51822_UNIFIED/device/TOOLCHAIN_ARM_STD/TARGET_MCU_NORDIC_32K/nRF51822.sct

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#! armcc -E
2+
13
;WITHOUT SOFTDEVICE:
24
;LR_IROM1 0x00000000 0x00040000 {
35
; ER_IROM1 0x00000000 0x00040000 {
@@ -12,6 +14,8 @@
1214
;
1315
;WITH SOFTDEVICE:
1416

17+
#define Stack_Size MBED_BOOT_STACK_SIZE
18+
1519
LR_IROM1 0x1B000 0x0025000 {
1620
ER_IROM1 0x1B000 0x0025000 {
1721
*.o (RESET, +First)
@@ -24,4 +28,6 @@ LR_IROM1 0x1B000 0x0025000 {
2428
RW_IRAM1 0x20002FB8 0x00005048 {
2529
.ANY (+RW +ZI)
2630
}
31+
ARM_LIB_STACK 0x20002FB8+0x00005048 EMPTY -Stack_Size { ; Stack region growing down
32+
}
2733
}

0 commit comments

Comments
 (0)