[NORDIC] Support boot stack size configuration option

pull/9092/head
Przemyslaw Stekiel 2018-12-21 09:00:03 +01:00
parent 4a113d2e29
commit 888f49dade
24 changed files with 122 additions and 44 deletions

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x1C000 0x0024000 {
ER_IROM1 0x1C000 0x0024000 {
*.o (RESET, +First)
@ -21,4 +25,6 @@ LR_IROM1 0x1C000 0x0024000 {
RW_IRAM1 0x20002800 0x00005800 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20002800+0x00005800 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x18000 0x0028000 {
ER_IROM1 0x18000 0x0028000 {
*.o (RESET, +First)
@ -21,4 +25,6 @@ LR_IROM1 0x18000 0x0028000 {
RW_IRAM1 0x20002000 0x00002000 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20002000+0x00002000 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x1C000 0x0024000 {
ER_IROM1 0x1C000 0x0024000 {
*.o (RESET, +First)
@ -21,4 +25,6 @@ LR_IROM1 0x1C000 0x0024000 {
RW_IRAM1 0x20002800 0x00001800 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20002800+0x00001800 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
@ -130,7 +134,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -145,7 +149,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x00018000, LENGTH = 0x28000
@ -130,7 +134,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -145,7 +149,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x0001C000, LENGTH = 0x24000
@ -130,7 +134,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -145,7 +149,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -38,16 +38,9 @@ expected to be copied into the application project folder prior to its use!
.section .stack
.align 3
#ifdef __STACK_SIZE
.equ Stack_Size, __STACK_SIZE
#else
.equ Stack_Size, 2048
#endif
.globl Stack_Size
.globl __StackTop
.globl __StackLimit
__StackLimit:
.space Stack_Size
.size __StackLimit, . - __StackLimit
__StackTop:
.size __StackTop, . - __StackTop

View File

@ -3,13 +3,16 @@
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00016000;
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x000160c0;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20002000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x400;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x900;
/**** End of ICF editor section. ###ICF###*/

View File

@ -3,14 +3,16 @@
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00016000;
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x000160c0;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20002000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0xc00;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x1800;
/**** End of ICF editor section. ###ICF###*/

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x1B000 0x0025000 {
ER_IROM1 0x1B000 0x0025000 {
*.o (RESET, +First)
@ -24,4 +28,6 @@ LR_IROM1 0x1B000 0x0025000 {
RW_IRAM1 0x20002FB8 0x00005048 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20002FB8+0x00005048 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x18000 0x0028000 {
ER_IROM1 0x18000 0x0028000 {
*.o (RESET, +First)
@ -24,4 +28,6 @@ LR_IROM1 0x18000 0x0028000 {
RW_IRAM1 0x200020C0 0x00001F40 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x200020C0+0x00001F40 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,3 +1,5 @@
#! armcc -E
;WITHOUT SOFTDEVICE:
;LR_IROM1 0x00000000 0x00040000 {
; ER_IROM1 0x00000000 0x00040000 {
@ -12,6 +14,8 @@
;
;WITH SOFTDEVICE:
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 0x0001B000 0x0025000 {
ER_IROM1 0x0001B000 0x0025000 {
*.o (RESET, +First)
@ -24,4 +28,6 @@ LR_IROM1 0x0001B000 0x0025000 {
RW_IRAM1 0x20002FB8 0x00001048 {
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20002FB8+0x00001048 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x0001B000, LENGTH = 0x25000
@ -144,7 +148,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -159,7 +163,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x00018000, LENGTH = 0x28000
@ -130,7 +134,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -145,7 +149,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -1,5 +1,9 @@
/* Linker script to configure memory regions. */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
MEMORY
{
FLASH (rx) : ORIGIN = 0x0001B000, LENGTH = 0x25000
@ -142,7 +146,7 @@ SECTIONS
end = __end__;
__HeapBase = .;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - Stack_Size;
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -157,7 +161,7 @@ SECTIONS
/* Set stack top to end of RAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + heap + stack exceeds RAM limit */

View File

@ -47,16 +47,9 @@ expected to be copied into the application project folder prior to its use!
.section .stack
.align 3
#ifdef __STACK_SIZE
.equ Stack_Size, __STACK_SIZE
#else
.equ Stack_Size, 2048
#endif
.globl Stack_Size
.globl __StackTop
.globl __StackLimit
__StackLimit:
.space Stack_Size
.size __StackLimit, . - __StackLimit
__StackTop:
.size __StackTop, . - __StackTop

View File

@ -3,6 +3,9 @@
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x0001b000;
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x0001b0c0;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
@ -11,7 +14,7 @@ define symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;
export symbol __ICFEDIT_region_RAM_start__;
export symbol __ICFEDIT_region_RAM_end__;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x900;
/**** End of ICF editor section. ###ICF###*/

View File

@ -2,6 +2,9 @@
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
define symbol __ICFEDIT_intvec_start__ = 0x0001b000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x0001b0c0;
@ -11,8 +14,7 @@ define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
export symbol __ICFEDIT_region_RAM_start__;
export symbol __ICFEDIT_region_RAM_end__;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x1800;
/**** End of ICF editor section. ###ICF###*/

View File

@ -9,6 +9,8 @@
#define MBED_APP_SIZE 0x80000
#endif
#define Stack_Size MBED_BOOT_STACK_SIZE
/* If softdevice is present, set aside space for it */
#if !defined(MBED_RAM_START)
#if defined(SOFTDEVICE_PRESENT)
@ -38,4 +40,6 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE {
.ANY (+RW +ZI)
}
ARM_LIB_STACK MBED_RAM1_START+MBED_RAM1_SIZE EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -36,6 +36,10 @@
#endif
#endif
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
#define MBED_RAM0_START MBED_RAM_START
#define MBED_RAM0_SIZE 0xE0
#define MBED_RAM1_START (MBED_RAM_START + MBED_RAM0_SIZE)
@ -232,8 +236,8 @@ SECTIONS
*(.heap*);
/* Expand the heap to reach the stack boundary. */
ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack");
. += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .;
ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE), "heap region overflowed into stack");
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
} > RAM
PROVIDE(__heap_start = ADDR(.heap));
PROVIDE(__heap_size = SIZEOF(.heap));
@ -247,12 +251,12 @@ SECTIONS
{
__StackLimit = .;
*(.stack*)
. += (ORIGIN(RAM) + LENGTH(RAM) - .);
. = ORIGIN(RAM) + LENGTH(RAM);
} > RAM
/* Set the stack top to the end of RAM and move down the stack limit by
* the size of the stack_dummy section. */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
}

View File

@ -22,6 +22,10 @@ if (!isdefinedsymbol(MBED_RAM_START)) {
}
}
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
define symbol MBED_RAM0_START = MBED_RAM_START;
define symbol MBED_RAM0_SIZE = 0xE0; /* 8-byte aligned(0xDC) = 0xE0 */
define symbol MBED_RAM1_START = (MBED_RAM_START + MBED_RAM0_SIZE);
@ -41,8 +45,7 @@ export symbol __ICFEDIT_region_RAM_start__;
export symbol __ICFEDIT_region_RAM_end__;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x5800;
/**** End of ICF editor section. ###ICF###*/

View File

@ -20,6 +20,8 @@
#endif
#endif
#define Stack_Size MBED_BOOT_STACK_SIZE
#define MBED_RAM0_START MBED_RAM_START
#define MBED_RAM0_SIZE 0x100
@ -43,4 +45,6 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE {
RW_IRAM1 MBED_RAM1_START MBED_RAM1_SIZE {
.ANY (+RW +ZI)
}
ARM_LIB_STACK MBED_RAM1_START+MBED_RAM1_SIZE EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -25,6 +25,10 @@
#define MBED_APP_SIZE 0x100000
#endif
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x800
#endif
/* If softdevice is present, set aside space for it */
#if !defined(MBED_RAM_START)
#if defined(SOFTDEVICE_PRESENT)
@ -248,8 +252,8 @@ SECTIONS
*(.heap*);
/* Expand the heap to reach the stack boundary. */
ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - 0x800), "heap region overflowed into stack");
. += (ORIGIN(RAM) + LENGTH(RAM) - 0x800) - .;
ASSERT(. <= (ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE), "heap region overflowed into stack");
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
} > RAM
PROVIDE(__heap_start = ADDR(.heap));
PROVIDE(__heap_size = SIZEOF(.heap));
@ -263,12 +267,12 @@ SECTIONS
{
__StackLimit = .;
*(.stack*)
. += (ORIGIN(RAM) + LENGTH(RAM) - .);
. = ORIGIN(RAM) + LENGTH(RAM);
} > RAM
/* Set the stack top to the end of RAM and move down the stack limit by
* the size of the stack_dummy section. */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
__StackLimit = __StackTop - SIZEOF(.stack);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
}

View File

@ -22,6 +22,10 @@ if (!isdefinedsymbol(MBED_RAM_START)) {
}
}
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
define symbol MBED_RAM0_START = MBED_RAM_START;
define symbol MBED_RAM0_SIZE = 0x100;
define symbol MBED_CRASH_REPORT_RAM_START = (MBED_RAM_START + MBED_RAM0_SIZE);
@ -45,8 +49,7 @@ export symbol __ICFEDIT_region_RAM_start__;
export symbol __ICFEDIT_region_RAM_end__;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x17800;
/**** End of ICF editor section. ###ICF###*/