Skip to content

Commit

Permalink
Simplify VFS initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed Dec 9, 2024
1 parent 8bfc4fb commit 12e47f8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions components/boards/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use core::{
marker::PhantomData,
mem::MaybeUninit,
sync::atomic::{AtomicBool, Ordering},
ptr::addr_of_mut,
};

use apps::InitStatus;
Expand Down Expand Up @@ -194,7 +195,7 @@ pub fn init_store<B: Board>(
.compare_exchange_weak(false, true, Ordering::AcqRel, Ordering::Acquire)
.expect("multiple instances of RunnerStore are not allowed");

static mut VOLATILE_STORAGE: Option<VolatileStorage> = None;
static mut VOLATILE_STORAGE: VolatileStorage = VolatileStorage::new();
static mut VOLATILE_FS_ALLOC: Option<Allocation<VolatileStorage>> = None;
static mut VOLATILE_FS: Option<Filesystem<VolatileStorage>> = None;

Expand All @@ -203,7 +204,6 @@ pub fn init_store<B: Board>(
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::<B>(ifs_storage, ifs_alloc, efs_storage, status) {
Expand All @@ -222,7 +222,7 @@ pub fn init_store<B: Board>(
}
};

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);
Expand Down
2 changes: 1 addition & 1 deletion utils/nrf-debugging/walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 12e47f8

Please sign in to comment.