Partitioning

After my disastrous experience with SPIFFS I am now looking into alternatives. With much trouble I finally succeeded in running with FFat on the Arduino IDE. For the sketch to work I had to set the partitioning to 'Default with ffat'. Then I tried to do the same on my favorite ;-) IDE, but found no place to change the partitioning.

I am sure it can de done, but where and how?

Comments

I need to (manually) add the

I need to (manually) add the extra partition options to the menu. I'll do it when I upgrade to the newer ESP32 core. However, you can manually specify your partitions by creating a file "partitions.csv" in your sketch folder with your partitioning scheme in it. The content of "default_ffat" is:

# 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,
ffat,     data, fat,     0x291000,0x16F000,

However this feature is experimental and may not work... ;)

Didn't work at first, but

Didn't work at first, but then on a hunch I decided to format the flash again, and now it runs along smoothly!

I guess I know what happened: I had started FFat first on Arduino IDE, using their partition setting for FFat. Remember that my attempt on uploading a html file with Arduino tools resulted in an overwritten EEProm + ruined SPIFFS?

The reason probably is that Arduino is using a wrong partitioning scheme. My partition is up to date.

uecide is clearly ahead here ;-)

I actually find it quite convenient to stuff a partition.CSV file in the folder and all is done. It is easy and simple; no need for some menu driven complication.

I created that actually

I created that actually because I had need of a custom partition scheme (lots of program space and OTA available, but no need for SPIFFS). Made more sense than modifying the core to add my own scheme...

Partitioning is highly

Partitioning is highly confusing: I used this code https://github.com/marcmerlin/esp32_fatfsimage/blob/master/arduino/ffat/ffat.inowith line 64 modified to "if(!FFat.begin( 1, "", 1 )){" and ran it first on the Arduino IDE and then on Uecide (and repeated; gave same outcome).

On the A-IDE I got:

Partition list:
partition addr: 0x010000; size: 0x140000; label: app0
partition addr: 0x150000; size: 0x140000; label: app1
partition addr: 0x009000; size: 0x005000; label: nvs
partition addr: 0x00e000; size: 0x002000; label: otadata
partition addr: 0x290000; size: 0x170000; label: ffat

Trying to mount ffat partition if present
File system mounted
Total space: 1458176
Free space: 1458176

But on UECIDE I got:

Partition list:
partition addr: 0x010000; size: 0x140000; label: app0
partition addr: 0x150000; size: 0x140000; label: app1
partition addr: 0x009000; size: 0x005000; label: nvs
partition addr: 0x00e000; size: 0x002000; label: otadata
partition addr: 0x290000; size: 0x001000; label: eeprom
partition addr: 0x291000; size: 0x16f000; label: spiffs

Trying to mount ffat partition if present
FFat Mount Failed

There was no partition.csv file in the folder, but I thought the code is looking into the ESP32 ? Why then do I get a different outcome?

Which of the two gives the real situation on the chip?

They are both correct. When

They are both correct. When you upload to the ESP32 you upload the entire thing, including the partition map. By compiling in UECIDE and uploading with a SPIFFS partition map you replace the existing one with the one you just compiled.

Normally, yes. The "normal"

Normally, yes. The "normal" way of updating just the code is to use OTA updates which will load the code into the currently unused app* partition, verify it, and if it's all correct then switch the boot flag to boot from that partition. I am not aware of any way, currently, to probe the current partition table, compile for that table, then just upload to either the current or alternate app partitions. That's a somewhat tricky operation to arrange...

I have just created a new

I have just created a new programmer to test with - ESPTool for ESP32 (App0 Only). You'll find it in the plugin manager... It's intended to just upload the two partitions "otadata" and "app0" and not touch anything else. Be careful to keep your partitioning schema at least similar. Those two partitions never move, but the app0 one does change in size depending on what profile you have selected.

I also have ESP 1.0.4 in

I also have ESP 1.0.4 in testing at the moment. It's in the "testing" repository if you want to enable that and have a play with it. It has all the partition schemes available in the menu.

The whole thing of ESP and

The whole thing of ESP and Arduino & Co seems still quite immature and many times deeply confusing to newcomers like me. I am so far happy managing it with uecide, and reluctant for too many experiments with the tools.

I attempted once to install - again - a beta from the zip file, expecting it would play like in a sandbox. But it knew right away where my files were and loaded them. Not good for experiments!

If there is something completely sandboxed, I'd be curious enough to try?

You can run as many different

You can run as many different versions of UECIDE with different, separate, installations as you like. Just add the --datadir=/path/to/some/other/folder to the command line and it'll give you a completely fresh installation that's 100% isolated from any other.

I have just been working on a

I have just been working on a little program to extract the partition table from an ESP32 and convert it back into a CSV file.

It's a 2 step operation at the moment - first extract the partition table binary using esptool.py:

python esptool.py --port /dev/ttyUSB0 read_flash 0x8000 0xc00 partitions.bin

Then run my program on that bin file:

esp32part partitions.bin

And it should spit out the CSV file equivalent.

The tool is on github (https://github.com/majenkotech/esp32part) and I will be looking at ways of integrating it within UECIDE so that you can use it to grab a partition table from a live system to make updating of things easier (you won't need to remember what partition table you had on that system you wrote last year...)

I guess I am achieving the

I guess I am achieving the same results with this:

esptool.py --port /dev/ttyUSB1 read_flash 0x8000 0xc00 ptable.img
./gen_esp32part.py ptable.img

1st is identical to your proposal, 2nd is from:
https://github.com/espressif/esp-idf/blob/master/components/partition_table/gen_esp32part.py

in my ESP32 code I now include this to show my partitions:

https://github.com/marcmerlin/esp32_fatfsimage/blob/master/arduino/ffat/ffat.ino

Ooh, I didn't know that went

Ooh, I didn't know that went both ways - I only thought it went from CSV to Binary. That python program is included with the ESP32 core. But I'm not a fan of Espressif's over-use of python scripts...

Pages