embassy-rs/embassy · error

Multiple mspm0xx/mspsxx Cargo features enabled

Error message

Multiple mspm0xx/mspsxx Cargo features enabled

What it means

The build script requires exactly one MSPM0/MSPS chip feature because it generates code for a single chip model. When two or more CARGO_FEATURE_MSPM0*/MSPS* variables are present, `get_one` returns `GetOneError::Multiple` and the build panics with this message.

Solutions

  1. Enable only one chip feature on embassy-mspm0, matching your target MCU.
  2. Run `cargo tree -i embassy-mspm0` / `cargo tree -f '{p} {f}'` to find which dependency enables the second chip feature and remove or align it.
  3. Use `cargo update -p embassy-mspm0 --precise <ver>` if two versions of embassy-mspm0 each enable different chips, then align them.

Example fix

// before
embassy-mspm0 = { version = "0.1", features = ["mspm0g350x", "mspm0l1306"] }
// after
embassy-mspm0 = { version = "0.1", features = ["mspm0g350x"] }
Defensive patterns

Strategy: validation

Validate before calling

// Keep exactly one chip feature:
// features = ["mspm0g350x"]  // not ["mspm0g350x", "mspm0l1306"]

Prevention

When it happens

Trigger: Enabling two chip features at once, e.g. `features = ["mspm0g350x", "mspm0l1306"]`, or enabling a chip feature in both a workspace crate and embassy-mspm0 transitively (e.g. via two embassy-mspm0 versions each with different chip features unified by Cargo).

Common situations: Copy-pasting dependency lines from two different board examples; a dependency (BSP crate) pulling embassy-mspm0 with a different chip feature than your direct dependency; accidental feature unification across two versions of embassy-mspm0 in the lockfile.

Related errors


AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10). Data as JSON: /api/errors/a1789ea3ef818638. Report an issue: GitHub.

Appendix: source

Thrown at embassy-mspm0/build.rs:43

}

fn generate_code(cfgs: &mut CfgSet) {
    #[cfg(any(feature = "rt"))]
    println!(
        "cargo:rustc-link-search={}",
        PathBuf::from(env::var_os("OUT_DIR").unwrap()).display(),
    );

    cfgs.declare_all(&["gpio_pb", "gpio_pc", "int_group1", "unicomm"]);

    let chip_name = match env::vars()
        .map(|(a, _)| a)
        .filter(|x| x.starts_with("CARGO_FEATURE_MSPM0") || x.starts_with("CARGO_FEATURE_MSPS"))
        .get_one()
    {
        Ok(x) => x,
        Err(GetOneError::None) => panic!("No mspm0xx/mspsxx Cargo feature enabled"),
        Err(GetOneError::Multiple) => panic!("Multiple mspm0xx/mspsxx Cargo features enabled"),
    }
    .strip_prefix("CARGO_FEATURE_")
    .unwrap()
    .to_ascii_lowercase()
    .replace('_', "-");

    eprintln!("chip: {chip_name}");

    cfgs.enable_all(&get_chip_cfgs(&chip_name));
    for chip in ALL_CHIPS {
        cfgs.declare_all(&get_chip_cfgs(&chip));
    }

    let mut singletons = get_singletons(cfgs);

    time_driver(&mut singletons, cfgs);
    pin_features(&mut singletons);

View on GitHub (pinned to 463a07b963)