Allocate ekv buffer in PSRAM
This commit is contained in:
parent
76ed47d687
commit
e0b0aded7b
|
|
@ -16,6 +16,8 @@ use esp_hal::rng::Trng;
|
|||
use esp_storage::FlashStorage;
|
||||
use log::{debug, info};
|
||||
|
||||
use crate::ram::PSRAM_ALLOCATOR;
|
||||
|
||||
pub type PartitionAcid =
|
||||
Partition<'static, CriticalSectionRawMutex, BlockingAsync<FlashStorage<'static>>>;
|
||||
|
||||
|
|
@ -25,7 +27,7 @@ struct AlignedBuf<const N: usize>(pub [u8; N]);
|
|||
|
||||
pub struct EkvFlash<T> {
|
||||
flash: T,
|
||||
buffer: Box<AlignedBuf<{ ekv::config::PAGE_SIZE }>>,
|
||||
buffer: Box<AlignedBuf<{ ekv::config::PAGE_SIZE }>, &'static esp_alloc::EspHeap>,
|
||||
}
|
||||
|
||||
impl<T> EkvFlash<T> {
|
||||
|
|
@ -34,7 +36,7 @@ impl<T> EkvFlash<T> {
|
|||
flash,
|
||||
buffer: {
|
||||
// Allocate the buffer directly on the heap.
|
||||
let buffer = Box::new_zeroed();
|
||||
let buffer = Box::new_zeroed_in(&PSRAM_ALLOCATOR);
|
||||
unsafe { buffer.assume_init() }
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue