Buenas tardes.
How can I erase the flash memory of esp32. Load some images and it is saturated.
Thanks
Hi.
You can try the code suggested in this article: techtutorialsx.com/2019/02/24/esp32-arduino-formatting-the-spiffs-file-system/
Regards,
Sara
I found info on the flash memory on a few sites on the internet and put these notes together as a reference for myself and thought that they might be useful with your problem …..
You need to figure out what sizes you want, first. The next to the last column is the Offset (how far from start does it start at?) The last column is the size. And remember, certain things have to start at a specific spot, some memory is reserved and it won’t let you start on odd numbers (not sure if they only have to be even or if they have to be in multiples of 16 or 256, etc.)
Memory from 0 to 0x8fff is reserved
nvs, data, nvs, 0x9000, 0x5000, This one has to stay. Don’t change it at all.
Notice this section starts at 0x9000 and is
0x5000 in size, thus right up to the next one
otadata, data, ota, 0xe000, 0x2000, Ditto…well, they MAY be changeable but I wouldn’t try it.
0xe000+0x2000=0x100000 So we’ve used up all this flash for the system
app0, app, ota_0, 0x10000, 0x372000, The app0 MUST start at 0x10000. No way to move that,
starting point either down or (probably) up. So it starts at 0x10000 and is 0x372000 in size. It’s 0x372000 in size, or roughly 3.6Mb.
eeprom, data, 0x99, 0x382000,0x1000,
spiffs, data, spiffs, 0x383000,0x7D000,
You could leave these last two out and gain another close to 1/2Mb (just change the size on the App0.
Also worth noting, the next to the last column (size) seems totally unneeded. If left out, it’ll start it at the end of the previous section.
To use this, it depends on your compiler. Arduino needs the boards file changed. PlatformIO looks for a .csv file created and mentioned in the .ini file
As an example here is what I did to get more program memory by re-allocating the App1 area to App0, but you could use a similar scheme to increase the SPIFS area.
At the moment, this is what the default.csv contains:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x140000,
app1, app, ota_1, 0x150000, 0x140000,
eeprom, data, 0x99, 0x290000, 0x1000,
spiffs, data, spiffs, 0x291000, 0x16F000,
or in Decimal….
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 36,864 20,480
otadata, data, ota, 57,344 8,192
app0, app, ota_0, 65,356, 1,310,720
app1, app, ota_1, 1,376,256 1,310,720
eeprom, data, 0x99, 2,686,976 4,096
spiffs, data, spiffs, 2,691,072 1,503,232
NB. Memory from 0 to 0x8fff (36863) is reserved.
I defined my ESP32 partitions like so:
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x5000,
otadata, data, ota, 0xe000, 0x2000,
app0, app, ota_0, 0x10000, 0x372000,
eeprom, data, 0x99, 0x382000,0x1000,
spiffs, data, spiffs, 0x383000,0x7D000,
So I have a 512KB SPIFFS partition, around 3.5MB partition for app code, and the rest is system use.
Then saved to a new file, my_default.csv (Saved in the project folder at the same level as plarform.ini)
Then referenced in platform.ini with:- board_build.partitions = my-default.csv