Specify partition size for ESP32 upload

Hi All,

I am using the CLI with the ESP32 platform.

So far I have used the CLI to compile my project but have struck an issue when uploading. I can upload using the default partition scheme, but unfortunately this is not correct for my project...

upload -p /dev/cu.usbserial-14140 -b esp32:esp32:esp32:FlashMode=qio,UploadSpeed=115200 DIY-Flow_bench -v

What I am stuck on is the correct syntax for specifying the partition scheme.

From boards.txt I can see that the correct scheme is listed as follows

esp32.menu.PartitionScheme.no_ota=No OTA (2MB APP/2MB SPIFFS)
esp32.menu.PartitionScheme.no_ota.build.partitions=no_ota
esp32.menu.PartitionScheme.no_ota.upload.maximum_size=2097152

...and referencing this (apparently successful) post the command should look something like this...

arduino-cli upload -p /dev/cu.usbserial-14140 -b esp32:esp32:esp32 DIY-Flow-Bench -v --build-properties build.partitions=no_ota,upload.maximum_size=2097152

But this gives me the error

Error: unknown flag: --build-properties

So building on the working syntax that I used above I end up with the following...

upload -p /dev/cu.usbserial-14140 -b esp32:esp32:esp32:FlashMode=qio,UploadSpeed=115200,PartitionScheme=no_ota,upload.maximum_size=2097152 DIY-Flow_bench -v

Which invariably throws an error at the maximum_size parameter

Error during Upload: incorrect FQBN: getting build properties for board esp32:esp32:esp32: invalid option 'upload.maximum_size'

So the point that I am up to is that I cannot figure out the correct syntax for the maximum_size parameter...

no_ota.upload.maximum_size=2097152

I've tried a bunch of different ways...

PartitionScheme.maximum_size=2097152
PartitionScheme.no_ota.maximum_size=2097152 
PartitionScheme.no_ota.upload.maximum_size=2097152
no_ota.upload.maximum_size=2097152
upload.maximum_size=2097152

(Well, you get the idea)

But they all result in an error

Error during Upload: incorrect FQBN: getting build properties for board esp32:esp32:esp32: invalid option 'INSERT-WHATEVER-BADLY-FORMED-PARAMETER-I-USED-IN-HERE'

I have also been unsuccessful in searching for a solution. The post I linked to above is the closest I have found, and whilst it was certainly helpful in directing me to the boards.txt file, the syntax given in the post does not work for me and I am unable to decipher the correct format.

Any help / direction / documentation would be warmly welcomed.

I have read through the CLI documentation, but as it does not include specific usage examples I did not find a solution there.

Furthermore (and hopefully not completely off-topic) is it possible to specify the compile / upload / environment in a build file? Similar to PlatformIO?

TIA

/DM

I 'fixed' my problem :smiley:

The partition scheme identifier is unique, so it is not actually necessary to specify the size.

PartitionScheme=no_ota

is all that is required.

So the correct syntax for the upload in this case is...

arduino-cli upload -p /dev/cu.usbserial-14140 -b esp32:esp32:esp32:FlashMode=qio,UploadSpeed=115200,PartitionScheme=no_ota DIY-Flow_bench -v

It was replaced by --build-property back in Arduino CLI 0.14.0:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_compile/

Examples

  arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=\"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=-DPIN=2 \"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property build.extra_flags=-DPIN=2 --build-property "compiler.cpp.extra_flags=\"-DSSID=\"hello world\"\"" /home/user/Arduino/MySketch
     --build-property stringArray   Override a build property with a custom value. Can be used multiple times for multiple properties.

But please don't do it this way. It does work, but it's very inconvenient. The technique you found of specifying the custom board options via the FQBN is the correct way. The --build-property flag is intended for very advanced cases when you need to directly set arbitrary built properties that don't have a more convenient interface like the board options do.

Great work finding the solution! Thanks for taking the time to post an update with your findings.

In case you are curious about how these custom board options work, they are documented here:
https://arduino.github.io/arduino-cli/latest/platform-specification/#custom-board-options


There is something of that nature in the works. The initial planning for the feature is finished and we are now providing a public comment period on out proposal to allow all interested parties the opportunity to give feedback:

1 Like

Thanks for the reply Pert.

I did have a cursory glance through the custom board options but didn't find anything about partitions (as that's obviously very board-specific) so glossed over it a bit. I'll set some time aside to digest the documentation a little better.

I will definitely take a read through the build profile info info that is linked and get some comments together.

Thank you.

/DM

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.