Skip to content

[Fix][BSP][Serial_V2] add Serial V2 buffer configuration via Kconfig #10594 #10602

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
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

wanwandegit
Copy link

@wanwandegit wanwandegit commented Aug 12, 2025

拉取/合并请求描述:(PR description)

[

为什么提交这份PR (why to submit this PR)

stm32/stm32f103-blue-pill中存在编译错误(#10594
经测试,发现STM32的大多数型号都存在该问题。

你的解决方案是什么 (what is your solution)

我尝试复现该issue,但只发生了前3个报错。(或许还需要更多细节?)
解决方法是在bsp\stm32\stm32xxx\board\Kconfig中,添加V2缓冲区相关配置。

请提供验证的bsp和config (provide the config and bsp)

  • BSP:

  • .config:

  • action:

]

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 代码是高质量的 Code in this PR is of high quality
  • 已经使用formatting 等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification
  • 如果是新增bsp, 已经添加ci检查到.github/workflows/bsp_buildings.yml 详细请参考链接BSP自查

@github-actions github-actions bot added BSP: STM32 BSP related with ST/STM32 BSP labels Aug 12, 2025
Copy link

github-actions bot commented Aug 12, 2025

📌 Code Review Assignment

🏷️ Tag: bsp_stm32

Reviewers: Liang1795 hamburger-os wdfk-prog

Changed Files (Click to expand)
  • bsp/stm32/stm32f072-st-nucleo/.config
  • bsp/stm32/stm32f072-st-nucleo/board/Kconfig
  • bsp/stm32/stm32f072-st-nucleo/rtconfig.h
  • bsp/stm32/stm32f091-st-nucleo/.config
  • bsp/stm32/stm32f091-st-nucleo/board/Kconfig
  • bsp/stm32/stm32f091-st-nucleo/rtconfig.h
  • bsp/stm32/stm32f103-100ask-mini/.config
  • bsp/stm32/stm32f103-100ask-mini/board/Kconfig
  • bsp/stm32/stm32f103-100ask-mini/rtconfig.h
  • bsp/stm32/stm32f103-100ask-pro/.config
  • bsp/stm32/stm32f103-100ask-pro/board/Kconfig
  • bsp/stm32/stm32f103-100ask-pro/rtconfig.h
  • bsp/stm32/stm32f103-atk-nano/.config
  • bsp/stm32/stm32f103-atk-nano/board/Kconfig
  • bsp/stm32/stm32f103-atk-nano/rtconfig.h
  • bsp/stm32/stm32f103-atk-warshipv3/.config
  • bsp/stm32/stm32f103-atk-warshipv3/board/Kconfig
  • bsp/stm32/stm32f103-atk-warshipv3/rtconfig.h
  • bsp/stm32/stm32f103-blue-pill/.config
  • bsp/stm32/stm32f103-blue-pill/board/Kconfig
  • bsp/stm32/stm32f103-blue-pill/rtconfig.h
  • bsp/stm32/stm32f103-dofly-M3S/.config
  • bsp/stm32/stm32f103-dofly-M3S/board/Kconfig
  • bsp/stm32/stm32f103-dofly-M3S/rtconfig.h
  • bsp/stm32/stm32f103-dofly-lyc8/.config
  • bsp/stm32/stm32f103-dofly-lyc8/board/Kconfig
  • bsp/stm32/stm32f103-dofly-lyc8/rtconfig.h
  • bsp/stm32/stm32f103-fire-arbitrary/.config
  • bsp/stm32/stm32f103-fire-arbitrary/board/Kconfig
  • bsp/stm32/stm32f103-fire-arbitrary/rtconfig.h

🏷️ Tag: bsp_stm32f103-blue-pill

Reviewers: Liang1795

Changed Files (Click to expand)
  • bsp/stm32/stm32f103-blue-pill/.config
  • bsp/stm32/stm32f103-blue-pill/board/Kconfig
  • bsp/stm32/stm32f103-blue-pill/rtconfig.h

📊 Current Review Status (Last Updated: 2025-08-19 19:32 CST)

  • Liang1795 Pending Review
  • hamburger-os Pending Review
  • wdfk-prog Pending Review

📝 Review Instructions

  1. 维护者可以通过单击此处来刷新审查状态: 🔄 刷新状态
    Maintainers can refresh the review status by clicking here: 🔄 Refresh Status

  2. 确认审核通过后评论 LGTM/lgtm
    Comment LGTM/lgtm after confirming approval

  3. PR合并前需至少一位维护者确认
    PR must be confirmed by at least one maintainer before merging

ℹ️ 刷新CI状态操作需要具备仓库写入权限。
ℹ️ Refresh CI status operation requires repository Write permission.

@wanwandegit wanwandegit changed the title [Fix][BSP] add Serial V2 buffer configuration via Kconfig [Fix][BSP] add Serial V2 buffer configuration via Kconfig #10594 Aug 12, 2025
@wanwandegit
Copy link
Author

按照 #10600 中的建议进行了重新修改

@dongly
Copy link
Contributor

dongly commented Aug 14, 2025

还要生成 rtconfig.h

Copy link
Contributor

@wdfk-prog wdfk-prog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@wanwandegit
Copy link
Author

问题似乎不止在stm32f103-blue-pill中存在,我再进一步改一下

@wanwandegit
Copy link
Author

STM32中的大多数型号都存在该问题,在提交中一并修改了。
前一次提交修改了Kconfig中的原有默认值,现在也改回去了。

@wanwandegit
Copy link
Author

修改行数好像有点多了,可能需要说明一下。
以UART1为例,具体是将bsp\stm32\stm32xxx\board\Kconfigconfig BSP_USING_UART1及之后的内容替换为如下内容(增加导致报错的宏定义以及其他V2缓冲区相关配置):

menuconfig BSP_USING_UART1
                bool "Enable UART1"
                default n  #这里以原默认值为准
                if BSP_USING_UART1
                    config BSP_UART1_RX_USING_DMA
                        bool "Enable UART1 RX DMA"
                        depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
                        default n

                    config BSP_UART1_TX_USING_DMA
                        bool "Enable UART1 TX DMA"
                        depends on BSP_USING_UART1 && RT_SERIAL_USING_DMA
                        default n

                    config BSP_UART1_RX_BUFSIZE
                        int "Set UART1 RX buffer size"
                        range 64 65535
                        depends on RT_USING_SERIAL_V2
                        default 256

                    config BSP_UART1_TX_BUFSIZE
                        int "Set UART1 TX buffer size"
                        range 0 65535
                        depends on RT_USING_SERIAL_V2
                        default 256

                    config BSP_UART1_DMA_PING_BUFSIZE
                        int "Set UART1 RX DMA ping-pong buffer size"
                        range 32 65535
                        depends on RT_USING_SERIAL_V2 && BSP_UART1_RX_USING_DMA
                        default 64    
                endif

因为存在该问题的型号比较多,所以行数看起来很多,实际上只是做了一些替换。

@wanwandegit
Copy link
Author

根据bsp\stm32\stm32f407-rt-spark\board\Kconfig, bsp\stm32\stm32h750-artpi\board\Kconfig, bsp\stm32\stm32h7r7-artpi2\board\Kconfig等文件的内容,TX缓冲区的默认值设为0更加合适。(缓冲区大小和Kconfig中添加的部分也参考自这些文件)

导致 #10594 中错误的原因应该也在于:bsp\stm32\libraries\HAL_Drivers\drivers\drv_usart_v2.c在近期添加了serial_v2相关代码,但配置文件没有及时更新。

@wanwandegit wanwandegit changed the title [Fix][BSP] add Serial V2 buffer configuration via Kconfig #10594 [Fix][BSP][Serial_V2] add Serial V2 buffer configuration via Kconfig #10594 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BSP: STM32 BSP related with ST/STM32 BSP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants