boot: release flash after prepare and refactor api

This refactoring of the chip specific bootloader creates the internal boot instance and aligned
buffer in the prepare stage, so that they are automatically dropped after. This unlocks a use
case where peripherals owning the flash need to be Drop'ed before load() happens.
This commit is contained in:
Ulf Lilleengen
2023-08-11 19:47:24 +02:00
parent c1da2c0219
commit 55ff397c0c
6 changed files with 34 additions and 79 deletions

View File

@ -33,9 +33,7 @@ fn main() -> ! {
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
let active_offset = config.active.offset();
let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
bl.prepare();
let bl: BootLoader = BootLoader::prepare(config);
unsafe { bl.load(active_offset) }
}

View File

@ -29,9 +29,7 @@ fn main() -> ! {
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
let active_offset = config.active.offset();
let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
bl.prepare();
let bl: BootLoader = BootLoader::prepare(config);
unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) }
}

View File

@ -27,9 +27,7 @@ fn main() -> ! {
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
let active_offset = config.active.offset();
let mut bl: BootLoader<_, _, _, 2048> = BootLoader::new(config);
bl.prepare();
let bl = BootLoader::prepare::<_, _, _, 2048>(config);
unsafe { bl.load(BANK1_REGION.base + active_offset) }
}