{"record":{"id":"a1789ea3ef818638","repo":"embassy-rs/embassy","slug":"multiple-mspm0xx-mspsxx-cargo-features-enabled","errorCode":null,"errorMessage":"Multiple mspm0xx/mspsxx Cargo features enabled","messagePattern":"Multiple mspm0xx/mspsxx Cargo features enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":43,"sourceCode":"}\n\nfn generate_code(cfgs: &mut CfgSet) {\n    #[cfg(any(feature = \"rt\"))]\n    println!(\n        \"cargo:rustc-link-search={}\",\n        PathBuf::from(env::var_os(\"OUT_DIR\").unwrap()).display(),\n    );\n\n    cfgs.declare_all(&[\"gpio_pb\", \"gpio_pc\", \"int_group1\", \"unicomm\"]);\n\n    let chip_name = match env::vars()\n        .map(|(a, _)| a)\n        .filter(|x| x.starts_with(\"CARGO_FEATURE_MSPM0\") || x.starts_with(\"CARGO_FEATURE_MSPS\"))\n        .get_one()\n    {\n        Ok(x) => x,\n        Err(GetOneError::None) => panic!(\"No mspm0xx/mspsxx Cargo feature enabled\"),\n        Err(GetOneError::Multiple) => panic!(\"Multiple mspm0xx/mspsxx Cargo features enabled\"),\n    }\n    .strip_prefix(\"CARGO_FEATURE_\")\n    .unwrap()\n    .to_ascii_lowercase()\n    .replace('_', \"-\");\n\n    eprintln!(\"chip: {chip_name}\");\n\n    cfgs.enable_all(&get_chip_cfgs(&chip_name));\n    for chip in ALL_CHIPS {\n        cfgs.declare_all(&get_chip_cfgs(&chip));\n    }\n\n    let mut singletons = get_singletons(cfgs);\n\n    time_driver(&mut singletons, cfgs);\n    pin_features(&mut singletons);\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L25-L61","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable only one chip feature on embassy-mspm0, matching your target MCU.","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.","Use `cargo update -p embassy-mspm0 --precise <ver>` if two versions of embassy-mspm0 each enable different chips, then align them."],"exampleFix":"// before\nembassy-mspm0 = { version = \"0.1\", features = [\"mspm0g350x\", \"mspm0l1306\"] }\n// after\nembassy-mspm0 = { version = \"0.1\", features = [\"mspm0g350x\"] }","handlingStrategy":"validation","validationCode":"// Keep exactly one chip feature:\n// features = [\"mspm0g350x\"]  // not [\"mspm0g350x\", \"mspm0l1306\"]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run `cargo tree -i embassy-mspm0` after adding BSP crates to spot conflicting chip features.","Enable chip features in exactly one place in the workspace.","Align embassy-mspm0 versions across dependencies to avoid feature unification surprises."],"tags":["rust","build-script","cargo-features","conflict","embedded"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}