[GigaDevice] Support boot stack size configuration option

pull/9092/head
Przemyslaw Stekiel 2018-12-21 14:03:57 +01:00
parent 888f49dade
commit 4ee9378297
3 changed files with 22 additions and 4 deletions

View File

@ -11,6 +11,12 @@
#define MBED_APP_SIZE 0x100000
#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) (0x18000-0x150) { ; RW data
RW_IRAM1 (0x20000000+0x150) (0x18000-0x150-Stack_Size) { ; RW data
.ANY (+RW +ZI)
}
ARM_LIB_STACK (0x20000000+0x18000) EMPTY -Stack_Size { ; stack
}
}

View File

@ -1,3 +1,9 @@
#if !defined(MBED_BOOT_STACK_SIZE)
#define MBED_BOOT_STACK_SIZE 0x400
#endif
STACK_SIZE = MBED_BOOT_STACK_SIZE;
/* specify memory regions */
MEMORY
{
@ -115,7 +121,7 @@ SECTIONS
/* initializes stack on the end of block */
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
_estack = __StackTop;
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
__StackLimit = __StackTop - STACK_SIZE;
PROVIDE(__stack = __StackTop);
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")

View File

@ -6,6 +6,9 @@ if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x0800000
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; }
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
define symbol MBED_BOOT_STACK_SIZE = 0x400;
}
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
@ -13,9 +16,9 @@ define symbol __ICFEDIT_region_NVIC_start__ = 0x20000000;
define symbol __ICFEDIT_region_NVIC_end__ = 0x2000014F;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000150;
define symbol __ICFEDIT_region_RAM_end__ = 0x20017FFF;
/*-Sizes-*/
/*Heap 1/4 of ram and stack 1/8*/
define symbol __ICFEDIT_size_cstack__ = 0x3000;
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
define symbol __ICFEDIT_size_heap__ = 0x6000;
/**** End of ICF editor section. ###ICF###*/