Skip to content

Commit 2e3bf05

Browse files
GigaDevice: Add bare metal support to targets
Add bare metal settings to target configurations, and modify scatter files to include heap load region.
1 parent 2cca7f2 commit 2e3bf05

File tree

3 files changed

+60
-10
lines changed

3 files changed

+60
-10
lines changed

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

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
; *****
55

66
#if !defined(MBED_APP_START)
7-
#define MBED_APP_START 0x08000000
7+
#define MBED_APP_START 0x08000000
88
#endif
99

1010
#if !defined(MBED_APP_SIZE)
11-
#define MBED_APP_SIZE 0x100000
11+
#define MBED_APP_SIZE 0x100000
12+
#endif
13+
14+
#if !defined(MBED_RAM_START)
15+
#define MBED_RAM_START 0x20000000
16+
#endif
17+
18+
#if !defined(MBED_RAM_SIZE)
19+
#define MBED_RAM_SIZE 0x00018000
1220
#endif
1321

1422
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
@@ -19,7 +27,15 @@
1927
# endif
2028
#endif
2129

22-
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
30+
31+
; 84 vectors (16 core + 68 peripheral) * 4 bytes = 336 bytes to reserve (0x150)
32+
#define VECTOR_SIZE 0x150
33+
34+
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
35+
36+
#define RAM_FIXED_SIZE (Stack_Size+VECTOR_SIZE)
37+
38+
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
2339

2440
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (1024K)
2541

@@ -30,11 +46,14 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (1024K)
3046
}
3147

3248
; 84 vectors (16 core + 68 peripheral) * 4 bytes = 336 bytes to reserve (0x150)
33-
RW_IRAM1 (0x20000000+0x150) (0x18000-0x150-Stack_Size) { ; RW data
49+
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE-Stack_Size) { ; RW data
3450
.ANY (+RW +ZI)
3551
}
3652

37-
ARM_LIB_STACK (0x20000000+0x18000) EMPTY -Stack_Size { ; stack
53+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM1_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
54+
}
55+
56+
ARM_LIB_STACK (MBED_RAM_START+MBED_RAM_SIZE) EMPTY -Stack_Size { ; stack
3857
}
3958
}
4059

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

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,22 @@
44
; *****
55

66
#if !defined(MBED_APP_START)
7-
#define MBED_APP_START 0x08000000
7+
#define MBED_APP_START 0x08000000
88
#endif
99

1010
#if !defined(MBED_APP_SIZE)
11-
#define MBED_APP_SIZE 0x200000
11+
#define MBED_APP_SIZE 0x00200000
1212
#endif
1313

14+
#if !defined(MBED_RAM_START)
15+
#define MBED_RAM_START 0x20000000
16+
#endif
17+
18+
#if !defined(MBED_RAM_SIZE)
19+
#define MBED_RAM_SIZE 0x30000
20+
#endif
21+
22+
1423
#if !defined(MBED_CONF_TARGET_BOOT_STACK_SIZE)
1524
# if defined(MBED_BOOT_STACK_SIZE)
1625
# define MBED_CONF_TARGET_BOOT_STACK_SIZE MBED_BOOT_STACK_SIZE
@@ -21,6 +30,13 @@
2130

2231
#define Stack_Size MBED_CONF_TARGET_BOOT_STACK_SIZE
2332

33+
; 107 vectors (16 core + 91 peripheral) * 4 bytes = 428 bytes to reserve (0x1B0, 8-byte aligned)
34+
#define VECTOR_SIZE 0x1B0
35+
36+
#define RAM_FIXED_SIZE (MBED_CONF_TARGET_BOOT_STACK_SIZE+VECTOR_SIZE)
37+
38+
#define MBED_RAM1_START (MBED_RAM_START+VECTOR_SIZE)
39+
2440
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (3*1024K)
2541

2642
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
@@ -30,10 +46,13 @@ LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region (3*1024K)
3046
}
3147

3248
; 107 vectors (16 core + 91 peripheral) * 4 bytes = 428 bytes to reserve (0x1B0, 8-byte aligned)
33-
RW_IRAM1 (0x20000000+0x1B0) (0x30000-0x1B0-Stack_Size) { ; RW data
49+
RW_IRAM1 (MBED_RAM_START+VECTOR_SIZE) (MBED_RAM_SIZE-VECTOR_SIZE-Stack_Size) { ; RW data
3450
.ANY (+RW +ZI)
3551
}
3652

37-
ARM_LIB_STACK 0x20000000+0x30000 EMPTY -Stack_Size { ; Stack region growing down
53+
ARM_LIB_HEAP AlignExpr(+0, 16) EMPTY (MBED_RAM_SIZE-RAM_FIXED_SIZE+MBED_RAM1_START-AlignExpr(ImageLimit(RW_IRAM1), 16)) {
54+
}
55+
56+
ARM_LIB_STACK MBED_RAM_START+MBED_RAM_SIZE EMPTY -Stack_Size { ; Stack region growing down
3857
}
3958
}

targets/targets.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7499,7 +7499,6 @@
74997499
],
75007500
"supported_toolchains": [
75017501
"ARM",
7502-
"IAR",
75037502
"GCC_ARM"
75047503
],
75057504
"device_has_add": [
@@ -7511,6 +7510,19 @@
75117510
"PORTOUT",
75127511
"PWMOUT",
75137512
"SERIAL"
7513+
],
7514+
"supported_c_libs": {
7515+
"arm": [
7516+
"std",
7517+
"small"
7518+
],
7519+
"gcc_arm": [
7520+
"std",
7521+
"small"
7522+
]
7523+
},
7524+
"supported_application_profiles": [
7525+
"full", "bare-metal"
75147526
]
75157527
},
75167528
"GD32_F307VG": {

0 commit comments

Comments
 (0)