-
Notifications
You must be signed in to change notification settings - Fork 8.2k
ARM: Introduce gigadevice gd32f403 #38661
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 7 commits into
zephyrproject-rtos:main
from
nandojve:gd32_zephyr_arm_minimal
Oct 28, 2021
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49f4eaa
modules: Add gigadevice hal module
nandojve 10f6599
dts: bindings: vendor-prefixes: Add gigadevice prefix
nandojve aa1524e
dts: arm: Introduce gigadevice soc bindings
nandojve 975e92e
soc: arm: Introduce gigadevice soc
nandojve 3c6bb1a
drivers: serial: Add gd32 uart driver
nandojve 094434f
boards: arm: Introduce gd32f403z_eval board
nandojve ddb2422
CODEOWNERS: Add nandojve for gigadevices
nandojve 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # Copyright (c) 2021, ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| zephyr_library() | ||
| zephyr_library_sources(board.c) |
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,8 @@ | ||
| # Copyright (c) 2021 ATL-Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config BOARD_INIT_PRIORITY | ||
| int "Board initialization priority" | ||
| default 50 | ||
| help | ||
| Board initialization priority. |
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,6 @@ | ||
| # Copyright (c) 2021, ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| config BOARD_GD32F403Z_EVAL | ||
| bool "GigaDevice GD32F403Z Evaluation Kit" | ||
| depends on SOC_GD32F403Z |
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 @@ | ||
| # Copyright (c) 2021 ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| if BOARD_GD32F403Z_EVAL | ||
|
|
||
| config BOARD | ||
| default "gd32f403z_eval" | ||
|
|
||
| endif # BOARD_GD32F403Z_EVAL |
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 @@ | ||
| /* | ||
| * Copyright (c) 2021 ATL Electronics | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <init.h> | ||
|
|
||
| static int board_init(const struct device *dev) | ||
| { | ||
| rcu_periph_clock_enable(RCU_GPIOA); | ||
|
|
||
| gpio_init(GPIOA, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_9); | ||
| gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_10); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(board_init, PRE_KERNEL_1, CONFIG_BOARD_INIT_PRIORITY); |
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,4 @@ | ||
| # Copyright (c) 2021, ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,165 @@ | ||
| .. _gd32f403z_eval: | ||
|
|
||
| GigaDevice GD32F403Z-EVAL | ||
| ######################### | ||
|
|
||
|
|
||
| Overview | ||
| ******** | ||
|
|
||
| The GD32F403Z-EVAL board is a hardware platform that enables design and debug | ||
| of the GigaDevice F403 Cortex-M4F High Performance MCU. | ||
|
|
||
| The GD32F403ZE features a single-core ARM Cortex-M4F MCU which can run up | ||
| to 168-MHz with flash accesses zero wait states, 512kiB of Flash, 96kiB of | ||
| SRAM and 112 GPIOs. | ||
|
|
||
| .. image:: img/gd32f403z_eval.png | ||
| :width: 800px | ||
| :align: center | ||
| :alt: gd32f403z_eval | ||
|
|
||
|
|
||
| Hardware | ||
| ******** | ||
|
|
||
| - USB interface with mini-USB connector | ||
| - 4 user LEDs | ||
| - 4 user push buttons | ||
| - Reset Button | ||
| - CAN port | ||
| - ADC connected to a potentiometer | ||
| - 2 DAC channels | ||
| - GD25Q40 4Mib SPI Flash | ||
| - HY27UF081G2A 1GiB NAND Flash | ||
| - AT24C02C 2KiB EEPROM | ||
| - 3.2 TFT LCD (320x240) | ||
| - PCM1770 Stereo DAC with Headphone Amplifier | ||
| - Micro-SDHC interface | ||
| - GD-Link interface | ||
|
|
||
| - CMSIS-DAP swd debug interface over USB HID. | ||
|
|
||
|
|
||
| For more information about the GD32F403 SoC and GD32F403Z-Eval board: | ||
|
|
||
| - `GigaDevice Cortex-M4F High Performance SoC Website`_ | ||
| - `GD32F403 Datasheet`_ | ||
| - `GD32F403 Reference Manual`_ | ||
| - `GD32F403Z Eval Schematics`_ | ||
| - `GD32 ISP Console`_ | ||
|
|
||
|
|
||
| Supported Features | ||
| ================== | ||
|
|
||
| The board configuration supports the following hardware features: | ||
|
|
||
| +-----------+------------+-----------------------+ | ||
| | Interface | Controller | Driver/Component | | ||
| +===========+============+=======================+ | ||
| | NVIC | on-chip | nested vectored | | ||
| | | | interrupt controller | | ||
| +-----------+------------+-----------------------+ | ||
| | SYSTICK | on-chip | system clock | | ||
| +-----------+------------+-----------------------+ | ||
| | UART | on-chip | serial port-polling | | ||
| +-----------+------------+-----------------------+ | ||
|
|
||
|
|
||
| Serial Port | ||
| =========== | ||
|
|
||
| The GD32F403Z-EVAL board has 5 serial communication ports. The default port | ||
| is UART0 at PIN-9 and PIN-10. | ||
|
|
||
| Programming and Debugging | ||
| ************************* | ||
|
|
||
| Before program your board make sure to configure boot setting and serial port. | ||
| The default serial port is USART0. This port uses header JP-5/6 to route | ||
| signals between USB VBUS/ID and USART J2. | ||
|
|
||
| +--------+--------+------------+ | ||
| | Boot-0 | Boot-1 | Function | | ||
| +========+========+============+ | ||
| | 1-2 | 1-2 | SRAM | | ||
| +--------+--------+------------+ | ||
| | 1-2 | 2-3 | Bootloader | | ||
| +--------+--------+------------+ | ||
| | 2-3 | Any | Flash | | ||
| +--------+--------+------------+ | ||
|
|
||
| +------+------+-------------+ | ||
| | JP-5 | JP-6 | Function | | ||
| +======+======+=============+ | ||
| | 1-2 | 1-2 | USART0 / J2 | | ||
| +------+------+-------------+ | ||
| | 2-3 | 2-3 | USB VBUS/ID | | ||
| +------+------+-------------+ | ||
| | open | open | Free | | ||
| +------+------+-------------+ | ||
|
|
||
| Using GD-Link | ||
| ============= | ||
|
|
||
| The GD32F403Z-EVAL includes an onboard programmer/debugger (GD-Link) which | ||
| allow flash programming and debug over USB. There are also program and debug | ||
| headers J1 and J100 that can be used with any ARM compatible tools. | ||
|
|
||
| #. Build the Zephyr kernel and the :ref:`hello_world` sample application: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/hello_world | ||
| :board: gd32f403z_eval | ||
| :goals: build | ||
| :compact: | ||
|
|
||
| #. Run your favorite terminal program to listen for output. Under Linux the | ||
| terminal should be :code:`/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: gd32f403z_eval | ||
| :goals: flash | ||
| :compact: | ||
|
|
||
| You should see "Hello World! gd32f403z_eval" in your terminal. | ||
|
|
||
| #. To debug an image: | ||
|
|
||
| .. zephyr-app-commands:: | ||
| :zephyr-app: samples/hello_world | ||
| :board: gd32f403z_eval | ||
| :goals: debug | ||
| :compact: | ||
|
|
||
|
|
||
| .. _GigaDevice Cortex-M4F High Performance SoC Website: | ||
| https://www.gigadevice.com/products/microcontrollers/gd32/arm-cortex-m4/high-performance-line/gd32f403-series/ | ||
|
|
||
| .. _GD32F403 Datasheet: | ||
| http://www.gd32mcu.com/data/documents/shujushouce/GD32F403xx_Datasheet_Rev1.3.pdf | ||
|
|
||
| .. _GD32F403 Reference Manual: | ||
| http://www.gd32mcu.com/data/documents/yingyongbiji/GD32F403_User_Manual_Rev2.4.pdf | ||
|
|
||
| .. _GD32F403Z Eval Schematics: | ||
| http://www.gd32mcu.com/download/down/document_id/270/path_type/1 | ||
|
|
||
| .. _GD32 ISP Console: | ||
| http://www.gd32mcu.com/download/down/document_id/175/path_type/1 | ||
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,26 @@ | ||
| /* | ||
| * Copyright (c) 2021, ATL Electronics | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| /dts-v1/; | ||
|
|
||
| #include <gigadevice/gd32f403zet6.dtsi> | ||
|
|
||
| / { | ||
| model = "GigaDevice GD32F403Z Evaluation Kit"; | ||
| compatible = "gd,gd32f403z"; | ||
|
|
||
| chosen { | ||
| zephyr,sram = &sram0; | ||
| zephyr,flash = &flash0; | ||
| zephyr,console = &usart0; | ||
| zephyr,shell-uart = &usart0; | ||
| }; | ||
| }; | ||
|
|
||
| &usart0 { | ||
| status = "okay"; | ||
|
|
||
| current-speed = <115200>; | ||
| }; |
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,13 @@ | ||
| # Copyright (c) 2021, ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| identifier: gd32f403z_eval | ||
| name: GigaDevice GD32F403Z Evaluation Kit | ||
| type: mcu | ||
| arch: arm | ||
| ram: 96 | ||
| flash: 512 | ||
| toolchain: | ||
| - zephyr | ||
| - gnuarmemb | ||
| - xtools |
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, ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| CONFIG_SOC_SERIES_GD32F4=y | ||
| CONFIG_SOC_GD32F403Z=y | ||
| CONFIG_BOARD_GD32F403Z_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 |
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,26 @@ | ||
| # Copyright (c) 2021 ATL-Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| source [find interface/cmsis-dap.cfg] | ||
| transport select swd | ||
|
|
||
| # chip name | ||
| set CHIPNAME gd32f403ze | ||
| set ENDIAN little | ||
| set CPUTAPID 0x790007a3 | ||
| set FLASH_SIZE 0x80000 | ||
|
|
||
| source [find target/stm32f1x.cfg] | ||
|
|
||
| reset_config trst_and_srst separate | ||
|
|
||
| $_TARGETNAME configure -event gdb-attach { | ||
| echo "Debugger attaching: halting execution" | ||
| reset halt | ||
| gdb_breakpoint_override hard | ||
| } | ||
|
|
||
| $_TARGETNAME configure -event gdb-detach { | ||
| echo "Debugger detaching: resuming execution" | ||
| 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,14 @@ | ||
| # Copyright (c) 2021 ATL Electronics | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Workaround for not being able to have commas in macro arguments | ||
| DT_COMPAT_GIGADEVICE_GD32_USART := gd,gd32-usart | ||
|
|
||
| config USART_GD32 | ||
| bool "GD32 serial driver" | ||
| default $(dt_compat_enabled,$(DT_COMPAT_GIGADEVICE_GD32_USART)) | ||
nandojve marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| depends on SOC_FAMILY_GD32 | ||
| select SERIAL_HAS_DRIVER | ||
| select USE_GD32_USART | ||
| help | ||
| This option enables the USART driver for GD32 SoC family. | ||
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.