embassy-rs/embassy · error

The 'dual-bank' feature is not supported on this single…

Error message

The 'dual-bank' feature is not supported on this single bank chip

What it means

The mirror of error 351: the build script panics when the 'dual-bank' Cargo feature is enabled on a chip whose flash memory is single-bank only. The feature selection must match the chip's documented bank layout, so the build fails fast at compile time.

Solutions

  1. Replace the 'dual-bank' feature with 'single-bank' (or remove both if the chip has exactly one memory config).
  2. Check chip metadata: for single-memory parts the build script requires no bank feature or only 'single-bank'.
  3. Avoid cross-target feature sharing; configure bank features per-target.
  4. If using feature unification in a workspace, use resolve-friendly configuration (e.g. separate feature sets per binary).

Example fix

# before
embassy-stm32 = { features = ["stm32g474re", "dual-bank"] }

# after
embassy-stm32 = { features = ["stm32g474re", "single-bank"] }
Defensive patterns

Strategy: validation

Validate before calling

# For single-bank-only chips (e.g. stm32g474re):
# embassy-stm32 = { features = ["stm32g474re", "single-bank"] }
# or omit the bank feature when the chip has only one memory config.

Prevention

When it happens

Trigger: Building with `--features embassy-stm32/dual-bank` for a single-bank-only chip (e.g. many STM32L4/G4 parts, or an H7 part variant with single-bank flash).

Common situations: Copy-pasting a Cargo.toml from a dual-bank project (H7) into a single-bank target; a workspace-wide feature unification pulling 'dual-bank' in for all members; renaming the chip in the features list but leaving the bank feature unchanged.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


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

Appendix: source

Thrown at embassy-stm32/build.rs:117

        });

        let dual_bank_memory = METADATA.memory.iter().find(|mem| {
            mem.iter().any(|region| region.name.contains("BANK_1"))
                && 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();

View on GitHub (pinned to 463a07b963)