{"record":{"id":"5181a274bead7a7e","repo":"embassy-rs/embassy","slug":"multiple-mimxrt-lpc-cargo-features-enabled","errorCode":null,"errorMessage":"Multiple mimxrt/lpc Cargo features enabled","messagePattern":"Multiple mimxrt/lpc Cargo features enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-nxp/build.rs","lineNumber":30,"sourceCode":"use quote::format_ident;\n#[allow(unused)]\nuse quote::quote;\n\n#[path = \"./build_common.rs\"]\nmod common;\n\nfn main() {\n    let mut cfgs = common::CfgSet::new();\n    common::set_target_cfgs(&mut cfgs);\n\n    let chip_name = match env::vars()\n        .map(|(a, _)| a)\n        .filter(|x| x.starts_with(\"CARGO_FEATURE_MIMXRT\") || x.starts_with(\"CARGO_FEATURE_LPC\"))\n        .get_one()\n    {\n        Ok(x) => x,\n        Err(GetOneError::None) => panic!(\"No mimxrt/lpc Cargo feature enabled\"),\n        Err(GetOneError::Multiple) => panic!(\"Multiple mimxrt/lpc Cargo features enabled\"),\n    }\n    .strip_prefix(\"CARGO_FEATURE_\")\n    .unwrap()\n    .to_ascii_lowercase();\n\n    let singletons = singletons(&mut cfgs);\n\n    cfg_aliases! {\n        rt1xxx: { any(feature = \"mimxrt1011\", feature = \"mimxrt1062\") },\n    }\n\n    cfg_aliases! {\n        lpc55: { any(feature = \"lpc55s16\", feature = \"lpc55-core0\") },\n    }\n\n    eprintln!(\"chip: {chip_name}\");\n\n    generate_code(&mut cfgs, &singletons);","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-nxp/build.rs#L12-L48","documentation":"Companion to the 'No mimxrt/lpc Cargo feature enabled' check: the build script requires exactly one chip-family feature. If Cargo's environment exposes more than one `CARGO_FEATURE_MIMXRT*` or `CARGO_FEATURE_LPC*` variable, the chip target is ambiguous, so generation cannot proceed and the script panics.","triggerScenarios":"Cargo.toml lists two or more chip features at once, e.g. `features = [\"mimxrt1062\", \"lpc55s69\"]`, or two crates in the dependency graph each enable a different chip feature for the same embassy-nxp instance.","commonSituations":"Workspace members enabling different NXP chip features that unify; copying feature lists from multiple board examples; enabling both an mimxrt and an lpc feature to 'try both'.","solutions":["Keep exactly one chip feature enabled in your Cargo.toml and remove the others.","If a dependency enables a conflicting chip feature, vendor/patch that crate or align the whole workspace on the same single chip feature.","Use per-target Cargo.toml configurations (`[target.'cfg(...)'.dependencies]`) if building for multiple boards from one workspace."],"exampleFix":"// before\nembassy-nxp = { version = \"0.1\", features = [\"mimxrt1062\", \"lpc55s69\"] }\n// after\nembassy-nxp = { version = \"0.1\", features = [\"mimxrt1062\"] }","handlingStrategy":"validation","validationCode":"# Count enabled NXP chip features in Cargo.toml:\nlet features: Vec<_> = std::env::vars().map(|(a, _)| a).filter(|a| a.starts_with(\"CARGO_FEATURE_MIMXRT\") || a.starts_with(\"CARGO_FEATURE_LPC\")).collect();\nassert_eq!(features.len(), 1, \"exactly one NXP chip feature required: {:?}\", features);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep one canonical chip-feature declaration in the workspace root and reference it elsewhere.","Audit dependency feature unification with `cargo tree -e features` when multiple boards share a workspace.","Never enable two chip features 'to test' — build separate targets instead."],"tags":["embedded","cargo","build-script","feature-flags","nxp","conflict"],"backgroundTag":"conflicting-config-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"}