boards: arm: gd32f407v_start: Add initial support for gd32f407v_start

Add initial support for the GD32F407V-START board.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@gmail.com>
This commit is contained in:
TOKITA Hiroshi 2022-08-14 21:54:05 +09:00 committed by Carles Cufí
parent 702d079007
commit aae94737ee
9 changed files with 307 additions and 0 deletions

View file

@ -0,0 +1,6 @@
# Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
config BOARD_GD32F407V_START
bool "GigaDevice GD32F407V-START"
depends on SOC_GD32F407

View file

@ -0,0 +1,9 @@
# Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
if BOARD_GD32F407V_START
config BOARD
default "gd32f407v_start"
endif # BOARD_GD32F407V_START

View file

@ -0,0 +1,8 @@
# Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
board_runner_args(pyocd "--target=gd32f407vk")
board_runner_args(jlink "--device=GD32F407VK" "--speed=4000")
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

View file

@ -0,0 +1,156 @@
.. _gd32f407v_start:
GigaDevice GD32F407V-START
##########################
Overview
********
The GD32F407V-START board is a hardware platform that enables prototyping
on GD32F407VE Cortex-M4 High Performance MCU.
The GD32F407VE features a single-core ARM Cortex-M4 MCU which can run up
to 168 MHz with flash accesses zero wait states, 3072kiB of Flash, 192kiB of
SRAM and 82 GPIOs.
.. image:: img/gd32f407v_start.jpg
:align: center
:alt: gd32f407v_start
Hardware
********
- GD32F407VET6 MCU
- 1 x User LEDs
- 1 x User Push buttons
- 1 x USART
- GD-Link on board programmer
- J-Link/SWD connector
For more information about the GD32F407 SoC and GD32F407V-START board:
- `GigaDevice Cortex-M4 High Performance SoC Website`_
- `GD32F407X Datasheet`_
- `GD32F40X User Manual`_
- `GD32F407V-START User Manual`_
Supported Features
==================
The board configuration supports the following hardware features:
.. list-table::
:header-rows: 1
* - Peripheral
- Kconfig option
- Devicetree compatible
* - EXTI
- :kconfig:option:`CONFIG_GD32_EXTI`
- :dtcompatible:`gd,gd32-exti`
* - GPIO
- :kconfig:option:`CONFIG_GPIO`
- :dtcompatible:`gd,gd32-gpio`
* - NVIC
- N/A
- :dtcompatible:`arm,v7m-nvic`
* - PWM
- :kconfig:option:`CONFIG_PWM`
- :dtcompatible:`gd,gd32-pwm`
* - SYSTICK
- N/A
- N/A
* - USART
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`gd,gd32-usart`
Other peripherals may be used if shields are connected to the board.
Serial Port
===========
The GD32F407V-START board has one serial communication port. The default port
is USART0 with TX connected at PB6 and RX at PB7.
Programming and Debugging
*************************
Before programming your board make sure to configure boot jumpers as
follows:
- JP3/4: Select 2-3 for both (boot from user memory)
Using GD-Link or J-Link
=======================
The board comes with an embedded GD-Link programmer.
You need to install CMSIS-Pack which is required by pyOCD
when programming or debugging by the GD-Link programmer.
Execute the following command to install CMSIS-Pack for GD32F407VK
if not installed yet.
.. code-block:: console
pyocd pack install gd32f407vk
Also, J-Link can be used to program the board via the SWD interface
(PA13/SWDIO and PA14/SWCLK in the JP6 header).
#. Build the Zephyr kernel and the :ref:`hello_world` sample application:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: gd32f407v_start
:goals: build
:compact:
#. Connect Serial-USB adapter to PB6, PB7, and GND.
#. Run your favorite terminal program to listen for output. On Linux the
terminal should be something like ``/dev/ttyUSB0``. For example:
.. code-block:: console
minicom -D /dev/ttyUSB0 -o
The -o option tells minicom not to send the modem initialization
string. Connection should be configured as follows:
- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1
#. To flash an image:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: gd32f407v_start
:goals: flash
:compact:
When using J-Link, append ``--runner jlink`` option after ``west flash``.
You should see "Hello World! gd32f407v_start" in your terminal.
#. To debug an image:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: gd32f407v_start
:goals: debug
:compact:
When using J-Link, append ``--runner jlink`` option after ``west debug``.
.. _GigaDevice Cortex-M4 High Performance SoC Website:
https://www.gigadevice.com/products/microcontrollers/gd32/arm-cortex-m4/high-performance-line/
.. _GD32F407X Datasheet:
https://gd32mcu.com/data/documents/datasheet/GD32F407xx_Datasheet_Rev2.5.pdf
.. _GD32F40X User Manual:
https://gd32mcu.com/data/documents/userManual/GD32F4xx_User_Manual_Rev2.7.pdf
.. _GD32F407V-START User Manual:
https://www.gd32mcu.com/data/documents/evaluationBoard/GD32F4xx_Demo_Suites_V2.6.1.rar

View file

@ -0,0 +1,20 @@
/*
* Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/gd32f405z(e-g-k)xx-pinctrl.h>
&pinctrl {
usart0_default: usart0_default {
group1 {
pinmux = <USART0_TX_PB6>, <USART0_RX_PB7>;
};
};
pwm2_default: pwm2_default {
group1 {
pinmux = <TIMER2_CH0_PC6>;
};
};
};

View file

@ -0,0 +1,76 @@
/*
* Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <gigadevice/gd32f4xx/gd32f407xk.dtsi>
#include "gd32f407v_start-pinctrl.dtsi"
/ {
model = "GigaDevice GD32F407V-START";
compatible = "gd,gd32f407v-start";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &usart0;
zephyr,shell-uart = &usart0;
};
leds {
compatible = "gpio-leds";
led2: led2 {
gpios = <&gpioc 6 GPIO_ACTIVE_HIGH>;
};
};
gpio_keys {
compatible = "gpio-keys";
user_key: user_key {
label = "USER_KEY";
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
};
};
pwmleds {
compatible = "pwm-leds";
pwm_led: pwm_led {
pwms = <&pwm2 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};
aliases {
led0 = &led2;
sw0 = &user_key;
pwm-led0 = &pwm_led;
};
};
&gpioa {
status = "okay";
};
&gpioc {
status = "okay";
};
&usart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&usart0_default>;
pinctrl-names = "default";
};
&timer2 {
status = "okay";
prescaler = <256>;
pwm2: pwm {
status = "okay";
pinctrl-0 = <&pwm2_default>;
pinctrl-names = "default";
};
};

View file

@ -0,0 +1,16 @@
# Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
identifier: gd32f407v_start
name: GigaDevice GD32F407V-START
type: mcu
arch: arm
ram: 192
flash: 3072
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- pwm
- gpio

View file

@ -0,0 +1,16 @@
# Copyright (c) 2022, TOKITA Hiroshi <tokita.hiroshi@gmail.com>
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_GD32F4XX=y
CONFIG_SOC_GD32F407=y
CONFIG_BOARD_GD32F407V_START=y
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_GPIO=y