Hello! This is my first post here.

I have a question about memory mapping SPI flash on the ESP32.

The esp32 flash driver suggests "Consider using spi_flash_mmap()" [1]
Does anyone have an example or suggestion for how to do that?

When I try to use spi_flash_mmap() and spi_flash_munmap() as per the docs [2] I run into difficulties: the esp32-idf files that define these functions are not part of a standard NuttX build. In short, after including the relevant headers I end up with undefined symbol `spi_flash_munmap` (but spi_flash_mmap is found, surprisingly). So I guess I need to compile the spi-flash part of esp32-idf as a library and include in my NuttX build - right?

Meanwhile the NuttX codebase has its own implementation of esp32 memory mapping (used for reading encrypted partitions), in the functions esp32_mmap() and esp32_ummap() [3]. Unfortunately they are static in esp32_spiflash.c.

Is the NuttX memory mapping implementation compatible with spi_flash_mmap()? Would it not make sense to make available, in NuttX, an public interface to these functions?

Okay, that was more than one question! Any and all feedback or advice is welcome.
BTW my requirement for memory mapping is to implement XiP.

best regards,


Martin Klang


[1] https://github.com/apache/incubator-nuttx/blob/f49a5797213f2ec3fd348e1826db6e080e7be4d9/arch/risc-v/src/esp32c3/rom/esp32c3_spiflash.h#L934

[2] https://docs.espressif.com/projects/esp-idf/en/release-v3.2/api-reference/storage/spi_flash.html#memory-mapping-apis

[3] https://github.com/apache/incubator-nuttx/blob/master/arch/xtensa/src/esp32/esp32_spiflash.c#L1315

Reply via email to