-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Description:
I've encountered an issue with the usb_serial
example in the itsybitsy_m4
crate. When building the example in isolation (i.e., outside of the full atsamd workspace), the firmware compiles successfully, but the device fails to enumerate as a CDC ACM device unless the following build options are set:
lto = true
opt-level = "s"
Without these settings, the USB functionality does not work as expected.
Steps to Reproduce:
- Clone the atsamd repository containing the
itsybitsy_m4
crate. - Copy the
itsybitsy_m4
folder to a standalone location (thus losing the workspace context and the top-levelCargo.toml
). - Build the
usb_serial
example in release without modifying any build profile settings. - Flash the resulting firmware onto an ItsyBitsy M4 board.
- Observe that the board does not register as a CDC ACM device.
Expected Behavior:
The USB serial example should enumerate correctly as a CDC ACM device regardless of the build configuration, or at least the need for these specific build settings should be clearly documented to make USB device implementations easier for users of the crate.
Observed Behavior:
The device only enumerates as a CDC ACM device when building with:
[profile.release]
lto = true
opt-level = "s"
Comments:
- Might be a deeper problem in the rust USB stack
- Optimization level 0 or missing
lto = true
lead to unstable USB enumeration after multiple attempts
Environment
NixOS channel nixos:24.11, rustup
$ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)
$ cargo --version
cargo 1.85.0 (d73d2caf9 2024-12-31)