boards: riscv: introduce gd32vf103c_starter board
add gd32vf103c_starter board. Signed-off-by: YuLong Yao <feilongphone@gmail.com>
This commit is contained in:
parent
05f75f9f33
commit
af06d94e00
6
boards/riscv/gd32vf103c_starter/Kconfig.board
Normal file
6
boards/riscv/gd32vf103c_starter/Kconfig.board
Normal file
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
config BOARD_GD32VF103C_STARTER
|
||||
bool "GigaDevice GD32VF103C-STARTER"
|
||||
depends on SOC_GD32VF103
|
9
boards/riscv/gd32vf103c_starter/Kconfig.defconfig
Normal file
9
boards/riscv/gd32vf103c_starter/Kconfig.defconfig
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if BOARD_GD32VF103C_STARTER
|
||||
|
||||
config BOARD
|
||||
default "gd32vf103c_starter"
|
||||
|
||||
endif # BOARD_GD32VF103C_STARTER
|
10
boards/riscv/gd32vf103c_starter/board.cmake
Normal file
10
boards/riscv/gd32vf103c_starter/board.cmake
Normal file
|
@ -0,0 +1,10 @@
|
|||
# Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
board_runner_args(
|
||||
jlink
|
||||
"--device=GD32VF103CBT6" "--iface=jtag" "--tool-opt=-JTAGConf -1,-1"
|
||||
)
|
||||
|
||||
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
|
||||
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
|
BIN
boards/riscv/gd32vf103c_starter/doc/img/gd32vf103c_starter.jpg
Normal file
BIN
boards/riscv/gd32vf103c_starter/doc/img/gd32vf103c_starter.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 692 KiB |
146
boards/riscv/gd32vf103c_starter/doc/index.rst
Normal file
146
boards/riscv/gd32vf103c_starter/doc/index.rst
Normal file
|
@ -0,0 +1,146 @@
|
|||
.. _gd32vf103c_starter:
|
||||
|
||||
GigaDevice GD32VF103C-STARTER
|
||||
#############################
|
||||
|
||||
Overview
|
||||
********
|
||||
|
||||
The GD32VF103C-STARTER board is a hardware platform that enables prototyping
|
||||
on GD32VF103CB RISC-V MCU.
|
||||
|
||||
The GD32VF103CB features a single-core RISC-V 32-bit MCU which can run up
|
||||
to 108 MHz with flash accesses zero wait states, 128 KiB of Flash, 32 KiB of
|
||||
SRAM and 37 GPIOs.
|
||||
|
||||
.. image:: img/gd32vf103c_starter.jpg
|
||||
:align: center
|
||||
:alt: gd32vf103c_starter
|
||||
|
||||
Hardware
|
||||
********
|
||||
|
||||
- GD32VF103CBT6 MCU
|
||||
- 1 x User LEDs
|
||||
- 1 x USART (USB port with CH340E)
|
||||
- USB FS connector
|
||||
- GD-Link on board programmer
|
||||
- J-Link/JTAG connector
|
||||
|
||||
For more information about the GD32VF103 SoC and GD32VF103C-STARTER board:
|
||||
|
||||
- `GigaDevice RISC-V Mainstream SoC Website`_
|
||||
- `GD32VF103 Datasheet`_
|
||||
- `GD32VF103 User Manual`_
|
||||
- `GD32VF103C-STARTER Documents`_
|
||||
|
||||
Supported Features
|
||||
==================
|
||||
|
||||
The board configuration supports the following hardware features:
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
* - Peripheral
|
||||
- Kconfig option
|
||||
- Devicetree compatible
|
||||
* - GPIO
|
||||
- :kconfig:option:`CONFIG_GPIO`
|
||||
- :dtcompatible:`gd,gd32-gpio`
|
||||
* - Machine timer
|
||||
- :kconfig:option:`CONFIG_RISCV_MACHINE_TIMER`
|
||||
- :dtcompatible:`riscv,machine-timer`
|
||||
* - Nuclei ECLIC Interrupt Controller
|
||||
- :kconfig:option:`CONFIG_NUCLEI_ECLIC`
|
||||
- :dtcompatible:`nuclei,eclic`
|
||||
* - PWM
|
||||
- :kconfig:option:`CONFIG_PWM`
|
||||
- :dtcompatible:`gd,gd32-pwm`
|
||||
* - USART
|
||||
- :kconfig:option:`CONFIG_SERIAL`
|
||||
- :dtcompatible:`gd,gd32-usart`
|
||||
|
||||
Serial Port
|
||||
===========
|
||||
|
||||
The GD32VF103C-STARTER board has one serial communications port.
|
||||
TX connected at PA9 and RX at PA10.
|
||||
|
||||
Programming and Debugging
|
||||
*************************
|
||||
|
||||
Before programming your board make sure to configure boot and serial jumpers
|
||||
as follows:
|
||||
|
||||
- JP2/3: Select 2-3 for both (boot from user memory)
|
||||
- JP5/6: Select 1-2 positions (labeled as ``USART0``)
|
||||
|
||||
Using GD-Link
|
||||
=============
|
||||
|
||||
The GD32VF103C-STARTER includes an onboard programmer/debugger (GD-Link) which
|
||||
allows flash programming and debugging over USB. There is also a JTAG header
|
||||
(JP1) which can be used with tools like Segger J-Link.
|
||||
|
||||
.. note::
|
||||
|
||||
The OpenOCD shipped with Zephyr SDK does not support GD32VF103. You will need
|
||||
to build the `riscv-openocd fork <https://github.com/riscv/riscv-openocd>`_.
|
||||
Note that compared with OpenOCD, J-Link offers a better programming and
|
||||
debugging experience on this board.
|
||||
|
||||
#. Build the Zephyr kernel and the :ref:`hello_world` sample application:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/hello_world
|
||||
:board: gd32vf103c_starter
|
||||
:goals: build
|
||||
:gen-args: -DOPENOCD=<path/to/riscv-openocd/bin/openocd> -DOPENOCD_DEFAULT_PATH=<path/to/riscv-openocd/share/openocd/scripts>
|
||||
:compact:
|
||||
|
||||
#. 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: gd32vf103c_starter
|
||||
:goals: flash
|
||||
:compact:
|
||||
|
||||
You should see "Hello World! gd32vf103c_starter" in your terminal.
|
||||
|
||||
#. To debug an image:
|
||||
|
||||
.. zephyr-app-commands::
|
||||
:zephyr-app: samples/hello_world
|
||||
:board: gd32vf103c_starter
|
||||
:goals: debug
|
||||
:compact:
|
||||
|
||||
|
||||
.. _GigaDevice RISC-V Mainstream SoC Website:
|
||||
https://www.gigadevice.com/products/microcontrollers/gd32/risc-v/mainstream-line/
|
||||
|
||||
.. _GD32VF103 Datasheet:
|
||||
https://www.gigadevice.com/datasheet/gd32vf103xxxx-datasheet/
|
||||
|
||||
.. _GD32VF103 User Manual:
|
||||
http://www.gd32mcu.com/download/down/document_id/222/path_type/1
|
||||
|
||||
.. _GD32VF103C-STARTER Documents:
|
||||
https://github.com/riscv-mcu/GD32VF103_Demo_Suites/tree/master/GD32VF103C_START_Demo_Suites/Docs
|
|
@ -0,0 +1,20 @@
|
|||
/*
|
||||
* Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <dt-bindings/pinctrl/gd32vf103c(b-8)xx-pinctrl.h>
|
||||
|
||||
&pinctrl {
|
||||
usart0_default: usart0_default {
|
||||
group1 {
|
||||
pinmux = <USART0_RX_PA10_NORMP>, <USART0_TX_PA9_NORMP>;
|
||||
};
|
||||
};
|
||||
|
||||
pwm2_default: pwm2_default {
|
||||
group1 {
|
||||
pinmux = <TIMER2_CH1_PA7_OUT_NORMP>;
|
||||
};
|
||||
};
|
||||
};
|
87
boards/riscv/gd32vf103c_starter/gd32vf103c_starter.dts
Normal file
87
boards/riscv/gd32vf103c_starter/gd32vf103c_starter.dts
Normal file
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
#include <gigadevice/gd32vf103Xb.dtsi>
|
||||
#include "gd32vf103c_starter-pinctrl.dtsi"
|
||||
|
||||
/ {
|
||||
model = "GigaDevice GD32VF103C-STARTER";
|
||||
compatible = "gd,gd32vf103c-starter";
|
||||
|
||||
chosen {
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,console = &usart0;
|
||||
zephyr,shell-uart = &usart0;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led1: led1 {
|
||||
gpios = <&gpioa 7 GPIO_ACTIVE_HIGH>;
|
||||
label = "LED1";
|
||||
};
|
||||
};
|
||||
|
||||
gpio_keys {
|
||||
compatible = "gpio-keys";
|
||||
key_a: key_a {
|
||||
label = "KEY_A";
|
||||
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
pwmleds {
|
||||
compatible = "pwm-leds";
|
||||
|
||||
/* NOTE: pwm_led and led1 are share same pin (PA7). */
|
||||
/* When CONFIG_PWM=y it can only be controlled using the PWM API. */
|
||||
pwm_led: pwm_led {
|
||||
pwms = <&pwm2 1 PWM_POLARITY_NORMAL>;
|
||||
};
|
||||
};
|
||||
|
||||
aliases {
|
||||
led0 = &led1;
|
||||
sw0 = &key_a;
|
||||
pwm-led0 = &pwm_led;
|
||||
};
|
||||
};
|
||||
|
||||
&gpioa {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiob {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpioc {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpioe {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&usart0 {
|
||||
status = "okay";
|
||||
current-speed = <115200>;
|
||||
pinctrl-0 = <&usart0_default>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
|
||||
&timer2 {
|
||||
status = "okay";
|
||||
prescaler = <128>;
|
||||
|
||||
pwm2: pwm {
|
||||
status = "okay";
|
||||
pinctrl-0 = <&pwm2_default>;
|
||||
pinctrl-names = "default";
|
||||
};
|
||||
};
|
15
boards/riscv/gd32vf103c_starter/gd32vf103c_starter.yaml
Normal file
15
boards/riscv/gd32vf103c_starter/gd32vf103c_starter.yaml
Normal file
|
@ -0,0 +1,15 @@
|
|||
# Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
identifier: gd32vf103c_starter
|
||||
name: GigaDevice GD32VF103C-STARTER
|
||||
type: mcu
|
||||
arch: riscv32
|
||||
ram: 32
|
||||
flash: 128
|
||||
toolchain:
|
||||
- zephyr
|
||||
supported:
|
||||
- uart
|
||||
- gpio
|
||||
- pwm
|
|
@ -0,0 +1,9 @@
|
|||
# Copyright (c) 2022 YuLong Yao <feilongphone@gmail.com>
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
CONFIG_SOC_SERIES_GD32VF103=y
|
||||
CONFIG_SOC_GD32VF103=y
|
||||
CONFIG_BOARD_GD32VF103C_STARTER=y
|
||||
|
||||
CONFIG_GD32_HXTAL_8MHZ=y
|
||||
CONFIG_RISCV_MACHINE_TIMER=y
|
8
boards/riscv/gd32vf103c_starter/support/openocd.cfg
Normal file
8
boards/riscv/gd32vf103c_starter/support/openocd.cfg
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Copyright (c) 2021, Teslabs Engineering S.L.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# NOTE: This configuration file is intended to be used with the
|
||||
# https://github.com/riscv/riscv-openocd OpenOCD fork.
|
||||
|
||||
source [find interface/cmsis-dap.cfg]
|
||||
source [find target/gd32vf103.cfg]
|
Loading…
Reference in a new issue