-
Notifications
You must be signed in to change notification settings - Fork 8k
board: xhsc: hc32f4a0_evb: Add minimal supprot for hc32f4a0_evb board #94044
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
Open
XH-YongbingLiu
wants to merge
10
commits into
zephyrproject-rtos:main
Choose a base branch
from
levizh:xhsc-develop
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,188
−0
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dc6d0fd
MAINTAINERS: Add maintainers for hal_xhsc.
XH-YongbingLiu 134c857
manifest: Add hal_xhsc to HAL group.
XH-YongbingLiu 4e1d4ea
drivers: pinctrl: Add support for HC32F4A0
XH-YongbingLiu 2d5dccd
drivers: gpio: Add support for HC32F4A0
XH-YongbingLiu 9acba32
drivers: clock_control: Add support for HC32F4A0
XH-YongbingLiu 187e419
drivers: interrupt_controller: Add support for HC32F4A0
XH-YongbingLiu 9f765e0
drivers: serial: Add support for HC32F4A0
XH-YongbingLiu a7b619f
soc: xhsc: Add support for XHSC HC32F4A0
XH-YongbingLiu b0bbe92
boards: xhsc: hc32f4a0_evb: Add minimal support for board HC32F4A0_EVB
XH-YongbingLiu ffbe8f4
drivers: serial: Remove dma support
XH-YongbingLiu 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
Some comments aren't visible on the classic Files Changed page.
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) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config BOARD_HC32F4A0_EVB | ||
select SOC_HC32F4A0 |
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) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
board_runner_args(pyocd "--target=HC32F4A0" "--frequency=10000000") | ||
board_runner_args(jlink "--device=HC32F4A0" "--speed=4000") | ||
|
||
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake) | ||
include(${ZEPHYR_BASE}/boards/common/jlink.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,5 @@ | ||
board: | ||
name: hc32f4a0_evb | ||
vendor: xhsc | ||
socs: | ||
- name: hc32f4a0 |
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,127 @@ | ||
.. zephyr:board:: hc32f4a0_evb | ||
|
||
Overview | ||
******** | ||
|
||
HC32F4A0_EVB, also named as EV_F4A0_LQ176, is the official development board of | ||
XHSC, equipped with HC32F4A0SITB chip, based on ARM Cortex-M4 core, with a | ||
maximum frequency of 240 MHz, and rich on-board resources, which can give full | ||
play to the performance of HC32F4A0SITB chip. | ||
|
||
Hardware | ||
******** | ||
|
||
- MCU: HC32F4A0SITB, 240MHz, 2048KB FLASH, 512KB RAM | ||
- External RAM: | ||
* SRAM: 1MB , IS62WV51216 | ||
* SDRAM: 8MB, IS42S16400J | ||
- External FLASH: | ||
* Nand: 256MB, MT29F2G08AB, | ||
* SPI NOR: 64MB , W25Q64 | ||
- Common Peripherals | ||
- LEDs: 3, user LEDs (LED0, LED1, LED2). | ||
- Buttons: 11, Matrix Keyboard (K1~K9), WAKEUP (K10), RESET (K11) | ||
- Common Interfaces | ||
* USB to serial port | ||
* SD card interface | ||
* Ethernet interface | ||
* LCD interface | ||
* USB HS, USB FS, USB 3300 | ||
* DVP interface | ||
* 3.5mm headphone jack, | ||
* Line in connector | ||
* speaker connector | ||
- Debugging Interface | ||
* On-board DAP debugger | ||
* standard JTAG/SWD | ||
|
||
More information about the board and MCU can be found | ||
at [XHSC](https://www.xhsc.com.cn/). | ||
|
||
Supported Features | ||
================== | ||
|
||
.. zephyr:board-supported-hw:: | ||
|
||
Pin Mapping | ||
=========== | ||
|
||
The peripherals of the HC32F4A0 SoC can be routed to various pins on the board. | ||
The configuration of these routes can be modified through DTS. Please refer to | ||
the datasheet to see the possible routings for each peripheral. | ||
|
||
Default Zephyr Peripheral Mapping | ||
---------------------------------- | ||
|
||
- USART_1 TX/RX : PH15/PH13 (Virtual Port Com) | ||
- LED11 : PC9 | ||
- K10/WKUP : PA0 | ||
|
||
System Clock | ||
------------ | ||
|
||
HC32F4A0_EVB System Clock could be driven by an internal or external oscillator, | ||
as well as the PLL clock. By default, the System clock is driven by the PLL | ||
clock at 240MHz, driven by an 8MHz high-speed external clock. | ||
|
||
Serial Port | ||
----------- | ||
|
||
HC32F4A0_EVB board has 10 USARTs. The Zephyr console output is | ||
assigned to UART1. Default settings are 115200 8N1. | ||
|
||
Programming and Debugging | ||
************************* | ||
|
||
HC32F4A0_EVB board includes an XH-Link embedded debug tool interface. | ||
|
||
Using XH-Link | ||
============= | ||
|
||
The HC32F4A0_EVB includes an onboard programmer/debugger (XH-Link) which | ||
allow flash programming and debug over USB. | ||
|
||
#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample | ||
application: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: hc32f4a0_evb | ||
: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: hc32f4a0_evb | ||
:goals: flash | ||
:compact: | ||
|
||
You should see "Hello World! hc32f4a0_evb/hc32f4a0" in your terminal. | ||
|
||
#. To debug an image: | ||
|
||
.. zephyr-app-commands:: | ||
:zephyr-app: samples/hello_world | ||
:board: hc32f4a0_evb | ||
:goals: debug | ||
:compact: | ||
|
||
.. _HC32F4A0 Datasheet, Reference Manual, HC32F4A0_EVB Schematics: | ||
https://www.xhsc.com.cn/product/112.html |
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,37 @@ | ||
/* | ||
* Copyright (C) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <dt-bindings/pinctrl/hc32-pinctrl.h> | ||
|
||
&pinctrl { | ||
usart1_default: usart1_default { | ||
group0 { | ||
pinmux = <HC32_PINMUX('H', 15, FUNC, 32, 0)>, | ||
<HC32_PINMUX('H', 13, FUNC, 33, 0)>; | ||
}; | ||
}; | ||
|
||
usart2_default: usart2_default { | ||
group1 { | ||
pinmux = <HC32_PINMUX('D', 5, FUNC, 20, 0)>, | ||
<HC32_PINMUX('D', 6, FUNC, 20, 0)>; | ||
}; | ||
}; | ||
|
||
usart3_default: usart3_default { | ||
group1 { | ||
pinmux = <HC32_PINMUX('I', 1, FUNC, 36, 0)>, | ||
<HC32_PINMUX('I', 2, FUNC, 37, 0)>; | ||
}; | ||
}; | ||
|
||
usart4_default: usart4_default { | ||
group1 { | ||
pinmux = <HC32_PINMUX('I', 6, FUNC, 38, 0)>, | ||
<HC32_PINMUX('I', 7, FUNC, 39, 0)>; | ||
}; | ||
}; | ||
}; |
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,121 @@ | ||
/* | ||
* Copyright (C) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/dts-v1/; | ||
#include <xhsc/f4/hc32f4a0.dtsi> | ||
#include "hc32f4a0_evb-pinctrl.dtsi" | ||
#include <zephyr/dt-bindings/input/input-event-codes.h> | ||
|
||
/ { | ||
model = "xhsc, EV_F4A0_LQ176_Rev1.0 board"; | ||
compatible = "xhsc,hc32f4a0_evb"; | ||
|
||
chosen { | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,console = &usart1; | ||
zephyr,shell-uart = &usart1; | ||
}; | ||
|
||
leds { | ||
compatible = "gpio-leds"; | ||
|
||
green_led: led_0 { | ||
gpios = <&gpioc 9 GPIO_ACTIVE_HIGH>; | ||
label = "User LED"; | ||
}; | ||
}; | ||
|
||
gpio_keys { | ||
compatible = "gpio-keys"; | ||
|
||
user_button: button { | ||
label = "Wkup_key"; | ||
gpios = <&gpioa 0 GPIO_ACTIVE_LOW>; | ||
zephyr,code = <INPUT_KEY_0>; | ||
}; | ||
}; | ||
|
||
aliases { | ||
led0 = &green_led; | ||
sw0 = &user_button; | ||
}; | ||
}; | ||
|
||
&gpioa { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiob { | ||
status = "okay"; | ||
}; | ||
|
||
&gpioc { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiod { | ||
status = "okay"; | ||
}; | ||
|
||
&gpioe { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiof { | ||
status = "okay"; | ||
}; | ||
|
||
&gpiog { | ||
status = "okay"; | ||
}; | ||
|
||
&gpioh { | ||
status = "okay"; | ||
}; | ||
|
||
&gpioi { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_xtal { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_xtal32 { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_hrc { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_mrc { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_lrc { | ||
status = "okay"; | ||
}; | ||
|
||
&clk_pll { | ||
status = "okay"; | ||
}; | ||
|
||
&usart1 { | ||
status = "okay"; | ||
current-speed = <115200>; | ||
pinctrl-0 = <&usart1_default>; | ||
pinctrl-names = "default"; | ||
interrupt-parent = <&intc>; | ||
interrupts = <HC32_UART1_RXERR_IRQ_NUM HC32_UART1_RXERR_IRQ_PRIO \ | ||
INT_SRC_USART1_EI>, | ||
<HC32_UART1_RX_IRQ_NUM HC32_UART1_RX_IRQ_PRIO \ | ||
INT_SRC_USART1_RI>, | ||
<HC32_UART1_TX_CPLT_IRQ_NUM HC32_UART1_TX_CPLT_IRQ_PRIO \ | ||
INT_SRC_USART1_TCI>; | ||
interrupt-names = "ore", "rxne", "tc"; | ||
}; |
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,16 @@ | ||
identifier: hc32f4a0_evb | ||
name: XHSC hc32f4a0_evb | ||
type: mcu | ||
arch: arm | ||
ram: 512 | ||
flash: 2048 | ||
toolchain: | ||
- zephyr | ||
- gnuarmemb | ||
- xtools | ||
supported: | ||
- gpio | ||
- clock control | ||
- interrupt control | ||
- serial | ||
vendor: xhsc |
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,17 @@ | ||
# Copyright (C) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# Enable MPU | ||
CONFIG_ARM_MPU=y | ||
|
||
# Enable FPU | ||
CONFIG_FPU=y | ||
|
||
# GPIO Controller | ||
CONFIG_GPIO=y | ||
|
||
CONFIG_CLOCK_CONTROL=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,10 @@ | ||
.. _boards-xhsc: | ||
|
||
XHSC | ||
############## | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:glob: | ||
|
||
**/* |
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,7 @@ | ||
# Copyright (C) 2024-2025, Xiaohua Semiconductor Co., Ltd. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
config CLOCK_CONTROL_HC32 | ||
bool "HC32 Clock Control" | ||
XH-YongbingLiu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
default y | ||
depends on DT_HAS_XHSC_HC32_CLOCK_CONTROL_ENABLED |
Oops, something went wrong.
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.