unstable
only.Expand description
§Stability
This API is marked as unstable and is only available when the unstable
crate feature is enabled. This comes with no stability guarantees, and could be changed
or removed at any time.
§PSRAM “virtual peripheral” driver (ESP32-S3)
§Overview
The PSRAM
module provides support for accessing and controlling the
Pseudo Static Random Access Memory (PSRAM)
on the ESP32-S3
.
The PSRAM
module enables users to interface with the PSRAM
memory
present on the ESP32-S3
chip. PSRAM
provides additional external memory
to supplement the internal memory of the ESP32-S3
, allowing for increased
storage capacity and improved performance in certain applications.
The mapped start address for PSRAM depends on the amount of mapped flash memory.
§Examples
§Octal/Quad PSRAM
This example shows how to use PSRAM as heap-memory via esp-alloc.
You need an ESP32-S3 with at least 2 MB of PSRAM memory.
Either Octal
or Quad
PSRAM will be used, depending on the
setting of ESP_HAL_CONFIG_PSRAM_MODE
.
Notice that PSRAM example must be built in release mode!
// Initialize PSRAM and add it as a heap memory region
fn init_psram_heap(start: *mut u8, size: usize) {
unsafe {
esp_alloc::HEAP.add_region(esp_alloc::HeapRegion::new(
start,
size,
esp_alloc::MemoryCapability::External.into(),
));
}
}
// Initialize PSRAM and add it to the heap
let (start, size) = psram::init_psram(peripherals.PSRAM,
psram::PsramConfig::default());
init_psram_heap(start, size);
let mut large_vec: Vec<u32> = Vec::with_capacity(500 * 1024 / 4);
for i in 0..(500 * 1024 / 4) {
large_vec.push((i & 0xff) as u32);
}
let string = String::from("A string allocated in PSRAM");
Structs§
- PSRAM configuration
Enums§
- Frequency of flash memory
- Size of PSRAM
- Frequency of PSRAM memory
- Core timing configuration
Functions§
- Returns the address and size of the available in external memory.