Page 1 of 1

About spi_flash_emulation

Posted: Thu Nov 16, 2023 9:18 am
by nekomiya
Hello, I'm a beginner with ESP32, and I have a board called esp32-s3-lcd-board. Currently, I am running the flashdb demo example for ESP32. I noticed that the code uses functions from spi_flash_emulation for SPI read and write operations, but judging by the file names, it seems like this is an official simulation of SPI FLASH, not the actual hardware FLASH. If I want to store data in the real SPI FLASH on the development board, do I need to rewrite the read and write functions, or does spi_flash_emulation ultimately call into the hardware SPI FLASH?

Re: About spi_flash_emulation

Posted: Wed Nov 22, 2023 1:46 pm
by pacucha42
Hi @nekomiya,
there is no (actively used) SPI flash emulation in ESP IDF now, the only emulated component for storage needs is esp_partition (ie it compiles on Linux and emulates the SPI flash memory by mmaped file. For instance see https://github.com/espressif/esp-idf/tr ... n_api_test - use idf.py --preview set-target linux, compile and run the ELF file).
Host testing is the only scenario using emulation, I don't see the point to do so when porting FlashDB or whatever similar project to ESP32. Anyway, esp_partition APIs should provide all the interfaces needed, no matter whether on host-side or on chip.

If you need further pointers, please let me know.