Skip to content

Commit 6c7bd19

Browse files
authored
Merge pull request #9350 from mprse/adapt_linker_scripts_new_gb_targets
GD32_F450ZI: Support boot stack size configuration option
2 parents c3077d2 + 14f6cdd commit 6c7bd19

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

targets/TARGET_GigaDevice/TARGET_GD32F4XX/device/TOOLCHAIN_ARM_STD/gd32f450zi.sct

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
#define MBED_APP_SIZE 0x200000
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 (3*1024K)
1521

1622
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -20,7 +26,10 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (3*1024K)
2026
}
2127

2228
; 107 vectors (16 core + 91 peripheral) * 4 bytes = 428 bytes to reserve (0x1B0, 8-byte aligned)
23-
RW_IRAM1 (0x20000000+0x1B0) (0x30000-0x1B0) { ; RW data
29+
RW_IRAM1 (0x20000000+0x1B0) (0x30000-0x1B0-Stack_Size) { ; RW data
2430
.ANY (+RW +ZI)
2531
}
32+
33+
ARM_LIB_STACK 0x20000000+0x30000 EMPTY -Stack_Size { ; Stack region growing down
34+
}
2635
}

targets/TARGET_GigaDevice/TARGET_GD32F4XX/device/TOOLCHAIN_GCC_ARM/GD32F450xI.ld

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
#define MBED_APP_SIZE 2048k
77
#endif
88

9+
#if !defined(MBED_BOOT_STACK_SIZE)
10+
#define MBED_BOOT_STACK_SIZE 0x400
11+
#endif
12+
913
/* specify memory regions */
1014
MEMORY
1115
{
@@ -113,6 +117,7 @@ SECTIONS
113117
__end__ = .;
114118
end = __end__;
115119
*(.heap*)
120+
. = ORIGIN(RAM) + LENGTH(RAM) - MBED_BOOT_STACK_SIZE;
116121
__HeapLimit = .;
117122
} > RAM
118123

@@ -124,7 +129,7 @@ SECTIONS
124129
/* initializes stack on the end of block */
125130
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
126131
_estack = __StackTop;
127-
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
132+
__StackLimit = __StackTop - MBED_BOOT_STACK_SIZE;
128133
PROVIDE(__stack = __StackTop);
129134

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

targets/TARGET_GigaDevice/TARGET_GD32F4XX/device/TOOLCHAIN_IAR/gd32f450zi.icf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
66
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x200000; }
7+
if (!isdefinedsymbol(MBED_BOOT_STACK_SIZE)) { define symbol MBED_BOOT_STACK_SIZE = 0x400; }
78
/*-Specials-*/
89
define symbol __ICFEDIT_intvec_start__ = MBED_APP_START;
910
/*-Memory Regions-*/
@@ -17,7 +18,7 @@ define symbol __ICFEDIT_region_RAM_start__ = 0x200001B0;
1718
define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;
1819

1920
/*-Sizes-*/
20-
define symbol __ICFEDIT_size_cstack__ = 0x400;
21+
define symbol __ICFEDIT_size_cstack__ = MBED_BOOT_STACK_SIZE;
2122
define symbol __ICFEDIT_size_heap__ = 0x10000;
2223
/**** End of ICF editor section. ###ICF###*/
2324

0 commit comments

Comments
 (0)