[cherryusb][fsdev] add N32H4x USBFS device support - #11764
Conversation
📌 Code Review Assignment🏷️ Tag: componentsReviewers: @Maihuanyi Changed Files (Click to expand)
📊 Current Review Status (Last Updated: 2026-09-11 19:07 CST)
📝 Review Instructions
|
|
👋 感谢您对 RT-Thread 的贡献!Thank you for your contribution to RT-Thread! 为确保代码符合 RT-Thread 的编码规范,请在你的仓库中执行以下步骤运行代码格式化工作流(如果格式化CI运行失败)。 🛠 操作步骤 | Steps
完成后,提交将自动更新至 如有问题欢迎联系我们,再次感谢您的贡献!💐 |
|
usb_dc_fsdev.c rejects building with USB_DBG_LOG enabled:
#if (CONFIG_USB_DBG_LEVEL >= USB_DBG_LOG)
#error "fsdev cannot enable USB_DBG_LOG"
#endif
The static analysis job runs cppcheck with only "-I include -I
thread/components/finsh", so usbd_core.h cannot be resolved and neither
macro is defined. Undefined identifiers evaluate to 0 in a #if, making
the test "0 >= 0" true, so the #error fires and the job fails with
preprocessorErrorDirective.
Add defined() guards so the comparison is only evaluated once both macros
are actually defined. Real builds are unaffected: usb_log.h always
provides USB_DBG_LOG and a default CONFIG_USB_DBG_LEVEL before this point.
摘要
为 cherryusb fsdev 端口添加 N32H4x(N32H47x_48x / N32H49x)USBFS 全速设备支持。N32H4x 使用与 STM32 相同的 Synopsys USBFS 内核,但寄存器/位域重新排布,本 PR 通过寄存器重映射使 fsdev 端口直接适配,无需改动公共驱动逻辑。
主要变更
N32H4X_FSDEV保护的寄存器/位域重映射(32 位 EP 寄存器、CTRL/STS 布局、无 BCDR),usb_dc_fsdev.c的 PCD_* 宏在 N32H4x 上自动解析为正确布局__WEAK可覆盖)、NVIC 配置与USB_FS_LP_IRQHandler分发RT_CHERRYUSB_DEVICE_FSDEV_NATION配置选项测试