From 0b48212c6dd94d676e37764b7918e4b93dbe1f24 Mon Sep 17 00:00:00 2001 From: Ayodeji Ige Date: Fri, 17 Oct 2025 15:41:19 -0700 Subject: [PATCH] Enable consumer of ec-slimloader-imxrt to construct FlashJournal --- libs/ec-slimloader-imxrt/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/libs/ec-slimloader-imxrt/src/lib.rs b/libs/ec-slimloader-imxrt/src/lib.rs index 5e035fe..f938386 100644 --- a/libs/ec-slimloader-imxrt/src/lib.rs +++ b/libs/ec-slimloader-imxrt/src/lib.rs @@ -43,10 +43,11 @@ const MAX_SLOT_COUNT: usize = 7; pub type ExternalStorage = BlockingAsync>; pub struct Partitions { - pub state: Partition<'static, ExternalStorage, RW, NoopRawMutex>, + pub journal: FlashJournal>, pub slots: Vec, MAX_SLOT_COUNT>, } +#[allow(async_fn_in_trait)] pub trait ImxrtConfig { /// Minimum and maximum image size contained within a slot. const SLOT_SIZE_RANGE: Range; @@ -54,7 +55,7 @@ pub trait ImxrtConfig { /// The memory range an image is allowed to be copied to. const LOAD_RANGE: Range<*mut u32>; - fn partitions(&self, flash: &'static mut PartitionManager) -> Partitions; + async fn partitions(&self, flash: &'static mut PartitionManager) -> Partitions; } #[allow(dead_code)] @@ -105,12 +106,7 @@ impl Board for Imxrt { let ext_flash_manager = EXT_FLASH.init_with(|| PartitionManager::<_, NoopRawMutex>::new(BlockingAsync::new(ext_flash))); - let Partitions { state, slots } = config.partitions(ext_flash_manager); - - let journal = match FlashJournal::new::(state).await { - Ok(journal) => journal, - Err(e) => panic!("Failed to initialize the flash state journal: {:?}", e), - }; + let Partitions { journal, slots } = config.partitions(ext_flash_manager).await; Self { journal,