embassy-rs/embassy · error

Chip supports single and dual bank configuration. No Cargo…

Error message

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

What it means

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.

Solutions

  1. Add either 'single-bank' or 'dual-bank' to embassy-stm32's features, matching your chip's flash option-byte configuration
  2. Consult the chip datasheet / current option bytes to decide which layout applies
  3. If your chip genuinely has only one layout, verify you enabled the correct chip feature — the panic only fires when multiple layouts exist

Example fix

# before
embassy-stm32 = { version = "0.1", features = ["stm32h743zi"] }
# after
embassy-stm32 = { version = "0.1", features = ["stm32h743zi", "dual-bank"] }
Defensive patterns

Strategy: validation

Validate before calling

# for configurable-bank chips, require a bank feature before building
if cargo tree -f '{f}' -p embassy-stm32 | grep -qvE 'single-bank|dual-bank'; then echo 'add single-bank or dual-bank'; fi

Prevention

When it happens

Trigger: Building for a configurable-bank chip (e.g. H7) with neither bank feature enabled; METADATA.memory.len() > 1 so no single default layout exists.

Common situations: 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.

Understand the failure class

Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at embassy-stm32/build.rs:121

                && mem.iter().any(|region| region.name.contains("BANK_2"))
        });

        cfgs.set(
            "bank_setup_configurable",
            single_bank_memory.is_some() && dual_bank_memory.is_some(),
        );

        match (single_bank_selected, dual_bank_selected) {
            (true, true) => panic!("Both 'single-bank' and 'dual-bank' features enabled"),
            (true, false) => {
                single_bank_memory.expect("The 'single-bank' feature is not supported on this dual bank chip")
            }
            (false, true) => {
                dual_bank_memory.expect("The 'dual-bank' feature is not supported on this single bank chip")
            }
            (false, false) => {
                if METADATA.memory.len() != 1 {
                    panic!(
                        "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"
                    )
                }
                METADATA.memory[0]
            }
        }
    };

    let has_bkpsram = memory.iter().any(|m| m.name == "BKPSRAM");

    // ========
    // Generate singletons

    let mut singletons: Vec<String> = Vec::new();

    // Generate one singleton per pin
    for p in METADATA.pins {
        singletons.push(p.name.to_string());

View on GitHub (pinned to 463a07b963)