soc: arm: gigadevice: add support for GD32F4XX SoCs

Add support for the F4XX series.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
Gerard Marull-Paretas 2021-11-01 10:48:22 +01:00 committed by Carles Cufí
commit 95fd99aba3
8 changed files with 97 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# Copyright (c) 2021, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0
zephyr_include_directories(.)
zephyr_sources(soc.c)

View file

@ -0,0 +1,11 @@
# Copyright (c) 2021, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0
config SOC
default "gd32f450"
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 200000000
config NUM_IRQS
default 91

View file

@ -0,0 +1,11 @@
# Copyright (c) 2021, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0
if SOC_SERIES_GD32F4XX
source "soc/arm/gigadevice/gd32f4xx/Kconfig.defconfig.gd32*"
config SOC_SERIES
default "gd32f4xx"
endif # SOC_SERIES_GD32F4XX

View file

@ -0,0 +1,12 @@
# Copyright (c) 2021, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0
config SOC_SERIES_GD32F4XX
bool "GigaDevice GD32F4XX series Cortex-M4F MCU"
select ARM
select CPU_HAS_ARM_MPU
select CPU_HAS_FPU
select CPU_CORTEX_M4
select SOC_FAMILY_GD32_ARM
help
Enable support for GigaDevice GD32F4XX MCU series

View file

@ -0,0 +1,11 @@
# Copyright (c) 2021, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0
choice
prompt "GigaDevice GD32F4XX MCU Selection"
depends on SOC_SERIES_GD32F4XX
config SOC_GD32F450
bool "gd32f450"
endchoice

View file

@ -0,0 +1,6 @@
/*
* Copyright (c) 2021 Teslabs Engineering S.L.
* SPDX-License-Identifier: Apache-2.0
*/
#include <arch/arm/aarch32/cortex_m/scripts/linker.ld>

View file

@ -0,0 +1,25 @@
/*
* Copyright (c) 2021, Teslabs Engineering S.L.
* SPDX-License-Identifier: Apache-2.0
*/
#include <device.h>
#include <init.h>
static int gd32f4xx_soc_init(const struct device *dev)
{
uint32_t key;
ARG_UNUSED(dev);
key = irq_lock();
SystemInit();
NMI_INIT();
irq_unlock(key);
return 0;
}
SYS_INIT(gd32f4xx_soc_init, PRE_KERNEL_1, 0);

View file

@ -0,0 +1,16 @@
/*
* Copyright (c) 2021, Teslabs Engineering S.L.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _SOC_ARM_GIGADEVICE_GD32F4XX_SOC_H_
#define _SOC_ARM_GIGADEVICE_GD32F4XX_SOC_H_
#ifndef _ASMLANGUAGE
#include <devicetree.h>
#include <gd32f4xx.h>
#endif /* _ASMLANGUAGE */
#endif /* _SOC_ARM_GIGADEVICE_GD32F4XX_SOC_H_ */