Support storing in RAM instead of flash
This permits to run without persistent storage. The benefit is that the board doesn't implement a the syscall API in Tock. The disadvantage is that rebooting the key will reset the storage.
This commit is contained in:
committed by
Julien Cretin
parent
9001cbd864
commit
e52a671810
@@ -13,6 +13,7 @@
|
||||
// limitations under the License.
|
||||
|
||||
use super::{Index, Storage, StorageError, StorageResult};
|
||||
use alloc::boxed::Box;
|
||||
|
||||
pub struct BufferStorage {
|
||||
storage: Box<[u8]>,
|
||||
@@ -230,7 +231,7 @@ impl Snapshot {
|
||||
|
||||
fn get(&mut self) -> Result<Box<[u8]>, usize> {
|
||||
let mut snapshot = Snapshot::Ready;
|
||||
std::mem::swap(self, &mut snapshot);
|
||||
core::mem::swap(self, &mut snapshot);
|
||||
match snapshot {
|
||||
Snapshot::Armed { delay } => Err(delay),
|
||||
Snapshot::Taken { storage } => Ok(storage),
|
||||
|
||||
Reference in New Issue
Block a user