Repository navigation
Save 25 to 50 bytes of flash by storing "CircuitPython" once in the USB names - #11546
Merged
Merged
Conversation
Each built-in USB interface name (CDC, Mass Storage, HID, MIDI, WebUSB) stored its own copy of USB_INTERFACE_NAME. They now store only the part after it, and usb_add_interface_name() marks the slot so the string table builder puts USB_INTERFACE_NAME in front. Custom names set in boot.py are passed through unchanged. Free flash: trinket_m0 +24 B, circuitplayground_express and metro_m0_express +48 B. Interface names seen by the host are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dhalbert
requested changes
Oct 9, 2026
dhalbert
left a comment
Collaborator
There was a problem hiding this comment.
Thanks - some comments.
The default suffixes no longer start with a space, and the parameter is renamed default_suffix. Saves another 8 bytes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
dhalbert
approved these changes
Oct 10, 2026
dhalbert
left a comment
Collaborator
There was a problem hiding this comment.
Every little bit helps, and I think this is better code all around as well.
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.
What
The built-in USB names share one copy of "CircuitPython", saving 24 to 48 bytes of flash.
Why
Small boards like the Trinket M0 are nearly full.
The names a computer sees do not change.
boot.pyusb_audioandusb_videoare unchanged, to keep names on boards that set their own.Written with Claude Code, which ran the builds and hardware tests.
🤖 Generated with Claude Code