Conversation
…microcontrollers. Replace vendor-specific macros with unified `U_`-prefixed equivalents, ensuring consistency and reducing duplication across all platforms.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9b2f6f4f0c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #ifdef FSDEV_BUS_32BIT | ||
| #define U_EPREG_MASK U_EPREG_MASK_32 | ||
| #else |
There was a problem hiding this comment.
Select endpoint register mask after bus width is known
U_EPREG_MASK is chosen via #ifdef FSDEV_BUS_32BIT here before the vendor headers are included, but FSDEV_BUS_32BIT is defined later (in fsdev_stm32.h and the PMA-size block), so this path resolves to the 16-bit mask. On DRD MCUs (e.g. C0/G0/H5/U0/U3/U5), host paths such as channel_xfer_start() then mask channel registers with U_EPREG_MASK, which drops upper CHEP fields like device address/LSEP/error bits and breaks host transfers once the device address is non-zero.
Useful? React with 👍 / 👎.
TinyUSB Average Code Size Metrics
Input files
|
|
| target | .text | .rodata | .data | .bss | total | % diff |
|---|---|---|---|---|---|---|
| stm32f303disco/hid_composite_freertos | 19,080 → 19,096 (+16) | — | — | — | 19,960 → 19,976 (+16) | +0.1% |
| at32f403a_weact_blackpill/hid_composite_freertos | 20,236 → 20,252 (+16) | — | — | — | 21,144 → 21,160 (+16) | +0.1% |
| at_start_f413/audio_test_freertos | 21,468 → 21,452 (-16) | — | — | — | 22,212 → 22,196 (-16) | -0.1% |
| at32f403a_weact_blackpill/audio_test_freertos | 21,468 → 21,452 (-16) | — | — | — | 22,232 → 22,216 (-16) | -0.1% |
| stm32l412nucleo/hid_composite_freertos | 21,344 → 21,360 (+16) | — | — | — | 22,256 → 22,272 (+16) | +0.1% |
| stm32u083cdk/audio_test_freertos | 22,956 → 22,940 (-16) | — | — | — | 23,544 → 23,528 (-16) | -0.1% |
| stm32f303disco/cdc_msc_freertos | 23,104 → 23,120 (+16) | — | — | — | 23,900 → 23,916 (+16) | +0.1% |
| stm32u083cdk/cdc_msc_freertos | 25,640 → 25,624 (-16) | — | — | — | 26,284 → 26,268 (-16) | -0.1% |
| stm32f303disco/hid_generic_inout | 12,520 → 12,528 (+8) | — | — | — | 13,160 → 13,168 (+8) | +0.1% |
| stm32wb55nucleo/cdc_msc_freertos | 26,152 → 26,168 (+16) | — | — | — | 27,044 → 27,060 (+16) | +0.1% |
The board.cmake, board.mk, and board.h were created but not included in the previous commit, causing CI cmake failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eplace `FSDEV_BUS_32BIT` with `CFG_TUSB_FSDEV_32BIT`, adjust data/address stride macros, and refactor register/PMU access for consistency across platforms.
There was a problem hiding this comment.
Pull request overview
This PR refactors the STM32 FSDEV USB driver to use vendor-independent register bit definitions with a U_ prefix, replacing the previously duplicated and inconsistent USB_* defines that varied across STM32, CH32, and AT32 vendor headers. It also adds BSP support for the STM32U083 Nucleo board.
Changes:
- Introduced unified
U_prefixed register bit definitions infsdev_common.hand removed duplicatedUSB_*defines fromfsdev_stm32.h,fsdev_ch32.h, andfsdev_at32.h - Replaced
FSDEV_BUS_32BITwithCFG_TUSB_FSDEV_32BIT(defined intusb_option.h) and reorganized struct/typedef ordering infsdev_common.h - Added STM32U083 Nucleo board BSP (board.h, board.mk, board.cmake, linker scripts, CubeMX config) and consolidated U0 family linker/clock configuration
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/portable/st/stm32_fsdev/fsdev_common.h | New U_ prefix register definitions, reordered typedefs and vendor includes |
| src/portable/st/stm32_fsdev/fsdev_stm32.h | Removed USB_* alias macros for DRD MCUs, updated connect/disconnect to use FSDEV_REG and U_ defines |
| src/portable/st/stm32_fsdev/fsdev_ch32.h | Removed duplicated USB_* register bit definitions |
| src/portable/st/stm32_fsdev/fsdev_at32.h | Removed duplicated USB_* register bit definitions |
| src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c | Migrated all USB_* references to U_* equivalents |
| src/portable/st/stm32_fsdev/hcd_stm32_fsdev.c | Migrated all USB_* references to U_* equivalents |
| src/portable/st/stm32_fsdev/fsdev_common.c | Migrated USB_* to U_*, FSDEV_BUS_32BIT to CFG_TUSB_FSDEV_32BIT |
| src/tusb_option.h | Added CFG_TUSB_FSDEV_32BIT define and access scheme comments |
| hw/bsp/stm32u0/boards/stm32u083nucleo/* | New Nucleo-U083RC board support |
| hw/bsp/stm32u0/boards/stm32u083cdk/* | Clock config fixes, removed board-specific linker paths |
| hw/bsp/stm32u0/family.* | Generalized linker file resolution, renamed clock init function |
| test/hil/tinyusb.json | Added USB SRAM comments for test boards |
| hw/bsp/stm32u0/linker/* | New/updated linker scripts for STM32U083xx |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
No description provided.