Skip to content

Add Serial/USB foot-gun warnings for AVR (ATmega32U4), RP2040, and Teensy#6

Merged
zackees merged 2 commits intocopilot/add-unit-test-cdc-boot-warningfrom
copilot/list-similar-print-boot-issues
Mar 26, 2026
Merged

Add Serial/USB foot-gun warnings for AVR (ATmega32U4), RP2040, and Teensy#6
zackees merged 2 commits intocopilot/add-unit-test-cdc-boot-warningfrom
copilot/list-similar-print-boot-issues

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

Follow-up to #4 (ESP32 ARDUINO_USB_CDC_ON_BOOT=1 warning). Three more platforms silently route Serial.print() over USB CDC, causing hangs or stalls when no USB host is present at boot.

New warnings

Platform Condition Severity
AVR ATmega32U4 (Leonardo, Micro, Pro Micro, …) MCU has native USB — Serial is always USB CDC Blocks indefinitely without host
RP2040 (arduino-pico) Framework defaults Serial to USB CDC Blocks several seconds without host
Teensy (all boards) Default USB_SERIAL mode routes Serial over USB Stalls ~120 ms per write without host

Implementation

  • orchestrator_avr.py_check_native_usb_cdc(board_id, mcu): fires when mcu.lower() == "atmega32u4"; no opt-out (USB is hardwired on this MCU).
  • orchestrator_rp2040.py_check_usb_serial_default(board_id, build_flags): fires for all RP2040 builds; suppressed by -DPICO_STDIO_USB=0 in build_flags.
  • orchestrator_teensy.py_check_usb_serial_mode(board_id, build_flags, platform_config): resolves the effective USB mode using last-definition-wins across platform-config defines + user build_flags; fires only when the resolved mode is USB_SERIAL. Switching to -DUSB_SERIAL_HID, -DUSB_MIDI, etc. suppresses it.

Tests

32 new unit tests across three files following the same pattern as test_cdc_on_boot_warning.py, covering warning fires, board-id in message, opt-out paths, and last-definition-wins semantics.

Original prompt

Pull Request: #4

look for any other similar print or boot related foot guns for esp/avr/nrf/teensy/rp etc

list them all out and then have a follow up PR to merge those in too


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…ensy platforms

Agent-Logs-Url: https://github.com/FastLED/fbuild/sessions/e6b79394-5328-481e-99c8-df11afbe5019

Co-authored-by: zackees <6856673+zackees@users.noreply.github.com>
Copilot AI changed the title [WIP] List print and boot related issues for ESP/AVR/NRF/Teensy/RP Add Serial/USB foot-gun warnings for AVR (ATmega32U4), RP2040, and Teensy Mar 26, 2026
Copilot AI requested a review from zackees March 26, 2026 17:10
@zackees zackees marked this pull request as ready for review March 26, 2026 17:43
@zackees zackees merged commit b20dcfd into copilot/add-unit-test-cdc-boot-warning Mar 26, 2026
@zackees zackees deleted the copilot/list-similar-print-boot-issues branch March 26, 2026 17:43
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.

2 participants