HOWTO: M5Stack Fire - use the full 16MB with the Arduino IDE (UPDATED)
For reasons unclear to me, the M5Stack Fire support added to the Board Manager does not change the size of the flash from the original M5Stack Core. What that means is that you cannot use all that extra flash (Fire has 16 MB, classic M5Stack has 4 MB).
Here's how to use the extra space:
Find the directory that on my Mac is at
(It's probably named slightly different on Windows machines, don't use those.)
There, add a file called
default_16MB.csvand put the following lines in it:
# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x640000, app1, app, ota_1, 0x650000,0x640000, eeprom, data, 0x99, 0xc90000,0x1000, spiffs, data, spiffs, 0xc91000,0x36F000,
and add another file called
large_spiffs_16MB.csvand put in it:
# Name, Type, SubType, Offset, Size, Flags nvs, data, nvs, 0x9000, 0x5000, otadata, data, ota, 0xe000, 0x2000, app0, app, ota_0, 0x10000, 0x480000, app1, app, ota_1, 0x490000,0x480000, eeprom, data, 0x99, 0x910000,0x1000, spiffs, data, spiffs, 0x911000,0x6EF000,
Now go two directories up (so for me that would be
~/Library/Arduino15/packages/esp32/hardware/esp32/1.0.0) and edit the file
m5-stack-fire.upload.maximum_sizeand replace that line with:
Then replace the (next) line (
m5stack-fire.build.partitionsand replace that line with:
Then insert the following new section between the
m5stack-fire.menu.PartitionScheme.default=Default (2 x 6.5 MB app, 3.6 MB SPIFFS) m5stack-fire.menu.PartitionScheme.default.build.partitions=default_16MB m5stack-fire.menu.PartitionScheme.large_spiffs=Large SPIFFS (7 MB) m5stack-fire.menu.PartitionScheme.large_spiffs.build.partitions=large_spiffs_16MB m5stack-fire.menu.PartitionScheme.large_spiffs.upload.maximum_size=4685824
And then restart the IDE and you can use the full flash: I chose 2 x 6.5 MB OTA partitions, 3.6 MB SPIFFS. So now the M5ez demo program uses only 18% of one OTA partition. Or opt for a SPIFFS partition that will hold a whopping 7 MB. Nice...
M5Stack people: I know you don't answer questions or talk to us in general, but this is something you people should be doing, not some dude in the community...
Thanks for the how-to. Did you made also a ticket on the arduino gitlab to merge it into the code? If not, at least this is the job of M5Stack stuff to properly support their device in the IDE.
I hesitate because I really don't know how much RAM to allow. Shall I just subtract as much (or a little more) as they did for the 400 kB version? I will if there's no reaction (which would be typical, I'm afraid), but this is stuff that M5Stack should do.
I mean: we don't even have a decent list of what's out there in terms of models and revisions, we don't get answers when we ask questions. I understand they're busy – always on the next version – but I'm beginning to feel someone should redo this whole thing as a true open source / open hardware project.
Partition tables are documented in the esp idf:
ESP32 has 512 kB RAM. This is divided into IRAM (instruction RAM), DRAM (data RAM), and RTC memory.
From the Rechnical Reference pp25 only 328 kB is available as SRAM in two blocks. So 320kB is reasonable. I assume it is only used as an indicator in Arduino for the RAM percentage. PSRAM is only switched on or off, there is no check of size involved.
I updated the post (the SPIFFS was the original size while I had made space to make it bigger) and added a menu option for 7MB SPIFFS. Have also filed the pull request at espressif, all detailed in the edited lead post.