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:
@ -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) }
|
||||
}
|
||||
|
@ -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) }
|
||||
}
|
||||
|
@ -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) }
|
||||
}
|
||||
|
Reference in New Issue
Block a user