Search code examples
rustembeddedesp32

Circular buffer in virtual memory on esp32?


This article describes using mmap to configure two virtual memory ranges to the same underlying buffer to avoid memory copies for managing circular buffers.

Can esp32 hardware support this? I’d like to use an i2c dma technique to read microphone audio data directly into a circular buffer and hand off windowed ranges of that buffer to tensorflow for analysis all on an esp32 without any avoidable memory copies.

This reddit thread discusses it, but I don’t know enough to interpret the answer. Can those api calls map to memory? Is there an alternative mechanism to achieve my efficiency goals?


Solution

  • No. ESP32 doesn't have virtual memory - at least not with RAM.

    The reddit thread talks about making parts of Flash available from a specific address in the internal 32-bit address space. I guess this could be considered a form of virtual memory but it's quite limited - you can only do it for Flash and only in 64 KiB chunks.