-
Notifications
You must be signed in to change notification settings - Fork 8.2k
boards: Add support GigaDevice GD32V SoC #34970
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
carlescufi
merged 13 commits into
zephyrproject-rtos:main
from
soburi:add_basic_support_gd32v
Dec 20, 2021
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
924e158
dts: bindings: vendor-prefixes: Add nuclei prefix
soburi 88d119d
riscv_machine_timer: Enable to use divided clock for the machine timer
soburi 58fdc0f
riscv: Add an option for configuring mcause exception mask
soburi 7e84679
soc: nuclei: Add Nuclei specialized CSR definitions
soburi 12a1656
modules: Add Configurations for GD32VF103
soburi da747a9
soc: riscv: Add initial support for GigaDevice GD32V SoC
soburi 5b7937a
boards: riscv: Add SiPeed Longan Nano platform
soburi 1f16638
drivers: pinctrl: Support pinctrl with GD32VF103
soburi 1939571
drivers: interrupt-controller: add Nuclei ECLIC driver
soburi 694a70c
drivers: serial: Add USART support for GD32V
soburi ddb640c
coredump: add support for Longan Nano boards
soburi 61e9e05
tests: skip arch_nop test when machine timer uses divided sys clock
soburi b8fbca6
MAINTAINERS: add soburi as gd32 platform collaborator
soburi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config BOARD_LONGAN_NANO | ||
| bool "Sipeed Longan Nano target" | ||
| depends on SOC_GD32VF103 | ||
|
|
||
| config BOARD_LONGAN_NANO_LITE | ||
| bool "Sipeed Longan Nano Lite target" | ||
| depends on SOC_GD32VF103 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Sipeed longan nano Development Board Configuration | ||
|
|
||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
|
|
||
| if BOARD_LONGAN_NANO || BOARD_LONGAN_NANO_LITE | ||
|
|
||
| config BOARD | ||
| default "longan_nano" if BOARD_LONGAN_NANO | ||
| default "longan_nano_lite" if BOARD_LONGAN_NANO_LITE | ||
|
|
||
| endif # BOARD_LONGAN_NANO || BOARD_LONGAN_NANO_LITE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| board_runner_args(openocd --cmd-pre-init "source [find target/gd32vf103.cfg]") | ||
|
|
||
| board_runner_args(openocd "--cmd-pre-load=gd32vf103-pre-load") | ||
| board_runner_args(openocd "--cmd-load=gd32vf103-load") | ||
| board_runner_args(openocd "--cmd-post-verify=gd32vf103-post-verify") | ||
|
|
||
| include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| .. _longan_nano: | ||
|
|
||
| Sipeed Longan Nano | ||
| ################## | ||
|
|
||
| Overview | ||
| ******** | ||
|
|
||
| The Sipeed Longan Nano and Longan Nano Lite is an simple and tiny development board with | ||
| an GigaDevice GD32VF103 SoC that based on N200 RISC-V IP core by Nuclei system technology. | ||
| More information can be found on: | ||
|
|
||
| - `Sipeed Longan website <https://longan.sipeed.com/en/>`_ | ||
| - `GD32VF103 datasheet <https://www.gigadevice.com/datasheet/gd32vf103xxxx-datasheet/>`_ | ||
| - `GD32VF103 user manual <http://www.gd32mcu.com/data/documents/shujushouce/GD32VF103_User_Manual_EN_V1.2.pdf>`_ | ||
| - `Nuclei website <https://www.nucleisys.com/download.php>`_ | ||
| - `Nuclei Bumblebee core documents <https://github.com/nucleisys/Bumblebee_Core_Doc>`_ | ||
| - `Nuclei ISA Spec <https://doc.nucleisys.com/nuclei_spec/>`_ | ||
|
|
||
| Programming and debugging | ||
| ************************* | ||
|
|
||
| Building | ||
| ======== | ||
|
|
||
| Applications for the ``logan_nano`` board configuration can be built as usual | ||
| (see :ref:`build_an_application`) using the corresponding board name: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :board: logan_nano | ||
| :goals: build | ||
|
|
||
| Flashing | ||
| ======== | ||
|
|
||
| In order to upload the application to the device, you'll need OpenOCD with | ||
| GD32V support. Download the tarball for your OS from the | ||
| `SiPEED longan nano download site | ||
| <http://dl.sipeed.com/LONGAN/platformio/dl-packages/>`_ and extract it. | ||
|
|
||
| The Zephyr SDK uses a bundled version of OpenOCD by default. You can | ||
| overwrite that behavior by adding the | ||
| ``-DOPENOCD=<path/to/riscv-openocd/bin/openocd>`` | ||
| parameter when building: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :board: longan_nano | ||
| :goals: build | ||
| :gen-args: -DOPENOCD=<path/to/riscv-openocd/bin/openocd> | ||
|
|
||
| When using a custom toolchain it should be enough to have the downloaded | ||
| version of the binary in your ``PATH``. | ||
|
|
||
| Now you can flash the application as usual (see :ref:`build_an_application` and | ||
| :ref:`application_run` for more details): | ||
|
|
||
| .. code-block:: console | ||
|
|
||
| west flash | ||
|
|
||
| Debugging | ||
| ========= | ||
|
|
||
| Refer to the detailed overview about :ref:`application_debugging`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| /* | ||
| * Copyright (c) 2021, TOKITA Hiroshi | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <dt-bindings/pinctrl/gd32vf103c(b-8)xx-pinctrl.h> | ||
|
|
||
| &pinctrl { | ||
| usart0_default: usart0_default { | ||
| group1 { | ||
| pinmux = <USART0_TX_PA9_NORMP>, <USART0_RX_PA10_NORMP>; | ||
| }; | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| * Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
| #include <gigadevice/gd32vf103Xb.dtsi> | ||
| #include "longan_nano-pinctrl.dtsi" | ||
|
|
||
| / { | ||
| model = "Sipeed Longan Nano"; | ||
| compatible = "sipeed,longan_nano"; | ||
|
|
||
| chosen { | ||
| zephyr,console = &usart0; | ||
| zephyr,shell-uart = &usart0; | ||
| zephyr,sram = &sram0; | ||
| zephyr,flash = &flash0; | ||
| }; | ||
| }; | ||
|
|
||
| &usart0 { | ||
| status = "okay"; | ||
| current-speed = <115200>; | ||
| pinctrl-0 = <&usart0_default>; | ||
| pinctrl-names = "default"; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| identifier: longan_nano | ||
| name: Sipeed Longan Nano | ||
| type: mcu | ||
| arch: riscv32 | ||
| toolchain: | ||
| - zephyr | ||
| - xtools | ||
| flash: 128 | ||
| ram: 32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Sipeed longan nano Development Board Configuration | ||
| # | ||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| CONFIG_SOC_SERIES_GD32VF103=y | ||
| CONFIG_SOC_GD32VF103=y | ||
| CONFIG_GD32_HXTAL_8MHZ=y | ||
|
|
||
| # enable machine timer | ||
| CONFIG_RISCV_MACHINE_TIMER=y | ||
|
|
||
| # enable uart driver | ||
| CONFIG_SERIAL=y | ||
| CONFIG_UART_INTERRUPT_DRIVEN=y | ||
|
|
||
| # enable console | ||
| CONFIG_CONSOLE=y | ||
| CONFIG_UART_CONSOLE=y | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
gmarull marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
| #include <gigadevice/gd32vf103X8.dtsi> | ||
| #include "longan_nano-pinctrl.dtsi" | ||
|
|
||
| / { | ||
| model = "Sipeed Longan Nano Lite"; | ||
| compatible = "sipeed,longan_nano_lite"; | ||
|
|
||
| chosen { | ||
| zephyr,console = &usart0; | ||
| zephyr,shell-uart = &usart0; | ||
| zephyr,sram = &sram0; | ||
| zephyr,flash = &flash0; | ||
| }; | ||
| }; | ||
|
|
||
| &usart0 { | ||
| status = "okay"; | ||
| current-speed = <115200>; | ||
| pinctrl-0 = <&usart0_default>; | ||
| pinctrl-names = "default"; | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| identifier: longan_nano_lite | ||
soburi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| name: Sipeed Longan Nano Lite | ||
| type: mcu | ||
| arch: riscv32 | ||
| toolchain: | ||
| - zephyr | ||
| - xtools | ||
| flash: 64 | ||
| ram: 20 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Sipeed Longan Nano Lite board Configuration | ||
| # | ||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| CONFIG_SOC_SERIES_GD32VF103=y | ||
| CONFIG_SOC_GD32VF103=y | ||
| CONFIG_GD32_HXTAL_8MHZ=y | ||
|
|
||
| # enable machine timer | ||
| CONFIG_RISCV_MACHINE_TIMER=y | ||
|
|
||
| # enable uart driver | ||
| CONFIG_SERIAL=y | ||
| CONFIG_UART_INTERRUPT_DRIVEN=y | ||
|
|
||
| # enable console | ||
| CONFIG_CONSOLE=y | ||
| CONFIG_UART_CONSOLE=y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
soburi marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| interface ftdi | ||
|
|
||
| ftdi_device_desc "Dual RS232" | ||
| #ftdi_device_desc "Sipeed-Debug" | ||
| #ftdi_device_desc "JTAG Debugger" | ||
|
|
||
| ftdi_vid_pid 0x0403 0x6010 | ||
| #ftdi_channel 0 | ||
|
|
||
| ftdi_layout_init 0x0008 0x001b | ||
| ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020 | ||
|
|
||
| adapter_khz 2000 | ||
| transport select jtag | ||
|
|
||
| proc gd32vf103-pre-load {} { | ||
| halt | ||
| } | ||
|
|
||
| proc gd32vf103-load {file} { | ||
| flash protect 0 0 last off | ||
| flash write_image erase $file | ||
| } | ||
|
|
||
|
|
||
| proc gd32vf103-post-verify {} { | ||
| mww 0xe004200c 0x4b5a6978 | ||
| mww 0xe0042008 0x01 | ||
| resume | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Nuclei ECLIC interrupt-controller configuration | ||
|
|
||
| # Copyright (c) 2021 Tokita, Hiroshi <[email protected]> | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| DT_COMPAT_NUCLEI_ECLIC = nuclei,eclic | ||
|
|
||
| config HAS_NUCLEI_ECLIC | ||
| bool | ||
| help | ||
| Indicate that the platform has ECLIC. | ||
|
|
||
| config NUCLEI_ECLIC | ||
| bool "Enhanced Core Local Interrupt Controller (ECLIC)" | ||
| default $(dt_compat_enabled,$(DT_COMPAT_NUCLEI_ECLIC)) | ||
| depends on HAS_NUCLEI_ECLIC | ||
| help | ||
| Interrupt controller for Nuclei SoC core. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.