{"record":{"id":"d36501223c427999","repo":"embassy-rs/embassy","slug":"bank-1-not-present","errorCode":null,"errorMessage":"Bank 1 not present","messagePattern":"Bank 1 not present","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/build.rs","lineNumber":541,"sourceCode":"                            .any(|f| f.name == \"Memrmp\" && f.fields.iter().any(|f| f.name == \"fb_mode\"))\n                    })\n            });\n\n        let mut bank_1_base = None;\n        let mut bank_2_base = None;\n        let mut otp_base = None;\n        for region in flash_memory_regions.iter() {\n            if region.name == \"BANK_1\" || region.name == \"BANK_1_REGION_1\" {\n                bank_1_base = Some(region.address);\n            } else if region.name == \"BANK_2\" || region.name == \"BANK_2_REGION_1\" {\n                bank_2_base = Some(region.address);\n            } else if region.name == \"OTP\" {\n                otp_base = Some(region.address);\n            }\n        }\n        let bank_1 = bank_1_base\n            .map(|a| quote!(#a))\n            .unwrap_or_else(|| quote!(panic!(\"Bank 1 not present\")));\n        let bank_2 = bank_2_base\n            .map(|a| quote!(#a))\n            .unwrap_or_else(|| quote!(panic!(\"Bank 2 not present\")));\n        let otp = otp_base\n            .map(|a| quote!(#a))\n            .unwrap_or_else(|| quote!(panic!(\"OTP not present\")));\n\n        let (swap_check, bank1, bank2) = if check_fb_mode {\n            (\n                quote! { let is_swapped = crate::pac::SYSCFG.memrmp().read().fb_mode(); },\n                quote! { if is_swapped { #bank_2 } else { #bank_1 } },\n                quote! { if is_swapped { #bank_1 } else { #bank_2 } },\n            )\n        } else {\n            (quote! {}, quote! { #bank_1 }, quote! { #bank_2 })\n        };\n\n        flash_regions.extend(quote! {","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/build.rs#L523-L559","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\nfeatures = [\"stm32h743xx\"]  # wrong variant, no bank1 modeled\n# after\nfeatures = [\"stm32h743zi\"]  # correct variant with flash bank 1","handlingStrategy":"validation","validationCode":"// Only use flash bank APIs on chips with bank 1 modeled:\n// verify region FLASH_BANK_1 exists for your chip feature in embassy-stm32 data","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["flash","stm32","runtime-panic","generated-code"],"backgroundTag":"resource-not-found","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"}