{"record":{"id":"4163408225764c4d","repo":"embassy-rs/embassy","slug":"eeprom-regions-for-chip-are-not-contiguous-whi","errorCode":null,"errorMessage":"EEPROM regions for chip {} are not contiguous, which is unexpected for L0/L1 series. First region: '{}' at {:#X}. Found next non-contiguous region: '{}' at {:#X}. Please verify chip metadata. Embassy currently assumes contiguous EEPROM for these series.","messagePattern":"EEPROM regions for chip (.+?) are not contiguous, which is unexpected for L0/L1 series\\. First region: '(.+?)' at (.+?)\\. Found next non-contiguous region: '(.+?)' at (.+?)\\. Please verify chip metadata\\. Embassy currently assumes contiguous EEPROM for these series\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-stm32/build.rs","lineNumber":2958,"sourceCode":"\n    let eeprom_memory_regions: Vec<&MemoryRegion> =\n        memory.iter().filter(|x| x.kind == MemoryRegionKind::Eeprom).collect();\n\n    if !eeprom_memory_regions.is_empty() {\n        cfgs.enable(\"eeprom\");\n\n        let mut sorted_eeprom_regions = eeprom_memory_regions.clone();\n        sorted_eeprom_regions.sort_by_key(|r| r.address);\n\n        let first_eeprom_address = sorted_eeprom_regions[0].address;\n        let mut total_eeprom_size = 0;\n        let mut current_expected_address = first_eeprom_address;\n\n        for region in sorted_eeprom_regions.iter() {\n            if region.address != current_expected_address {\n                // For STM32L0 and STM32L1, EEPROM regions (if multiple) are expected to be contiguous.\n                // If they are not, this indicates an issue with the chip metadata or an unsupported configuration.\n                panic!(\n                    \"EEPROM regions for chip {} are not contiguous, which is unexpected for L0/L1 series. \\\n                    First region: '{}' at {:#X}. Found next non-contiguous region: '{}' at {:#X}. \\\n                    Please verify chip metadata. Embassy currently assumes contiguous EEPROM for these series.\",\n                    chip_name, sorted_eeprom_regions[0].name, first_eeprom_address, region.name, region.address\n                );\n            }\n            total_eeprom_size += region.size;\n            current_expected_address += region.size;\n        }\n\n        let eeprom_base_usize = first_eeprom_address as usize;\n        let total_eeprom_size_usize = total_eeprom_size as usize;\n\n        g.extend(quote! {\n            pub const EEPROM_BASE: usize = #eeprom_base_usize;\n            pub const EEPROM_SIZE: usize = #total_eeprom_size_usize;\n        });\n    }","sourceCodeStart":2940,"sourceCodeEnd":2976,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-stm32/build.rs#L2940-L2976","documentation":"embassy-stm32's build script validates that, for STM32L0/L1 chips, the EEPROM regions parsed from chip metadata are contiguous in address space. When the next sorted region does not start exactly where the previous one ends, the build panics because the EEPROM driver assumes a single contiguous block for these series. This is a compile-time (build-time) assertion, not a runtime failure.","triggerScenarios":"Running `cargo build` on an embassy-stm32 project targeting an L0/L1 chip whose generated metadata lists multiple EEPROM regions with an address gap (chip_name, first region name/address and offending region name/address are printed in the message).","commonSituations":"Using a recently added or uncommon L0/L1 chip whose metadata files were generated incorrectly; embassy version updates that introduced region parsing for L0/L1; manually edited or regenerated stm32-data metadata.","solutions":["Check the printed region names/addresses and compare against the ST datasheet for that chip","Fix or regenerate the stm32-data metadata for the chip (stm32-data YAML) so EEPROM regions are contiguous","Report/patch the chip metadata in embassy-stm32 or stm32-data upstream if the hardware really is contiguous but metadata is wrong","If the chip genuinely has non-contiguous EEPROM, model it as separate regions instead of relying on the L0/L1 contiguous assumption"],"exampleFix":"// before (chip metadata yaml)\neeprom:\n  - address: 0x08080000\n    size: 1024\n  - address: 0x08081000\n    size: 1024\n// after\n eeprom:\n  - address: 0x08080000\n    size: 1024\n  - address: 0x08080400\n    size: 1024","handlingStrategy":"validation","validationCode":"// build-time: verify EEPROM region contiguity for L0/L1 before building\nlet regions = get_eeprom_regions(chip); // from your metadata source\nlet mut expected = regions[0].address + regions[0].size;\nfor r in &regions[1..] {\n    assert_eq!(r.address, expected, \"non-contiguous EEPROM region {}\", r.name);\n    expected = r.address + r.size;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin a known-good stm32-data / embassy-stm32 version for L0/L1 targets","Inspect the chip's metadata YAML before adopting a new L0/L1 part","Keep EEPROM region definitions aligned with the ST datasheet","Watch upstream embassy-stm32 issues when updating for L0/L1 support"],"tags":["embedded","stm32","build-time","eeprom","rust"],"backgroundTag":"invalid-config-value","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"}