Skip to content

Commit 988ae30

Browse files
feilongflcarlescufi
authored andcommitted
soc: arm: gigadevice: add support for GD32e10x
Add support for the E10x series. Signed-off-by: YuLong Yao <[email protected]>
1 parent eccc905 commit 988ae30

File tree

8 files changed

+98
-0
lines changed

8 files changed

+98
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2021 YuLong Yao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_include_directories(.)
5+
zephyr_sources(soc.c)
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2021 YuLong Yao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC
5+
default "gd32e103"
6+
7+
config SYS_CLOCK_HW_CYCLES_PER_SEC
8+
default $(dt_node_int_prop_int,/cpus/cpu@0,clock-frequency)
9+
10+
config NUM_IRQS
11+
default 83
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2021 YuLong Yao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if SOC_SERIES_GD32E10X
5+
6+
source "soc/arm/gigadevice/gd32e10x/Kconfig.defconfig.gd32*"
7+
8+
config SOC_SERIES
9+
default "gd32e10x"
10+
11+
endif # SOC_SERIES_GD32E10X
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright (c) 2021 YuLong Yao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SOC_SERIES_GD32E10X
5+
bool "GigaDevice GD32E10X series Cortex-M4F MCU"
6+
select ARM
7+
select CPU_HAS_FPU
8+
select CPU_CORTEX_M4
9+
select CPU_CORTEX_M_HAS_SYSTICK
10+
select CPU_CORTEX_M_HAS_VTOR
11+
select SOC_FAMILY_GD32_ARM
12+
select GD32_HAS_AFIO_PINMUX
13+
help
14+
Enable support for GigaDevice GD32E10X MCU series
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Copyright (c) 2021 YuLong Yao <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
choice
5+
prompt "GigaDevice GD32E103 MCU Selection"
6+
depends on SOC_SERIES_GD32E10X
7+
8+
config SOC_GD32E103
9+
bool "gd32e103"
10+
endchoice
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright (c) 2021 YuLong Yao <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <arch/arm/aarch32/cortex_m/scripts/linker.ld>

soc/arm/gigadevice/gd32e10x/soc.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2021 YuLong Yao <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <device.h>
7+
#include <init.h>
8+
#include <soc.h>
9+
10+
static int gd32e10x_soc_init(const struct device *dev)
11+
{
12+
uint32_t key;
13+
14+
ARG_UNUSED(dev);
15+
16+
key = irq_lock();
17+
18+
SystemInit();
19+
NMI_INIT();
20+
21+
irq_unlock(key);
22+
23+
return 0;
24+
}
25+
26+
SYS_INIT(gd32e10x_soc_init, PRE_KERNEL_1, 0);

soc/arm/gigadevice/gd32e10x/soc.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2021 YuLong Yao <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef _SOC_ARM_GIGADEVICE_GD32E10X_SOC_H_
7+
#define _SOC_ARM_GIGADEVICE_GD32E10X_SOC_H_
8+
9+
#ifndef _ASMLANGUAGE
10+
11+
#include <gd32e10x.h>
12+
13+
#endif /* _ASMLANGUAGE */
14+
15+
#endif /* _SOC_ARM_GIGADEVICE_GD32E10X_SOC_H_ */

0 commit comments

Comments
 (0)