Skip to content

Memory Map

The ESP32-P4 has a multi-tier memory architecture with distinct regions for the high-performance (HP) system, low-power (LP) system, and external storage. This page documents the memory available on the ESP32-P4-WIFI6-DEV-KIT.

RegionSizeTypeAccess
HP System ROM128 KBMask ROMRead-only. Contains first-stage bootloader and ROM functions.
LP System ROM16 KBMask ROMRead-only. Contains LP core boot code.
HP L2 Memory768 KBSRAMRead/write. Primary fast memory for HP system code and data.
LP SRAM32 KBSRAMRead/write. Retained during deep sleep for LP core use.
System TCM8 KBSRAMRead/write. Tightly-coupled memory for latency-critical operations.
PSRAM32 MBOctal SPI PSRAMRead/write. Stacked in package. Higher latency than internal SRAM.
NOR Flash16 MBQSPI NOR FlashRead/write (with erase). External chip. Stores firmware and data partitions.

The 768 KB HP L2 memory is the primary working memory for the dual-core HP system. It is accessed through the L2 cache and supports both instruction fetch and data access.

Key characteristics:

  • Single-cycle access through the cache
  • Partitioned between instruction and data by the MMU
  • Available for DMA transfers
  • Lost on power-off or deep sleep (not retained)

The 32 KB LP SRAM is accessible by the LP (low-power) RISC-V core. It is retained during deep sleep, making it suitable for:

  • LP core program storage during sleep
  • Persistent variables across sleep/wake cycles
  • RTC-controlled wake-up logic data

The 8 KB system TCM provides deterministic, zero-wait-state access for latency-critical code and data. Unlike L2 memory, TCM access bypasses the cache, guaranteeing consistent access times regardless of cache state.

Typical uses:

  • Interrupt handlers requiring deterministic timing
  • Real-time control loops
  • DMA descriptor tables

The 32 MB octal SPI PSRAM is stacked inside the ESP32-P4 package (the “NRW32” variant). It is accessed via an octal SPI interface through the SPI cache controller.

ParameterValue
Capacity32 MB (256 Mbit)
InterfaceOctal SPI
Max clockVaries by operating mode
AccessMemory-mapped via cache
RetentionLost on power-off
  • Frame buffers: A single 1080p RGB888 frame requires approximately 6 MB. PSRAM is the only practical location for display and camera frame buffers.
  • Audio buffers: I2S DMA buffers for audio playback and capture.
  • Heap allocation: ESP-IDF can extend the heap into PSRAM for malloc allocations. Use heap_caps_malloc(size, MALLOC_CAP_SPIRAM) for explicit PSRAM allocation.
  • WiFi/Bluetooth buffers: The ESP32-C6 co-processor communication uses shared buffers that may reside in PSRAM.

The 16 MB QSPI NOR flash is an external chip on the board (component 3). It stores:

RegionTypical Use
BootloaderSecond-stage bootloader
Partition tableDefines flash layout
ApplicationFirmware binary (OTA-capable with two app slots)
NVSNon-volatile storage for configuration key-value pairs
FilesystemSPIFFS or LittleFS partition for file storage
CoredumpCrash dump storage (optional)

The partition table is user-configurable. A typical layout for this board:

# Name, Type, SubType, Offset, Size
nvs, data, nvs, 0x9000, 0x6000
phy_init, data, phy, 0xf000, 0x1000
factory, app, factory, 0x10000, 0x200000
storage, data, spiffs, 0x210000, 0xDF0000

The exact layout depends on your application requirements. ESP-IDF’s menuconfig or a custom partitions.csv file defines the partition table.

Address Space (simplified)
-----------------------------------------
Internal:
HP L2 Memory 768 KB Fast SRAM
LP SRAM 32 KB Retained in deep sleep
TCM 8 KB Zero-wait-state
HP ROM 128 KB Boot + ROM functions
LP ROM 16 KB LP boot code
External (memory-mapped via cache):
PSRAM 32 MB Octal SPI, in-package
Flash 16 MB QSPI, external chip

Memory specifications sourced from the ESP32-P4 Datasheet and Waveshare ESP32-P4-WIFI6-DEV-KIT Wiki.