Skip to content

Conversation

@Kytezign
Copy link
Contributor

@Kytezign Kytezign commented Nov 15, 2025

Introduction

Figured I'd share my progress so far in enabling tinyusb with microzig.
This compiles tinyusb + pico-sdk headers into a static library and links to the firmware.
The short of it is that this seems to work for RP2040 from my limited testing with one significant issue where the USB reset wait seems to stall (but during earlier testing it did not).

When this does happen, I can work around it by commenting out unreset_block_wait(RESETS_RESET_USBCTRL_BITS); in /.../rp2040_usb.c:rp2040_usb_init no clue what is going on there.

Anyway, I don't think this is close to be ready to be pulled in but I am curious to get some feedback from people who might know what they are doing, I embarked on this as a learning exercise and stumbled through it.

Usage example here: https://github.com/Kytezign/rp2xxx_tusb_lib_build

Please let me know your thoughts.

Structural

Tinyusb submodule

I've added a tinyusb module into the microzig project and added it as a new dependency. That tinyusb sub-project is a build script plus a few missing dependencies required for the pico-sdk headers. Currently it also is puling /usr/arm-none-eabi/include. It seems like that should be relatively easy to move away from but I'm not sure what the best option would be short of just copying the missing header files.

The submodule pulls in a specific pico-sdk and related changeset if tinyusb (based on what the pico-sdk points to as a git-submodule). I don't really want to say too much about the actual build flow because I've more or less just stumbled into something that happens to work. But at a high level I've added a function into microzig that links a library to the firmware being built and adds the relevant tinyusb headers to the root module.

In addition to that microzig submodule, there is also a new file in the RP2040 hal area which exports a few functions also needed. A lot of it is related to debugging tinyusb (not needed when debug logging is disabled).

In the end I've done pretty limited testing - only CDC so far.

Issues

There are a lot of issues currently I'm sure, but the ones I'm most keenly aware of are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant