Support boot stack size configuration option

pull/9203/head
c_jin 2019-01-11 18:04:56 +08:00
parent 75d4705d60
commit 4d9c4343a0
3 changed files with 18 additions and 3 deletions

View File

@ -11,6 +11,12 @@
#define MBED_APP_SIZE 0x20000
#endif
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
#define Stack_Size MBED_BOOT_STACK_SIZE
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (1024K)
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@ -20,8 +26,11 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (1024K)
}
; 84 vectors (16 core + 68 peripheral) * 4 bytes = 336 bytes to reserve (0x150)
RW_IRAM1 (0x20000000+0x150) (0x8000-0x150) { ; RW data
RW_IRAM1 (0x20000000+0x150) (0x8000-0x150-Stack_Size) { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK 0x20000000+0x8000 EMPTY -Stack_Size { ; Stack region growing down
}
}

View File

@ -6,6 +6,10 @@
#define MBED_APP_SIZE 128K
#endif
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
/* specify memory regions */
MEMORY
{
@ -112,6 +116,7 @@ SECTIONS
__end__ = .;
end = __end__;
*(.heap*)
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
__HeapLimit = .;
} > RAM
@ -123,7 +128,7 @@ SECTIONS
/* initializes stack on the end of block */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
_estack = __StackTop;
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
PROVIDE(__stack = __StackTop);
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")

View File

@ -4,6 +4,7 @@
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x20000; }
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) { define symbol MBED_BOOT_STACK_SIZE = 0x400; }
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
/*-Memory Regions-*/
@ -15,7 +16,7 @@ define symbol __ICFEDIT_region_RAM_start__ = 0x20000150;
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0x1000;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x2000;
/**** End of ICF editor section. ###ICF###*/