Changing ESP32 partition scheme in arduino-cli

So I was connecting PS3 controller to my “Jerry Annihilator” robot tank the other day, and faced the weirdest (of that day) issue: Arduino’s compilation process was reliably failing with “Sketch is too big” error. Can you imagine?

Sketch is too big

Apparently, Ps3Controller library and its underlying dependency – Bluetooth Low Energy lib – were so big, that they wouldn’t fit into my trusty ESP32 module. However, quick googling suggested that changing partition scheme could help.

Indeed, choosing “Minimal SPIFFS” partition scheme from the “Tools” menu increased program storage space from 1.2MB to 1.9 megs, which is more than enough for my 1.4MB sketch.

Minimal SPIFFS partitioning scheme

So we’re all good, right? No, not entirely. As I mentioned in my previous post, I’m using arduino-cli to compile the sketch on GitLab server. So naturally partition scheme should be specified there as well. But how? Is that even possible?

TL;DR yes, it’s possible, just add --build-properties build.partitions=min_spiffs,upload.maximum_size=1966080 parameter to arduino-cli compile call and magic will happen. But if you want to hear the whole story, stick around for a little bit longer.

Continue reading “Changing ESP32 partition scheme in arduino-cli”