mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
machine/stm32: add OTG FS USB driver for F4/F7
STM32F4 and F7 share the same OTG FS IP but have no USB driver in TinyGo. This adds a full device-mode driver covering CDC, HID, and MSC with working examples. - OTG FS has 4 physical EPs (0–3); virtual indices 4–7 fold onto them via physEP() so the existing machine/usb API is unchanged - F4 bypasses VBUS sensing via GCCFG.NOVBUSSENS; F7 uses the USB voltage regulator + GOTGCTL B-valid override instead - STM32F7 PLL_Q changed 2→9 to produce the 48 MHz clock required by USB/RNG/SDMMC; CK48MSEL cleared to select main PLL as source - HID and MSC descriptors remapped at init() to physical endpoint addresses (EP2/EP1 for HID, EP2/EP3 for MSC) - usb-storage example replaced machine.Flash with a FAT12 RAM disk so the host mounts without reformatting - MSC sendCSW sets queuedBytes before state transition to fix a missed byte-count on the status phase
This commit is contained in:
committed by
Ron Evans
parent
140c82e012
commit
c1a4ed1489
@@ -44,7 +44,7 @@ func TestBinarySize(t *testing.T) {
|
||||
// microcontrollers
|
||||
{"hifive1b", "examples/echo", 3771, 309, 0, 2260},
|
||||
{"microbit", "examples/serial", 2832, 368, 8, 2256},
|
||||
{"wioterminal", "examples/pininterrupt", 8053, 1663, 132, 7488},
|
||||
{"wioterminal", "examples/pininterrupt", 8065, 1663, 132, 7488},
|
||||
|
||||
// TODO: also check wasm. Right now this is difficult, because
|
||||
// wasm binaries are run through wasm-opt and therefore the
|
||||
|
||||
Reference in New Issue
Block a user