embassy-rs/embassy · error
Bank 1 not present
Error message
Bank 1 not present
What it means
This panic is generated into the flash driver when the chip's metadata contains no FLASH_BANK_1 region, so the generated bank-1 accessor has no address and falls back to `panic!("Bank 1 not present")`. It fires at runtime if flash bank-1 code is called on a chip that has no flash bank 1 defined in embassy-stm32's per-chip data.
Solutions
- Verify you built for a chip that actually has flash bank 1; if so, check embassy-stm32's data for that chip's memory regions.
- Use the correct chip feature name matching your MCU so the right memory map is selected.
- If the chip does have bank 1 but metadata lacks it, report/patch embassy-stm32's per-chip data (memory map definition).
Example fix
# before features = ["stm32h743xx"] # wrong variant, no bank1 modeled # after features = ["stm32h743zi"] # correct variant with flash bank 1
Defensive patterns
Strategy: validation
Validate before calling
// Only use flash bank APIs on chips with bank 1 modeled: // verify region FLASH_BANK_1 exists for your chip feature in embassy-stm32 data
Prevention
- Match the cargo chip feature exactly to your MCU variant.
- Avoid calling flash bank-1 accessors on RAM-only or no-flash parts.
- Search embassy-stm32's chip data for the bank regions when porting to a new MCU.
When it happens
Trigger: Calling flash APIs (e.g. `flash::blocking::Flash::new` or bank functions) on a chip whose memory-map data lacks a bank-1 region, so `bank_1_base` is None when build.rs generates the constant.
Common situations: Using the flash driver on chips where flash banks aren't modeled (RAM-only or unusual parts); chip metadata gaps after adding a new MCU; wrong chip cargo feature selected.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Bank 2 not present
- OTP not present
- Both 'single-bank' and 'dual-bank' features enabled
- Chip supports single and dual bank configuration. No Cargo…
- attempted to use peripheral
AI-assisted analysis of embassy-rs/embassy@463a07b963 (2026-09-10).
Data as JSON: /api/errors/d36501223c427999.
Report an issue: GitHub.
Appendix: source
Thrown at embassy-stm32/build.rs:541
.any(|f| f.name == "Memrmp" && f.fields.iter().any(|f| f.name == "fb_mode"))
})
});
let mut bank_1_base = None;
let mut bank_2_base = None;
let mut otp_base = None;
for region in flash_memory_regions.iter() {
if region.name == "BANK_1" || region.name == "BANK_1_REGION_1" {
bank_1_base = Some(region.address);
} else if region.name == "BANK_2" || region.name == "BANK_2_REGION_1" {
bank_2_base = Some(region.address);
} else if region.name == "OTP" {
otp_base = Some(region.address);
}
}
let bank_1 = bank_1_base
.map(|a| quote!(#a))
.unwrap_or_else(|| quote!(panic!("Bank 1 not present")));
let bank_2 = bank_2_base
.map(|a| quote!(#a))
.unwrap_or_else(|| quote!(panic!("Bank 2 not present")));
let otp = otp_base
.map(|a| quote!(#a))
.unwrap_or_else(|| quote!(panic!("OTP not present")));
let (swap_check, bank1, bank2) = if check_fb_mode {
(
quote! { let is_swapped = crate::pac::SYSCFG.memrmp().read().fb_mode(); },
quote! { if is_swapped { #bank_2 } else { #bank_1 } },
quote! { if is_swapped { #bank_1 } else { #bank_2 } },
)
} else {
(quote! {}, quote! { #bank_1 }, quote! { #bank_2 })
};
flash_regions.extend(quote! {View on GitHub (pinned to 463a07b963)