tinyusb: change submodule to a MicroPython fork and fix CDC TX persistence issue - #19607
tinyusb: change submodule to a MicroPython fork and fix CDC TX persistence issue#19607dpgeorge wants to merge 2 commits into
Conversation
The runtime config was replaced with simpler static macro config in TinyUSB commit 222af862aa2b3898980e3ed8f28e70fe6c9a7ee9. Signed-off-by: Damien George <damien@micropython.org>
With a patch to fix the CDC TX persistence issue. 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 #19607 +/- ##
==========================================
- 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:
|
projectgus
left a comment
There was a problem hiding this comment.
I like this approach better than #19606, looks good to me.
I did a test to see if any additional steps than git submodule update were needed to switch the remote of an existing submodule checkout. It looks like it worked, even though the output suggested it shouldn't work(!) so I tried again with a clean clone:
❯ git clone --recursive https://github.com/micropython/micropython.git
(snip long clone output)
❯ cd micropython
/tmp/micropython on master via 🐍 v3.14.6
❯ gh pr checkout 19607
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (17/17), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 10 (delta 8), reused 10 (delta 8), pack-reused 0 (from 0)
Unpacking objects: 100% (10/10), 1.09 KiB | 1.09 MiB/s, done.
From https://github.com/micropython/micropython
* [new ref] refs/pull/19607/head -> lib-tinyusb-update-to-fork
Fetching submodule lib/tinyusb
From https://github.com/hathach/tinyusb
+ c598c8239...1c60ee4f0 claude/hil-wedge-containment -> origin/claude/hil-wedge-containment (forced update)
From https://github.com/hathach/tinyusb
* branch b549ac1d84cbbe550c9590951e2290098b3fb16c -> FETCH_HEAD
M lib/tinyusb
Switched to branch 'lib-tinyusb-update-to-fork'
/tmp/micropython on lib-tinyusb-update-to-fork [!] via 🐍 v3.14.6 took 6s
❯ git submodule update
From https://github.com/hathach/tinyusb
* branch b549ac1d84cbbe550c9590951e2290098b3fb16c -> FETCH_HEAD
Submodule path 'lib/tinyusb': checked out 'b549ac1d84cbbe550c9590951e2290098b3fb16c'
/tmp/micropython on lib-tinyusb-update-to-fork via 🐍 v3.14.6
❯ cd lib/tinyusb/
/tmp/mic/lib/tinyusb on HEAD (b549ac1)
❯ git remote -v
origin https://github.com/hathach/tinyusb (fetch)
origin https://github.com/hathach/tinyusb (push)
/tmp/mic/lib/tinyusb on HEAD (b549ac1)
❯ git show HEAD | head -n5
commit b549ac1d84cbbe550c9590951e2290098b3fb16c
Author: Damien George <damien@micropython.org>
Date: Wed Aug 12 15:08:28 2026 +1000
src/class/cdc: don't flush pending data in cdcd_open
/tmp/mic/lib/tinyusb on HEAD (b549ac1)
❯ git show-ref | grep b549
(no output!)
... so it checked out the commit from repo micropython/tinyusb, even though all of the git output indicates it's only fetching from hathach/tinyusb and git isn't tracking any ref for the branch with the HEAD commit on it... Maybe this is some kind of GitHub behind-the-scenes magic, not sure...?
|
Code size report: |
|
Yes, git is doing something behind the scenes, that's for sure. |
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 fix that by forking TinyUSB and applying a patch, then updating the submodule here to point to that fork.
If this is accepted, I'll tag the fork commit as
0.21.0-micropython1.Testing
Tested on RPI_PICO, the REPL banner now appears after a hard reset.
Trade-offs and Alternatives
This is an alternative to #19606.
We already have forks of many repos (eg our own fork of
tinyusb-espressif)... so having a fork of TinyUSB isn't too bad and allows us to fix other bugs in the future if they arise.We have changed submodule links before, eg 2b5feb9 and 305707b so this change to tinyusb submodule shouldn't introduce any additional problems with git.
Generative AI
I did not use generative AI tools when creating this PR.