From 12e47f8e8cd9499f3147523662219dee995bbe8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Mon, 9 Dec 2024 11:57:01 +0100 Subject: [PATCH] Simplify VFS initialization --- components/boards/src/store.rs | 6 +++--- utils/nrf-debugging/walk.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/boards/src/store.rs b/components/boards/src/store.rs index bc989236..cf7e45a2 100644 --- a/components/boards/src/store.rs +++ b/components/boards/src/store.rs @@ -2,6 +2,7 @@ use core::{ marker::PhantomData, mem::MaybeUninit, sync::atomic::{AtomicBool, Ordering}, + ptr::addr_of_mut, }; use apps::InitStatus; @@ -194,7 +195,7 @@ pub fn init_store( .compare_exchange_weak(false, true, Ordering::AcqRel, Ordering::Acquire) .expect("multiple instances of RunnerStore are not allowed"); - static mut VOLATILE_STORAGE: Option = None; + static mut VOLATILE_STORAGE: VolatileStorage = VolatileStorage::new(); static mut VOLATILE_FS_ALLOC: Option> = None; static mut VOLATILE_FS: Option> = None; @@ -203,7 +204,6 @@ pub fn init_store( let ifs_alloc = B::ifs_alloc().insert(Filesystem::allocate()); let efs_storage = B::efs_storage().insert(ext_flash); let efs_alloc = B::efs_alloc().insert(Filesystem::allocate()); - let vfs_storage = VOLATILE_STORAGE.insert(VolatileStorage::new()); let vfs_alloc = VOLATILE_FS_ALLOC.insert(Filesystem::allocate()); let ifs = match init_ifs::(ifs_storage, ifs_alloc, efs_storage, status) { @@ -222,7 +222,7 @@ pub fn init_store( } }; - let vfs = match init_vfs(vfs_storage, vfs_alloc) { + let vfs = match init_vfs(&mut *addr_of_mut!(VOLATILE_STORAGE), vfs_alloc) { Ok(vfs) => VOLATILE_FS.insert(vfs), Err(_e) => { error!("VFS Mount Error {:?}", _e); diff --git a/utils/nrf-debugging/walk.py b/utils/nrf-debugging/walk.py index dccd32f5..875b6775 100644 --- a/utils/nrf-debugging/walk.py +++ b/utils/nrf-debugging/walk.py @@ -26,7 +26,7 @@ read_size = args.read_size prog_size = args.prog_size -block_count = img_size / block_size +block_count = img_size // block_size if block_count * block_size != img_size: print("image size should be a multiple of block size") exit(1)