{"record":{"id":"1b43e5067edf981c","repo":"embassy-rs/embassy","slug":"chip-supports-single-and-dual-bank-configuration","errorCode":null,"errorMessage":"Chip supports single and dual bank configuration. No Cargo feature to select one is enabled. Use the 'single-bank' or 'dual-bank' feature to make your selection","messagePattern":"Chip supports single and dual bank configuration\\. No Cargo feature to select one is enabled\\. Use the 'single-bank' or 'dual-bank' feature to make your selection","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/build.rs","lineNumber":121,"sourceCode":"                && mem.iter().any(|region| region.name.contains(\"BANK_2\"))\n        });\n\n        cfgs.set(\n            \"bank_setup_configurable\",\n            single_bank_memory.is_some() && dual_bank_memory.is_some(),\n        );\n\n        match (single_bank_selected, dual_bank_selected) {\n            (true, true) => panic!(\"Both 'single-bank' and 'dual-bank' features enabled\"),\n            (true, false) => {\n                single_bank_memory.expect(\"The 'single-bank' feature is not supported on this dual bank chip\")\n            }\n            (false, true) => {\n                dual_bank_memory.expect(\"The 'dual-bank' feature is not supported on this single bank chip\")\n            }\n            (false, false) => {\n                if METADATA.memory.len() != 1 {\n                    panic!(\n                        \"Chip supports single and dual bank configuration. No Cargo feature to select one is enabled. Use the 'single-bank' or 'dual-bank' feature to make your selection\"\n                    )\n                }\n                METADATA.memory[0]\n            }\n        }\n    };\n\n    let has_bkpsram = memory.iter().any(|m| m.name == \"BKPSRAM\");\n\n    // ========\n    // Generate singletons\n\n    let mut singletons: Vec<String> = Vec::new();\n\n    // Generate one singleton per pin\n    for p in METADATA.pins {\n        singletons.push(p.name.to_string());","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/build.rs#L103-L139","documentation":"For chips whose flash can be configured as single- or dual-bank, embassy-stm32 needs to know which layout to generate code for. If neither 'single-bank' nor 'dual-bank' feature is enabled and the chip metadata lists more than one memory layout, the choice is ambiguous and the build script panics.","triggerScenarios":"Building for a configurable-bank chip (e.g. H7) with neither bank feature enabled; METADATA.memory.len() > 1 so no single default layout exists.","commonSituations":"Adding the chip feature but forgetting the required bank selection feature; upgrading embassy-stm32 to a version that made the bank features mandatory for your chip; copying a Cargo.toml from a single-bank-only chip.","solutions":["Add either 'single-bank' or 'dual-bank' to embassy-stm32's features, matching your chip's flash option-byte configuration","Consult the chip datasheet / current option bytes to decide which layout applies","If your chip genuinely has only one layout, verify you enabled the correct chip feature — the panic only fires when multiple layouts exist"],"exampleFix":"# before\nembassy-stm32 = { version = \"0.1\", features = [\"stm32h743zi\"] }\n# after\nembassy-stm32 = { version = \"0.1\", features = [\"stm32h743zi\", \"dual-bank\"] }","handlingStrategy":"validation","validationCode":"# for configurable-bank chips, require a bank feature before building\nif cargo tree -f '{f}' -p embassy-stm32 | grep -qvE 'single-bank|dual-bank'; then echo 'add single-bank or dual-bank'; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For H7 and similar chips always add single-bank or dual-bank explicitly","Decide bank layout from the datasheet/option bytes at project setup","Note version upgrades may make bank features mandatory"],"tags":["build-script","cargo-features","flash","stm32"],"backgroundTag":"missing-required-option","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"}