Add F4 support

This commit is contained in:
Dion Dokter 2025-04-29 16:55:11 +02:00
parent 1c22087188
commit 5691c61ef9
2 changed files with 14 additions and 8 deletions

View File

@ -56,17 +56,13 @@ fn main() {
let dual_bank_selected = env::var("CARGO_FEATURE_DUAL_BANK").is_ok();
let single_bank_memory = METADATA.memory.iter().find(|mem| {
mem.iter()
.filter(|region| region.kind == MemoryRegionKind::Flash)
.count()
== 1
mem.iter().any(|region| region.name.contains("BANK_1"))
&& !mem.iter().any(|region| region.name.contains("BANK_2"))
});
let dual_bank_memory = METADATA.memory.iter().find(|mem| {
mem.iter()
.filter(|region| region.kind == MemoryRegionKind::Flash)
.count()
== 2
mem.iter().any(|region| region.name.contains("BANK_1"))
&& mem.iter().any(|region| region.name.contains("BANK_2"))
});
cfgs.set(

View File

@ -555,3 +555,13 @@ mod tests {
assert_sector(0x17, FlashBank::Bank2, 7, 0x080E_0000, LARGE_SECTOR_SIZE, 0x080F_FFFF);
}
}
#[cfg(all(bank_setup_configurable))]
pub(crate) fn check_bank_setup() {
if cfg!(feature = "single-bank") && pac::FLASH.optcr().read().db1m() {
panic!("Embassy is configured as single-bank, but the hardware is running in dual-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use dual-bank config");
}
if cfg!(feature = "dual-bank") && !pac::FLASH.optcr().read().db1m() {
panic!("Embassy is configured as dual-bank, but the hardware is running in single-bank mode. Change the hardware by changing the db1m value in the user option bytes or configure embassy to use single-bank config");
}
}