Hi Andy,
is just a simple description of the type of memories present in the ESP32 and their functionality.
First of all the ESP32 has internally:
- 520 KB of RAM
- 448 KB ROM
ROM is used by the operating system and cannot be changed.
RAM is mainly used for the operating system and user application.
Depending on the versions of Annex32, the RAM available to the end user is approximately less than 200KB as most of the memory is used by the OS itself and internally by Annex.
Some modules are equipped with an external RAM (called PSRAM or Pseudo Static RAM) to extend the RAM.
The maximum external RAM size that the ESP32 can handle is 4MB so even if the module has an 8MB chip, only 4MB will be available.
Annex32 automatically activates PSRAM if available.
However, there is a limitation because the PSRAM is connected externally via an SPI bus and therefore does not have the same performance as the internal RAM. In addition it lacks additional features (such as DMA).
For these reasons, many parts of the OS require internal RAM which can therefore cause an out of memory even if there is 4MB of PSRAM!
Flash memory:
The ESP32 is equipped with an external flash memory, generally sized at 4MB.
This memory is readable and writable and is generally used to host the "program" (the annex32 binary).
Part of this "memory" can also be used to host a file system (the fatFS) emulating a file disk system.
The ESP32 has the particularity to split the flash memory into partitions
https://docs.espressif.com/projects/esp ... ables.html
These partitions can be modified and adapted depending on the size of binary firmware and the virtual disk.
In the current implementation of AnnexToolkit, the memory is split in 3 main blocks:
1- The firmware
2 - The OTA firmware (a dedicated firmware that handles the updates through the WiFi).
3- The FFAT (the disk partition).
The split of the space into these 3 partitions is function of the size of the flash (4MB, 8MB or 16MB) and function of the binary (Annex32 or AnnexCam).
Because the firmware of the AnnexCam is bigger than the one for the Annex32 (because of the face recognition library that takes a lot of space), the partition dedicated to the disk is smaller.
This explains why it is not possible to flash the ESPCAM with the file system (error "Failed to create fatfs filesystem 14" ) because the space allocated for the disk is too small.