soc: arm: Introduce gigadevice soc

Add gigadevice soc initial version.

Signed-off-by: Gerson Fernando Budke <gerson.budke@atl-electronics.com>
This commit is contained in:
Gerson Fernando Budke 2021-09-17 16:25:11 -03:00 committed by Carles Cufí
commit 087be00b58
14 changed files with 189 additions and 0 deletions

View file

@ -5,6 +5,11 @@ if(CONFIG_HAS_GD32_HAL)
zephyr_library_named(hal_gigadevice)
if(CONFIG_SOC_SERIES_GD32F403)
set(gd32_soc_uc GD32F403)
set(gd32_soc_lc gd32f403)
endif()
zephyr_library_compile_definitions(${gd32_soc_uc})
set(gd32_soc_dir ${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/${gd32_soc_uc})

View file

@ -6,6 +6,7 @@ config ZEPHYR_HAL_GIGADEVICE_MODULE
config HAS_GD32_HAL
bool
select HAS_CMSIS_CORE if SOC_FAMILY_GD32_ARM
if HAS_GD32_HAL

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(${SOC_SERIES})

View file

@ -0,0 +1,22 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
config SOC_FAMILY_GD32
bool
select HAS_GD32_HAL
select BUILD_OUTPUT_HEX
config SOC_FAMILY
string
default "gigadevice"
depends on SOC_FAMILY_GD32
config SOC_FAMILY_GD32_ARM
bool
select SOC_FAMILY_GD32
if SOC_FAMILY_GD32_ARM
source "soc/arm/gigadevice/*/Kconfig.soc"
endif # SOC_FAMILY_GD32_ARM

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
source "soc/arm/gigadevice/*/Kconfig.defconfig.series"

View file

@ -0,0 +1,4 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
source "soc/arm/gigadevice/*/Kconfig.series"

View file

@ -0,0 +1,5 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
zephyr_include_directories(.)
zephyr_sources(soc.c)

View file

@ -0,0 +1,21 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
if SOC_GD32F403R || SOC_GD32F403V || SOC_GD32F403Z
config SOC
default "gd32f403r" if SOC_GD32F403R
default "gd32f403v" if SOC_GD32F403V
default "gd32f403z" if SOC_GD32F403Z
config SOC_SERIES_GD32F403
bool
default y
config SYS_CLOCK_HW_CYCLES_PER_SEC
default 168000000
config NUM_IRQS
default 68
endif

View file

@ -0,0 +1,11 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
if SOC_SERIES_GD32F4
source "soc/arm/gigadevice/gd32f4/Kconfig.defconfig.gd32f4*"
config SOC_SERIES
default "gd32f4"
endif # SOC_SERIES_GD32F4

View file

@ -0,0 +1,14 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
config SOC_SERIES_GD32F4
bool "GigaDevice GD32F4xxx series Cortex-M4F MCU"
select ARM
select CPU_HAS_ARM_MPU
select CPU_HAS_FPU
select CPU_CORTEX_M4
select CPU_CORTEX_M_HAS_SYSTICK
select CPU_CORTEX_M_HAS_VTOR
select SOC_FAMILY_GD32_ARM
help
Enable support for GigaDevice GD32F4xxx MCU series

View file

@ -0,0 +1,17 @@
# Copyright (c) 2021, ATL Electronics
# SPDX-License-Identifier: Apache-2.0
choice
prompt "GigaDevice GD32F4xx MCU Selection"
depends on SOC_SERIES_GD32F4
config SOC_GD32F403R
bool "gd32f403r"
config SOC_GD32F403V
bool "gd32f403v"
config SOC_GD32F403Z
bool "gd32f403z"
endchoice

View file

@ -0,0 +1,9 @@
/* linker.ld - Linker command/script file */
/*
* Copyright (c) 2014 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <arch/arm/aarch32/cortex_m/scripts/linker.ld>

View file

@ -0,0 +1,41 @@
/*
* Copyright (c) 2021, ATL Electronics
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief GD32 MCU series initialization code
*
* This module provides routines to initialize and support board-level
* hardware for the GigaDevice GD32 SoC.
*/
#include <device.h>
#include <init.h>
/**
* @brief Perform basic hardware initialization at boot.
*
* This needs to be run from the very beginning.
* So the init priority has to be 0 (zero).
*
* @return 0
*/
static int gigadevice_gd32_soc_init(const struct device *arg)
{
uint32_t key;
ARG_UNUSED(arg);
key = irq_lock();
SystemInit();
NMI_INIT();
irq_unlock(key);
return 0;
}
SYS_INIT(gigadevice_gd32_soc_init, PRE_KERNEL_1, 0);

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021, ATL Electronics
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Board configuration macros
*
* This header file is used to specify and describe board-level aspects
*/
#ifndef _SOC__H_
#define _SOC__H_
#include <sys/util.h>
#ifndef _ASMLANGUAGE
/* Add include for DTS generated information */
#include <devicetree.h>
#if defined(CONFIG_SOC_SERIES_GD32F403)
#include <gd32f403.h>
#else
#error Library does not support the specified device.
#endif
#endif /* !_ASMLANGUAGE */
#endif /* _SOC__H_ */