stm32/usb: Add support for using TinyUSB stack.

This commit adapts the stm32 port to allow switching from STM USB stack to
TinyUSB stack.

Using TinyUSB improves consistancy with other MicroPython ports and brings
in the ability to use the runtime USB definition support recently added to
other TinyUSB based ports.

By default the existing STM USB stack is used.  TinyUSB can be enabled in a
board configuration with:

    #define MICROPY_HW_TINYUSB_STACK (1)

Or, it can be enabled from the command line with:

    make -C ports/stm32 CFLAGS_EXTRA='-DMICROPY_HW_TINYUSB_STACK=1'

Signed-off-by: Andrew Leech <andrew@alelec.net>
This commit is contained in:
Andrew Leech
2025-10-28 16:20:31 +11:00
committed by Damien George
parent 6b0e1c2701
commit 9bb266e311
14 changed files with 256 additions and 40 deletions

View File

@@ -511,7 +511,7 @@ function ci_stm32_nucleo_build {
# Test building various MCU families, some with additional options.
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_F091RC
make ${MAKEOPTS} -C ports/stm32 BOARD=STM32H573I_DK
make ${MAKEOPTS} -C ports/stm32 BOARD=STM32H573I_DK CFLAGS_EXTRA='-DMICROPY_HW_TINYUSB_STACK=1'
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_H743ZI COPT=-O2 CFLAGS_EXTRA='-DMICROPY_PY_THREAD=1'
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L073RZ
make ${MAKEOPTS} -C ports/stm32 BOARD=NUCLEO_L476RG DEBUG=1