{"record":{"id":"cbf194e67ebb7230","repo":"embassy-rs/embassy","slug":"no-stm32xx-cargo-feature-enabled-cbf194","errorCode":null,"errorMessage":"No stm32xx Cargo feature enabled","messagePattern":"No stm32xx Cargo feature enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/build.rs","lineNumber":58,"sourceCode":"\nfn main() {\n    let mut cfgs = common::CfgSet::new();\n    common::set_target_cfgs(&mut cfgs);\n\n    if std::env::var(\"CARGO_FEATURE_RT\").is_err()\n        && std::env::var(\"CARGO_CFG_TARGET_OS\") == Ok(\"none\".to_string())\n        && std::env::var(\"CARGO_CFG_TARGET_ARCH\") == Ok(\"arm\".to_string())\n    {\n        println!(\"cargo::warning=Building for bare-metal ARM without `rt` feature: interrupts will loop forever.\");\n    }\n\n    let chip_name = match env::vars()\n        .map(|(a, _)| a)\n        .filter(|x| x.starts_with(\"CARGO_FEATURE_STM32\") && x != \"CARGO_FEATURE_STM32_HRTIM\")\n        .get_one()\n    {\n        Ok(x) => x,\n        Err(GetOneError::None) => panic!(\"No stm32xx Cargo feature enabled\"),\n        Err(GetOneError::Multiple) => panic!(\"Multiple stm32xx Cargo features enabled\"),\n    }\n    .strip_prefix(\"CARGO_FEATURE_\")\n    .unwrap()\n    .to_ascii_lowercase();\n\n    eprintln!(\"chip: {chip_name}\");\n\n    for p in METADATA.peripherals {\n        if let Some(r) = &p.registers {\n            // The AES driver enables the peripheral's clock, which the metadata does not\n            // know for the AES of some chips (STM32L0, L1, F423): no driver there.\n            if r.kind == \"aes\" && p.rcc.is_none() {\n                continue;\n            }\n            cfgs.enable(r.kind);\n            foreach_version_cfg(&mut cfgs, r.kind, r.version, |cfgs, cfg_name| {\n                cfgs.enable(cfg_name);","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/build.rs#L40-L76","documentation":"embassy-stm32's build script generates chip-specific code and must know which STM32 chip to target. It reads env vars starting with CARGO_FEATURE_STM32 (excluding the HRTIM feature); if none exists it panics because no chip feature was enabled.","triggerScenarios":"Adding embassy-stm32 as a dependency without any stm32xx chip feature (e.g. `embassy-stm32 = \"0.1\"` with empty features array) and building.","commonSituations":"Forgetting the features list when adding the dependency; deleting features while debugging; a template or snippet with a placeholder chip name left unfilled.","solutions":["Enable exactly one chip feature in Cargo.toml, e.g. `embassy-stm32 = { version = \"0.1\", features = [\"stm32wb15cc\"] }`","Run `cargo tree -f '{p} {f}'` to verify the feature list actually reaches embassy-stm32","If building a support crate on top, re-export or require the user to enable a chip feature"],"exampleFix":"# before\nembassy-stm32 = \"0.1\"\n# after\nembassy-stm32 = { version = \"0.1\", features = [\"stm32h743zi\"] }","handlingStrategy":"validation","validationCode":"# CI check\ncargo tree -f '{p} {f}' | grep -E 'embassy-stm32 .*stm32' || echo 'MISSING chip feature'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never add embassy-stm32 without a chip feature","Keep a template with the chip feature filled in","Verify builds early in CI rather than locally"],"tags":["build-script","cargo-features","embedded","stm32"],"backgroundTag":"feature-not-enabled","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"}