stm32/usb: Add TinyUSB Mass Storage support.

Implements USB MSC functionality for STM32 port when using TinyUSB stack,
supporting both internal Flash and SD card storage mediums.

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 9bb266e311
commit faae8e73ef
8 changed files with 223 additions and 5 deletions

View File

@@ -280,7 +280,7 @@ static bool init_sdcard_fs(void) {
}
}
#if MICROPY_HW_ENABLE_USB && !MICROPY_HW_TINYUSB_STACK
#if MICROPY_HW_USB_MSC
if (pyb_usb_storage_medium == PYB_USB_STORAGE_MEDIUM_NONE) {
// if no USB MSC medium is selected then use the SD card
pyb_usb_storage_medium = PYB_USB_STORAGE_MEDIUM_SDCARD;
@@ -639,7 +639,7 @@ soft_reset:
}
#endif
#if MICROPY_HW_STM_USB_STACK
#if MICROPY_HW_USB_MSC
// if the SD card isn't used as the USB MSC medium then use the internal flash
if (pyb_usb_storage_medium == PYB_USB_STORAGE_MEDIUM_NONE) {
pyb_usb_storage_medium = PYB_USB_STORAGE_MEDIUM_FLASH;