Add TinyUSB serial library support - #162
Open
twhiston wants to merge 1 commit into
Open
Conversation
adrianfreed
added a commit
that referenced
this pull request
Aug 4, 2026
Several cores offer a "USB Stack: TinyUSB" menu option, and with it selected
Serial is an Adafruit_USBD_CDC rather than the core's own class. The include
ladder still pulled in the core's USB header, which redeclares Serial:
adafruit:samd:adafruit_feather_m0:usbstack=tinyusb
USBAPI.h:189: error: conflicting declaration 'Serial_ Serial'
rp2040:rp2040:rpipico:usbstack=tinyusb
SerialUSB.h:87: error: conflicting declaration 'SerialUSB Serial'
Both measured on HEAD before this commit and passing after. Controls that
must not move, all PASS both ways: gemma_m0, rpipico with the default
stack, teensy40, leonardo, esp32.
twhiston's PR #162 identified this and put a USE_TINYUSB branch first in
the ladder, which is the right shape. It is not merged as sent, for two
reasons found by building it:
- It includes <Adafruit_USBD_CDC.h>. That is the header declaring the
class, but it lives in .../Adafruit_TinyUSB_Arduino/src/arduino, which
the cores add with a raw -I. arduino-cli's library resolver never sees
it, so the TinyUSB library is never linked and every target board dies
at "undefined reference to Adafruit_USBD_CDC::begin". Including
<Adafruit_TinyUSB.h> instead is what makes the resolver pull the
library in -- the same trap 46789e6 hit on nRF52.
- Adafruit's nRF52 core defines -DUSE_TINYUSB unconditionally, so as sent
the new branch shadowed the ARDUINO_NRF52_ADAFRUIT arm that 46789e6
added to make that board link, turning feather52840 from PASS to a link
failure.
Using the resolver-visible header fixes the targeted boards and leaves
nRF52 working, so the nRF52 arm is now redundant but harmless.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Adds a check to enable TinyUSB support for SlipEncodedSerial.h