Patch TinyUSB CDC TX persistence bug - #19606
Open
dpgeorge wants to merge 3 commits into
Open
Conversation
The runtime config was replaced with simpler static macro config in TinyUSB commit 222af862aa2b3898980e3ed8f28e70fe6c9a7ee9. Signed-off-by: Damien George <damien@micropython.org>
See hathach/tinyusb#3807 Signed-off-by: Damien George <damien@micropython.org>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #19606 +/- ##
==========================================
- Coverage 98.59% 98.55% -0.04%
==========================================
Files 182 182
Lines 23320 23320
Branches 5 5
==========================================
- Hits 22992 22984 -8
- Misses 327 335 +8
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code size report: |
Signed-off-by: Damien George <damien@micropython.org>
dpgeorge
force-pushed
the
shared-tinyusb-patch-cdc-device
branch
from
August 12, 2026 03:20
27cd3af to
94c17a9
Compare
Octoprobe PR report
FailuresGroup: run-mpremote-tests.sh
Group: run-tests.py --via-mpy --emit native
|
Member
Author
|
I made an alternative fix in #19607 which forks TinyUSB. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
We recently updated to TinyUSB 0.21.0. At the time of updating we didn't realise that they changed how CDC TX persistence is configured -- from runtime configuration to a static macro configuration.
But in the process of changing that, and their updating to a new streams FIFO, the CDC TX persistence got broken.
This PR aims to patch that bug in tinyusb by applying a small
.patchfile as part of the build process:cdc_device.cfrom the buildcdc_device.ctobuild-BOARD/cdc_device.cBoth CMake (rp2 port) and make (everything else) are covered.
Testing
Tested on RPI_PICO and TEENSY40: the REPL banner now appears correctly after a hard reset (prior to this patch it was corrupted).
Trade-offs and Alternatives
This slightly complicates the build by patching during the build process.
Alternatives:
Generative AI
I used Gemini to give me hints on how to wrangle CMake into getting this to work, but wrote everything myself.