embassy-rs/embassy · error
Multiple time-driver-xxx Cargo features enabled
Error message
Multiple time-driver-xxx Cargo features enabled
What it means
embassy-mspm0 supports several time-driver timer choices exposed as `time_driver_<timer>` Cargo features (e.g. time_driver_tima0). The build script's `time_driver` function uses `get_one` to require at most one such feature; when two or more are enabled it panics with this message, failing the build.
Solutions
- Keep exactly one `time_driver_*` feature (or none, for the default) in your embassy-mspm0 dependency.
- Remove the redundant feature: `cargo tree -f '{p} {f}' -i embassy-mspm0` reveals where the extra feature comes from.
- If a dependency enables a time driver, use its chosen driver rather than enabling a conflicting one.
Example fix
// before features = ["time_driver_tima0", "time_driver_timg0"] // after features = ["time_driver_tima0"]
Defensive patterns
Strategy: validation
Validate before calling
// At most one time_driver_* feature: // features = ["mspm0g350x", "time_driver_tima0"]
Prevention
- When switching time drivers, remove the old feature in the same commit.
- Check `cargo tree -f '{p} {f}' -i embassy-mspm0` when a dependency also uses embassy-mspm0.
- Omit time_driver features entirely unless you need a non-default timer.
When it happens
Trigger: Enabling two time-driver features simultaneously, e.g. `features = ["time_driver_tima0", "time_driver_timg0"]`, or having a dependency enable a different time-driver feature that Cargo unifies with yours.
Common situations: Merging two projects' dependency blocks; a BSP crate enabling its own time driver feature; switching drivers by adding the new feature but forgetting to remove the old one.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- Multiple mspm0xx/mspsxx Cargo features enabled
- unknown time_driver
- No mspm0xx/mspsxx Cargo feature enabled
- Multiple time-driver-xxx Cargo features enabled
- time-driver-any requested, but the chip doesn't have a TIM…
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/e14c46da8390e0eb.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-mspm0/build.rs:429
fn time_driver(singletons: &mut Vec<Singleton>, cfgs: &mut CfgSet) {
// Timer features
for (timer, _) in TIMERS.iter() {
let name = timer.to_lowercase();
cfgs.declare(&format!("time_driver_{}", name));
}
let time_driver = match env::vars()
.map(|(a, _)| a)
.filter(|x| x.starts_with("CARGO_FEATURE_TIME_DRIVER_"))
.get_one()
{
Ok(x) => Some(
x.strip_prefix("CARGO_FEATURE_TIME_DRIVER_")
.unwrap()
.to_ascii_lowercase(),
),
Err(GetOneError::None) => None,
Err(GetOneError::Multiple) => panic!("Multiple time-driver-xxx Cargo features enabled"),
};
// Verify the selected timer is available
let selected_timer = match time_driver.as_ref().map(|x| x.as_ref()) {
None => "",
// TODO: Fix TIMB0
// Some("timb0") => "TIMB0",
Some("timg0") => "TIMG0",
Some("timg1") => "TIMG1",
Some("timg2") => "TIMG2",
Some("timg3") => "TIMG3",
Some("timg4") => "TIMG4",
Some("timg5") => "TIMG5",
Some("timg6") => "TIMG6",
Some("timg7") => "TIMG7",
Some("timg8") => "TIMG8",
Some("timg9") => "TIMG9",
Some("timg10") => "TIMG10",View on GitHub (pinned to 463a07b963)