-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[bsp/gd32] add gd32h759i-eval bsp add fix drv_usart.c #10623
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
base: master
Are you sure you want to change the base?
Conversation
如果是新增bsp, 已经添加ci检查到.github/ALL_BSP_COMPILE.json 详细请参考链接BSP自查 |
📌 Code Review Assignment🏷️ Tag: workflowReviewers: Rbb666 kurisaW supperthomas Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2025-08-22 10:18 CST)
📝 Review Instructions
|
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the GD32H759I-EVAL board and introduces DMA functionality for UART in the GD32 BSP. The changes include adding a new board configuration, enabling DMA support for UART operations, and fixing issues in the UART driver implementation.
- Adds new BSP for GD32H759I-EVAL board with complete project configuration
- Implements comprehensive DMA support for UART transmission and reception
- Fixes pin configurations and conditional compilation issues in the UART driver
Reviewed Changes
Copilot reviewed 33 out of 35 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
bsp/gd32/arm/libraries/gd32_drivers/drv_usart.h |
Adds DMA structure definitions and conditionally disables DMA for non-H7 series |
bsp/gd32/arm/libraries/gd32_drivers/drv_usart.c |
Major refactor adding DMA support, interrupt handlers, and GPIO configuration fixes |
bsp/gd32/arm/gd32h759i-start/rtconfig.h |
Disables DMA configuration for start board |
bsp/gd32/arm/gd32h759i-eval/* |
Complete new BSP with project files and configuration |
Comments suppressed due to low confidence (1)
bsp/gd32/arm/libraries/gd32_drivers/drv_usart.c:415
- [bug] Inconsistent GPIO pin configuration for UART0 / UART0的GPIO引脚配置不一致。 English: The removed lines 411-415 showed conflicting pin configurations for UART0 on GD32H7xx. The code originally had separate configurations for H7xx (GPIOF pins 4,5) but now defaults to GPIOA pins 9,10. Verify this is correct for the H7xx series. / 中文:删除的第411-415行显示了GD32H7xx上UART0的引脚配置冲突。代码原本对H7xx有单独配置(GPIOF引脚4,5),但现在默认为GPIOA引脚9,10。请验证这对H7xx系列是否正确。
#if defined SOC_SERIES_GD32F4xx || defined SOC_SERIES_GD32F5xx || defined SOC_SERIES_GD32H7xx
RCU_GPIOA, RCU_GPIOA, /* tx gpio clock, rx gpio clock */
GPIOA, GPIO_AF_7, GPIO_PIN_9, /* tx port, tx alternate, tx pin */
GPIOA, GPIO_AF_7, GPIO_PIN_10, /* rx port, rx alternate, rx pin */
#elif defined SOC_SERIES_GD32E50x
RCU_GPIOA, RCU_GPIOA, /* tx gpio clock, rx gpio clock */
GPIOA, 0, GPIO_PIN_9, /* tx port, tx alternate, tx pin */
GPIOA, 0, GPIO_PIN_10, /* rx port, rx alternate, rx pin */
GPIOA, GPIO_PIN_3, /* rx port, rx pin */ | ||
RCU_GPIOA, RCU_GPIOA, // periph clock, tx gpio clock, rt gpio clock | ||
GPIOA, GPIO_PIN_2, // tx port, tx pin | ||
GPIOA, GPIO_PIN_3, // rx port, rx pin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] [best_practices] Inconsistent comment style / 注释风格不一致。 English: The code mixes C-style (/* /) and C++-style (//) comments. For consistency with RT-Thread coding standards, use C-style comments throughout. / 中文:代码混合使用C风格(/ */)和C++风格(//)注释。为了与RT-Thread编码标准保持一致,应全程使用C风格注释。
GPIOA, GPIO_PIN_3, // rx port, rx pin | |
RCU_GPIOA, RCU_GPIOA, /* periph clock, tx gpio clock, rt gpio clock */ | |
GPIOA, GPIO_PIN_2, /* tx port, tx pin */ | |
GPIOA, GPIO_PIN_3, /* rx port, rx pin */ |
Copilot uses AI. Check for mistakes.
dma_deinit(uart->uart_tx_dma->dma_periph, uart->uart_tx_dma->dma_ch); | ||
|
||
dma_single_data_para_struct_init(&dma_init_struct); | ||
dma_init_struct.request = uart->uart_tx_dma->dma_mux_req_rx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[bug] Incorrect DMA request assignment for TX / TX的DMA请求分配错误。 English: For TX DMA configuration, the code uses dma_mux_req_rx
field, which appears to be for RX operations based on the field name. This should likely use a TX-specific request field. / 中文:在TX DMA配置中,代码使用了dma_mux_req_rx
字段,从字段名来看这似乎是用于RX操作的。这应该使用TX特定的请求字段。
dma_init_struct.request = uart->uart_tx_dma->dma_mux_req_rx; | |
dma_init_struct.request = uart->uart_tx_dma->dma_mux_req_tx; |
Copilot uses AI. Check for mistakes.
@@ -558,13 +1150,29 @@ static void GD32_UART_IRQHandler(struct rt_serial_device *serial) | |||
RT_ASSERT(uart != RT_NULL); | |||
|
|||
/* UART in mode Receiver -------------------------------------------------*/ | |||
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET) && | |||
(usart_flag_get(uart->uart_periph, USART_FLAG_RBNE) != RESET)) | |||
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[bug] Removed USART_FLAG_RBNE check may cause issues / 移除USART_FLAG_RBNE检查可能导致问题。 English: The original code checked both USART_INT_FLAG_RBNE and USART_FLAG_RBNE, but the new code only checks the interrupt flag. This might cause the ISR to trigger even when no data is actually available, leading to potential race conditions. / 中文:原始代码同时检查USART_INT_FLAG_RBNE和USART_FLAG_RBNE,但新代码只检查中断标志。这可能导致即使没有数据可用时ISR也会触发,从而导致潜在的竞争条件。
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET)) | |
if ((usart_interrupt_flag_get(uart->uart_periph, USART_INT_FLAG_RBNE) != RESET) && | |
(usart_flag_get(uart->uart_periph, USART_FLAG_RBNE) != RESET)) |
Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
拉取/合并请求描述:(PR description)
[
并确认并列出已经在什么情况或板卡上进行了测试。
And confirm in which case or board has been tested. -->
为什么提交这份PR (why to submit this PR)
请提供验证的bsp和config (provide the config and bsp)
bsp/gd/arm/gd32h759i-eval
]
当前拉取/合并请求的状态 Intent for your PR
必须选择一项 Choose one (Mandatory):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0
代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up