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 66234d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/apps/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ littlefs2-core = "0.1"
# Backends
trussed-auth = { version = "0.3.0", optional = true }
trussed-rsa-alloc = { version = "0.2.0", optional = true }
trussed-se050-backend = { version = "0.3.6", optional = true }
trussed-se050-backend = { version = "0.3.6", optional = true, features = ["log-all"] }
trussed-staging = { version = "0.3.2", features = ["wrap-key-to-file", "chunked", "hkdf", "manage", "fs-info"] }

# Extensions
Expand Down
8 changes: 5 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,9 @@ 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 {
buf: [0; 8192],
};
static mut VOLATILE_FS_ALLOC: Option<Allocation<VolatileStorage>> = None;
static mut VOLATILE_FS: Option<Filesystem<VolatileStorage>> = None;

Expand All @@ -203,7 +206,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 +224,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 66234d6

Please sign in to comment.