Skip to content

add stm32c5 support#3636

Open
HiFiPhile wants to merge 6 commits into
masterfrom
stm32c5
Open

add stm32c5 support#3636
HiFiPhile wants to merge 6 commits into
masterfrom
stm32c5

Conversation

@HiFiPhile
Copy link
Copy Markdown
Collaborator

stm32c5 uses HAL2 new driver which is a bit different.

Copilot AI review requested due to automatic review settings May 10, 2026 12:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds TinyUSB support scaffolding for the new STM32C5 family (HAL2-based drivers) by wiring the MCU option into the STM32 FSDEV backend, adding a BSP/board definition, and updating dependency fetching + CI/docs accordingly.

Changes:

  • Introduce OPT_MCU_STM32C5 and enable STM32 FSDEV (DRD, 2KB PMA) configuration paths for STM32C5.
  • Add STM32C5 BSP support (make/cmake build files, family implementation, Nucleo-C542 board files, HAL/FreeRTOS config headers).
  • Update dependency lists, CI build matrix, board/docs lists, and example allowlists to include STM32C5.

Reviewed changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/get_deps.py Adds STM32C5 DFP/driver repos and tags STM32C5 under CMSIS_6 fetching.
src/tusb_option.h Adds OPT_MCU_STM32C5 MCU option.
src/portable/st/stm32_fsdev/fsdev_stm32.h Adds STM32C5 header include, IRQ mapping, and CPU MHz setting for FSDEV.
src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c Documents STM32C5 FSDEV characteristics.
src/common/tusb_mcu.h Enables FSDEV+DRD configuration for STM32C5 with 2KB PMA.
README.rst Lists STM32C5 under supported STM32 FSDEV parts.
hw/bsp/stm32c5/stm32c5xx_hal_conf.h Adds STM32C5 HAL2 configuration header template.
hw/bsp/stm32c5/FreeRTOSConfig/FreeRTOSConfig.h Adds FreeRTOS configuration for STM32C5 BSP.
hw/bsp/stm32c5/family.mk Adds make-based build support for STM32C5 family.
hw/bsp/stm32c5/family.cmake Adds CMake build integration for STM32C5 family.
hw/bsp/stm32c5/family.c Adds STM32C5 board API implementation (clock, GPIO, UART, USB IRQ forwarding).
hw/bsp/stm32c5/boards/stm32c542nucleo/board.mk Defines STM32C542 Nucleo variant flags and linker script for make builds.
hw/bsp/stm32c5/boards/stm32c542nucleo/board.h Adds STM32C542 Nucleo pinout and clock init.
hw/bsp/stm32c5/boards/stm32c542nucleo/board.cmake Adds STM32C542 Nucleo compile definitions and linker script paths for CMake.
hw/bsp/BoardPresets.json Adds configure/build presets for stm32c542nucleo.
examples/host/msc_file_explorer/only.txt Allows running this host example on STM32C5.
examples/host/midi_rx/only.txt Allows running this host example on STM32C5.
examples/host/device_info/only.txt Allows running this host example on STM32C5.
examples/host/cdc_msc_hid/only.txt Allows running this host example on STM32C5.
examples/host/cdc_msc_hid_freertos/only.txt Allows running this host example on STM32C5.
examples/host/bare_api/only.txt Allows running this host example on STM32C5.
examples/dual/dynamic_switch/only.txt Allows running this dual-role example on STM32C5.
examples/device/printer_to_cdc/CMakePresets.json Adds preset include file for BoardPresets reuse.
examples/device/cdc_msc_throughput/CMakePresets.json Adds preset include file for BoardPresets reuse.
docs/reference/dependencies.rst Documents STM32C5 DFP/drivers and CMSIS_6 usage in dependencies list.
docs/reference/boards.rst Adds stm32c542nucleo to the boards reference list.
.github/workflows/ci_set_matrix.py Adds stm32c5 to CI toolchain matrix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hw/bsp/stm32c5/family.c
Comment thread hw/bsp/stm32c5/stm32c5xx_hal_conf.h
Comment thread tools/get_deps.py
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 10, 2026

Size Difference Report

Because TinyUSB code size varies by port and configuration, the metrics below represent the averaged totals across all example builds.

Note: If there is no change, only one value is shown.

Changes >1% in size

file .text .rodata .data .bss size % diff
midi_host.c 1341 ➙ 1339 (-2) 7 7 3635 ➙ 3538 (-97) 4979 ➙ 4880 (-99) -2.0%
TOTAL 1341 ➙ 1339 (-2) 7 7 3635 ➙ 3538 (-97) 4979 ➙ 4880 (-99) -2.0%

Changes <1% in size

