Skip to content

Commit 4ee9378

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

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

targets/TARGET_GigaDevice/TARGET_GD32F30X/TARGET_GD32F307VG/device/TOOLCHAIN_ARM_STD/gd32f307vg.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
#define MBED_APP_SIZE 0x100000
1212
#endif
1313

14+
#if !defined(MBED_BOOT_STACK_SIZE)
15+
#define MBED_BOOT_STACK_SIZE 0x400
16+
#endif
17+
18+
#define Stack_Size MBED_BOOT_STACK_SIZE
19+
1420
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (1024K)
1521

1622
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)
2026
}
2127

2228
; 84 vectors (16 core + 68 peripheral) * 4 bytes = 336 bytes to reserve (0x150)
23-
RW_IRAM1 (0x20000000+0x150) (0x18000-0x150) { ; RW data
29+
RW_IRAM1 (0x20000000+0x150) (0x18000-0x150-Stack_Size) { ; RW data
2430
.ANY (+RW +ZI)
2531
}
32+
33+
ARM_LIB_STACK (0x20000000+0x18000) EMPTY -Stack_Size { ; stack
34+
}
2635
}
2736

targets/TARGET_GigaDevice/TARGET_GD32F30X/TARGET_GD32F307VG/device/TOOLCHAIN_GCC_ARM/GD32F307xG.ld

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#if !defined(MBED_BOOT_STACK_SIZE)
2+
#define MBED_BOOT_STACK_SIZE 0x400
3+
#endif
4+
5+
STACK_SIZE = MBED_BOOT_STACK_SIZE;
6+
17
/* specify memory regions */
28
MEMORY
39
{
@@ -115,7 +121,7 @@ SECTIONS
115121
/* initializes stack on the end of block */
116122
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
117123
_estack = __StackTop;
118-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
124+
__StackLimit = __StackTop - STACK_SIZE;
119125
PROVIDE(__stack = __StackTop);
120126

121127
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")

targets/TARGET_GigaDevice/TARGET_GD32F30X/TARGET_GD32F307VG/device/TOOLCHAIN_IAR/gd32f307vg.icf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,19 @@ if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x0800000
66
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; }
77
/*-Specials-*/
88
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
9+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) {
10+
define symbol MBED_BOOT_STACK_SIZE = 0x400;
11+
}
912
/*-Memory Regions-*/
1013
define symbol __ICFEDIT_region_ROM_start__ = MBED_APP_START;
1114
define symbol __ICFEDIT_region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
1215
define symbol __ICFEDIT_region_NVIC_start__ = 0x20000000;
1316
define symbol __ICFEDIT_region_NVIC_end__ = 0x2000014F;
1417
define symbol __ICFEDIT_region_RAM_start__ = 0x20000150;
1518
define symbol __ICFEDIT_region_RAM_end__ = 0x20017FFF;
19+
1620
/*-Sizes-*/
17-
/*Heap 1/4 of ram and stack 1/8*/
18-
define symbol __ICFEDIT_size_cstack__ = 0x3000;
21+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
1922
define symbol __ICFEDIT_size_heap__ = 0x6000;
2023
/**** End of ICF editor section. ###ICF###*/
2124

0 commit comments

Comments
 (0)