Skip to content

boards: gd32e507z_eval: add initial support #49547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions boards/arm/gd32e507z_eval/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2022, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

config BOARD_GD32E507Z_EVAL
bool "GigaDevice GD32E507Z-EVAL"
depends on SOC_GD32E507
9 changes: 9 additions & 0 deletions boards/arm/gd32e507z_eval/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2022 Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

if BOARD_GD32E507Z_EVAL

config BOARD
default "gd32e507z_eval"

endif # BOARD_GD32E507Z_EVAL
11 changes: 11 additions & 0 deletions boards/arm/gd32e507z_eval/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2022, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

board_runner_args(pyocd "--target=gd32e507ze")
board_runner_args(
jlink
"--device=GD32E507ZE" "--iface=jtag" "--tool-opt=-JTAGConf -1,-1"
)

include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 156 additions & 0 deletions boards/arm/gd32e507z_eval/doc/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
.. _gd32e507z_eval:

GigaDevice GD32E507Z-EVAL
#########################

Overview
********

The GD32E507Z-EVAL board is a hardware platform that enables prototyping
on GD32E507ZE Cortex-M33 High Performance MCU.

The GD32E507ZE features a single-core ARM Cortex-M33 MCU which can run up
to 180 MHz with flash accesses zero wait states, 512kiB of Flash, 128kiB of
SRAM and 112 GPIOs.

.. image:: img/gd32e507z_eval.jpg
:align: center
:alt: gd32e507z_eval

Hardware
********

- GD32E507ZET6 MCU
- AT24C02C 2Kb EEPROM
- GD25Q16 16Mbit SPI and QSPI NOR Flash
- GD9FU1G8F2A 1Gbit NAND Flash
- Micron MT48LC16M16A2P-6AIT 256Mbit SDRAM
- 4 x User LEDs
- 1 x Joystick (L/R/U/D/C)
- 1 x USART (connected to USB VCOM at J1 connector)
- 1 x POT connected to an ADC input
- Headphone interface
- USB FS connector
- 1 x CAN (includes SN65HVD230 PHY)
- Ethernet Interface
- 3.2" RGB-LCD (320x240)
- GD-Link on board programmer
- J-Link/JTAG connector

For more information about the GD32E507 SoC and GD32E507Z-EVAL board:

- `GigaDevice Cortex-M33 High Performance SoC Website`_
- `GD32E507X Datasheet`_
- `GD32E50X User Manual`_
- `GD32E507Z-EVAL 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,v8m-nvic`
* - PWM
- :kconfig:option:`CONFIG_PWM`
- :dtcompatible:`gd,gd32-pwm`
* - SYSTICK
- N/A
- N/A
* - USART
- :kconfig:option:`CONFIG_SERIAL`
- :dtcompatible:`gd,gd32-usart`

Serial Port
===========

The GD32E507Z-EVAL board has one serial communication port. The default port
is USART0 with TX connected at PA9 and RX at PA10. USART0 is exposed as a
virtual COM port via the J1 USB connector.

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. It can be used with pyOCD
provided you install the necessary CMSIS-Pack:

.. code-block:: console

pyocd pack install gd32e507ze

J-Link can also be used to program the board using the JTAG interface exposed in
the JP2 header.

#. Build the Zephyr kernel and the :ref:`hello_world` sample application:

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: gd32e507z_eval
:goals: build
: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: gd32e507z_eval
:goals: flash
:compact:

You should see "Hello World! gd32e507z_eval" in your terminal.

#. To debug an image:

.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: gd32e507z_eval
:goals: debug
:compact:

.. _GigaDevice Cortex-M33 High Performance SoC Website:
https://www.gigadevice.com/products/microcontrollers/gd32/arm-cortex-m33/high-performance-line/

.. _GD32E507X Datasheet:
https://gd32mcu.com/download/down/document_id/252/path_type/1

.. _GD32E50X User Manual:
https://www.gd32mcu.com/download/down/document_id/249/path_type/1