file .text .rodata .data .bss size % diff
audio_device.c 2896 ➙ 2890 (-6) 0 1259 1625 ➙ 1623 (-2) 4515 ➙ 4508 (-7) -0.2%
cdc_device.c 1239 ➙ 1236 (-3) 16 1092 735 ➙ 728 (-7) 1972 ➙ 1963 (-9) -0.5%
cdc_host.c 6381 ➙ 6367 (-14) 487 15 985 ➙ 962 (-23) 7579 ➙ 7553 (-26) -0.3%
dcd_stm32_fsdev.c 2558 ➙ 2544 (-14) 0 0 291 2849 ➙ 2835 (-14) -0.5%
dfu_device.c 777 ➙ 776 (-1) 28 712 138 ➙ 136 (-2) 914 ➙ 912 (-2) -0.2%
hcd_stm32_fsdev.c 3256 ➙ 3249 (-7) 0 1 420 3677 ➙ 3670 (-7) -0.2%
hid_device.c 1125 ➙ 1123 (-2) 44 997 119 1244 ➙ 1242 (-2) -0.2%
hid_host.c 1240 0 0 1251 ➙ 1270 (+19) 2491 ➙ 2510 (+19) +0.8%
midi_device.c 1151 ➙ 1149 (-2) 0 1007 624 ➙ 619 (-5) 1773 ➙ 1765 (-8) -0.5%
msc_device.c 2517 ➙ 2513 (-4) 108 2281 806 ➙ 804 (-2) 3323 ➙ 3318 (-5) -0.2%
msc_host.c 1638 ➙ 1635 (-3) 0 0 394 ➙ 395 (+1) 2033 ➙ 2030 (-3) -0.1%
mtp_device.c 1706 ➙ 1702 (-4) 22 739 588 ➙ 589 (+1) 2302 ➙ 2298 (-4) -0.2%
ncm_device.c 1757 ➙ 1754 (-3) 28 815 4310 ➙ 4350 (+40) 6080 ➙ 6117 (+37) +0.6%
printer_device.c 830 ➙ 828 (-2) 0 706 566 ➙ 560 (-6) 1394 ➙ 1387 (-7) -0.5%
tusb_fifo.c 847 ➙ 849 (+2) 0 483 0 842 ➙ 844 (+2) +0.2%
usbd.c 3522 ➙ 3518 (-4) 58 91 ➙ 90 (-1) 355 3941 ➙ 3937 (-4) -0.1%
usbh.c 4668 ➙ 4667 (-1) 57 ➙ 58 (+1) 111 ➙ 110 (-1) 1032 ➙ 1035 (+3) 5832 ➙ 5835 (+3) +0.1%
usbtmc_device.c 2196 ➙ 2194 (-2) 24 68 316 ➙ 313 (-3) 2544 ➙ 2539 (-5) -0.2%
vendor_device.c 641 ➙ 639 (-2) 0 534 565 ➙ 559 (-6) 1204 ➙ 1197 (-7) -0.6%
video_device.c 4443 ➙ 4432 (-11) 5 1235 479 ➙ 480 (+1) 4914 ➙ 4904 (-10) -0.2%
TOTAL 45388 ➙ 45305 (-83) 877 ➙ 878 (+1) 12146 ➙ 12144 (-2) 15599 ➙ 15608 (+9) 61423 ➙ 61364 (-59) -0.1%
No changes
file .text .rodata .data .bss size % diff
dcd_ch32_usbfs.c 1475 0 0 2444 3919 +0.0%
dcd_ch32_usbhs.c 1468 0 0 448 1916 +0.0%
dcd_ci_fs.c 1924 0 0 1290 3214 +0.0%
dcd_ci_hs.c 1758 0 0 1344 2535 +0.0%
dcd_da146xx.c 3067 0 0 144 3211 +0.0%
dcd_dwc2.c 4261 19 0 265 4544 +0.0%
dcd_eptri.c 2272 0 0 259 2531 +0.0%
dcd_ft9xx.c 3280 0 0 172 3452 +0.0%
dcd_khci.c 1952 0 0 1290 3242 +0.0%
dcd_lpc17_40.c 1478 0 0 648 1802 +0.0%
dcd_lpc_ip3511.c 1463 0 0 264 1683 +0.0%
dcd_mm32f327x_otg.c 1477 0 0 1290 2767 +0.0%
dcd_msp430x5xx.c 1799 0 0 176 1975 +0.0%
dcd_musb.c 2226 0 0 171 2396 +0.0%
dcd_nrf5x.c 2940 0 0 292 3232 +0.0%
dcd_nuc120.c 1095 0 0 78 1173 +0.0%
dcd_nuc121.c 1168 0 0 101 1270 +0.0%
dcd_nuc505.c 0 0 1532 157 1689 +0.0%
dcd_rp2040.c 841 0 764 653 2258 +0.0%
dcd_rusb2.c 2917 0 0 156 3073 +0.0%
dcd_samd.c 1036 0 0 266 1302 +0.0%
dcd_samg.c 1321 0 0 72 1393 +0.0%
dfu_rt_device.c 157 0 134 0 157 +0.0%
dwc2_common.c 603 22 0 0 615 +0.0%
ecm_rndis_device.c 1059 0 1 2759 3818 +0.0%
ehci.c 2763 0 0 6172 7701 +0.0%
fsdev_common.c 180 0 0 0 180 +0.0%
hcd_ch32_usbfs.c 2485 0 0 498 2983 +0.0%
hcd_ci_hs.c 180 0 0 0 180 +0.0%
hcd_dwc2.c 5014 25 1 513 5552 +0.0%
hcd_khci.c 2442 0 0 449 2891 +0.0%
hcd_musb.c 3070 0 0 157 3228 +0.0%
hcd_pio_usb.c 262 0 240 0 502 +0.0%
hcd_rp2040.c 2000 17 4 321 2342 +0.0%
hcd_rusb2.c 2923 0 0 245 3168 +0.0%
hcd_samd.c 2220 0 0 324 2544 +0.0%
hub.c 1384 8 8 30 1418 +0.0%
ohci.c 1919 0 0 2464 4383 +0.0%
rp2040_usb.c 378 35 631 11 1055 +0.0%
rusb2_common.c 160 0 16 0 176 +0.0%
tusb.c 450 0 383 3 452 +0.0%
typec_stm32.c 820 8 2 12 842 +0.0%
usbc.c 420 2 20 166 608 +0.0%
TOTAL 72107 136 3736 26104 99372 +0.0%

Signed-off-by: HiFiPHile <admin@hifiphile.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 10, 2026

MemBrowse Memory Report

No memory changes detected across 2291 targets. View Project Dashboard →

HiFiPhile added 5 commits May 10, 2026 14:45
Signed-off-by: HiFiPHile <admin@hifiphile.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Signed-off-by: HiFiPhile <admin@hifiphile.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants