[RDA] Support boot stack size configuration option

pull/9092/head
Przemyslaw Stekiel 2018-12-18 08:48:32 +01:00
parent c5a67c9267
commit 36ff05345e
3 changed files with 21 additions and 5 deletions

View File

@ -27,6 +27,12 @@
#define RDA_AHB1_BASE (0x40100000)
#define RDA_MEMC_BASE (RDA_AHB1_BASE + 0x00000)
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
#define Stack_Size MBED_BOOT_STACK_SIZE
; max code size: RDA_CODE_SIZE
LR_IROM1 RDA_CODE_BASE RDA_CODE_SIZE { ; load region size_region
ER_IROM0 RDA_CODE_BASE RDA_CODE_SIZE { ; load address = execution address
@ -37,11 +43,11 @@ LR_IROM1 RDA_CODE_BASE RDA_CODE_SIZE { ; load region size_region
; 8_byte_aligned(31 vect * 4 bytes) = 8_byte_aligned(0x7C) = 0x80
ER_IRAMVEC RDA_IRAM_BASE EMPTY 0x80 { ; Reserved for vectors
}
; IRAM Size: Total(128KB) - Vector(128B) - Stack(2KB)
RW_IRAM1 AlignExpr(+0, 8) (0x20000 - 0x80 - 0x800) {
; IRAM Size: Total(128KB) - Vector(128B) - Stack(1KB)
RW_IRAM1 AlignExpr(+0, 8) (0x20000 - 0x80 - Stack_Size) {
.ANY (+RW +ZI)
}
ARM_LIB_STACK AlignExpr(+0, 8) EMPTY (RDA_IRAM_BASE + RDA_IRAM_SIZE - AlignExpr(ImageLimit(RW_IRAM1), 8)) {
ARM_LIB_STACK AlignExpr(+0, 8) EMPTY Stack_Size {
}
ARM_LIB_HEAP RDA_DRAM_BASE EMPTY RDA_DRAM_SIZE {
}

View File

@ -1,5 +1,11 @@
/* Linker script for mbed RDA5981C */
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
STACK_SIZE = MBED_BOOT_STACK_SIZE;
/* Linker script to configure memory regions. */
MEMORY
{
@ -148,7 +154,7 @@ SECTIONS
/* Set stack top to end of IRAM, and stack limit move down by
* size of stack_dummy section */
__StackTop = ORIGIN(IRAM) + LENGTH(IRAM);
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
/* Check if data + stack exceeds RAM limit */

View File

@ -36,7 +36,11 @@ define symbol WLAN_BASE = RDA_MEMC_BASE + 0x19800;
define symbol WLAN_END = RDA_MEMC_END;
/* Stack Size & Heap Size*/
define symbol CSTACK_SIZE = 0x00400;
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
define symbol CSTACK_SIZE = MBED_BOOT_STACK_SIZE;
define symbol HEAP_SIZE = RDA_DRAM_END - RDA_DRAM_BASE + 1;
/*Memory regions*/