Skip to content

Commit f6f29c3

Browse files
Simplify VFS initialization
1 parent 8bfc4fb commit f6f29c3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

components/boards/src/store.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use core::{
22
marker::PhantomData,
33
mem::MaybeUninit,
4+
ptr::addr_of_mut,
45
sync::atomic::{AtomicBool, Ordering},
56
};
67

@@ -194,7 +195,7 @@ pub fn init_store<B: Board>(
194195
.compare_exchange_weak(false, true, Ordering::AcqRel, Ordering::Acquire)
195196
.expect("multiple instances of RunnerStore are not allowed");
196197

197-
static mut VOLATILE_STORAGE: Option<VolatileStorage> = None;
198+
static mut VOLATILE_STORAGE: VolatileStorage = VolatileStorage::new();
198199
static mut VOLATILE_FS_ALLOC: Option<Allocation<VolatileStorage>> = None;
199200
static mut VOLATILE_FS: Option<Filesystem<VolatileStorage>> = None;
200201

@@ -203,7 +204,6 @@ pub fn init_store<B: Board>(
203204
let ifs_alloc = B::ifs_alloc().insert(Filesystem::allocate());
204205
let efs_storage = B::efs_storage().insert(ext_flash);
205206
let efs_alloc = B::efs_alloc().insert(Filesystem::allocate());
206-
let vfs_storage = VOLATILE_STORAGE.insert(VolatileStorage::new());
207207
let vfs_alloc = VOLATILE_FS_ALLOC.insert(Filesystem::allocate());
208208

209209
let ifs = match init_ifs::<B>(ifs_storage, ifs_alloc, efs_storage, status) {
@@ -222,7 +222,7 @@ pub fn init_store<B: Board>(
222222
}
223223
};
224224

225-
let vfs = match init_vfs(vfs_storage, vfs_alloc) {
225+
let vfs = match init_vfs(&mut *addr_of_mut!(VOLATILE_STORAGE), vfs_alloc) {
226226
Ok(vfs) => VOLATILE_FS.insert(vfs),
227227
Err(_e) => {
228228
error!("VFS Mount Error {:?}", _e);

utils/nrf-debugging/walk.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
read_size = args.read_size
2727
prog_size = args.prog_size
2828

29-
block_count = img_size / block_size
29+
block_count = img_size // block_size
3030
if block_count * block_size != img_size:
3131
print("image size should be a multiple of block size")
3232
exit(1)

0 commit comments

Comments
 (0)