.. _GD32E507Z-EVAL User Manual:
https://www.gd32mcu.com/data/documents/evaluationBoard/GD32E50x_Demo_Suites_V1.2.1.rar
20 changes: 20 additions & 0 deletions boards/arm/gd32e507z_eval/gd32e507z_eval-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2022, Teslabs Engineering S.L.
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/gd32e507z(e-c)xx-pinctrl.h>

&pinctrl {
usart0_default: usart0_default {
group1 {
pinmux = <USART0_TX_PA9_NORMP>, <USART0_RX_PA10_NORMP>;
};
};

pwm0_default: pwm0_default {
group1 {
pinmux = <TIMER0_CH0_PA8_OUT_NORMP>;
};
};
};
110 changes: 110 additions & 0 deletions boards/arm/gd32e507z_eval/gd32e507z_eval.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2022, Teslabs Engineering S.L.
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <arm/gigadevice/gd32e50x/gd32e507xe.dtsi>
#include "gd32e507z_eval-pinctrl.dtsi"

/ {
model = "GigaDevice GD32E507Z-EVAL";
compatible = "gd,gd32e507z-eval";

chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &usart0;
zephyr,shell-uart = &usart0;
};

leds {
compatible = "gpio-leds";
led1: led1 {
gpios = <&gpiog 10 GPIO_ACTIVE_HIGH>;
};
led2: led2 {
gpios = <&gpiog 11 GPIO_ACTIVE_HIGH>;
};
led3: led3 {
gpios = <&gpiog 12 GPIO_ACTIVE_HIGH>;
};
led4: led4 {
gpios = <&gpiog 13 GPIO_ACTIVE_HIGH>;
};
};

gpio_keys {
compatible = "gpio-keys";
key_a: key_a {
label = "KEY_A";
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
};
key_b: key_b {
label = "KEY_B";
gpios = <&gpioc 13 GPIO_ACTIVE_LOW>;
};
key_c: key_c {
label = "KEY_C";
gpios = <&gpiof 13 GPIO_ACTIVE_LOW>;
};
key_d: key_d {
label = "KEY_D";
gpios = <&gpiof 14 GPIO_ACTIVE_LOW>;
};
key_cet: key_cet {
label = "KEY_CET";
gpios = <&gpiof 15 GPIO_ACTIVE_LOW>;
};
};

pwmleds {
compatible = "pwm-leds";

/* NOTE: bridge TIMER0_CH0 (PA8) and LED1 (PG10)*/
pwm_led: pwm_led {
pwms = <&pwm0 0 PWM_MSEC(20) PWM_POLARITY_NORMAL>;
};
};

aliases {
led0 = &led1;
sw0 = &key_a;
pwm-led0 = &pwm_led;
};
};

&gpioa {
status = "okay";
};

&gpioc {
status = "okay";
};

&gpiof {
status = "okay";
};

&gpiog {
status = "okay";
};

&usart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&usart0_default>;
pinctrl-names = "default";
};

&timer0 {
status = "okay";
prescaler = <256>;

pwm0: pwm {
status = "okay";
pinctrl-0 = <&pwm0_default>;
pinctrl-names = "default";
};
};
16 changes: 16 additions & 0 deletions boards/arm/gd32e507z_eval/gd32e507z_eval.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

identifier: gd32e507z_eval
name: GigaDevice GD32E507Z-EVAL
type: mcu
arch: arm
ram: 128
flash: 512
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- pwm
- gpio
16 changes: 16 additions & 0 deletions boards/arm/gd32e507z_eval/gd32e507z_eval_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022, Teslabs Engineering S.L.
# SPDX-License-Identifier: Apache-2.0

CONFIG_SOC_SERIES_GD32E50X=y
CONFIG_SOC_GD32E507=y
CONFIG_BOARD_GD32E507Z_EVAL=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
2 changes: 1 addition & 1 deletion dts/arm/gigadevice/gd32e50x/gd32e50x.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
gpio-controller;
#gpio-cells = <2>;
reg = <0x40012000 0x400>;
rcu-periph-clock = <0x607>;
rcu-periph-clock = <0x608>;
resets = <&rctl GD32_RESET_GPIOG>;
status = "disabled";
};
Expand Down