I'm trying to compile this github repository using arduino-cli and trying to change the partition scheme but I'm not being able to correctly use the command. The target board is an ESP32-DevKitC-32E and I'm using arduino-cli v0.31.0.
I'm using this command based on the example I found here.
I tried to use the exact same command but I think something might have changed since 2020 (date of the post of the above link), because the guy in that site uses --build-properties build.partitions=minspiffs,upload.maximum_size=1966080 and if I use the 1966080, the compiler tells me it cannot stat the file 1966080.csv. So, I looked inside the folder and I saw this huge_app.csv file and tried to use it instead! Still no good!
build-property doesn't take multiple options. If we try to use multiple options, one will override the others. So, I tried to compile the sketch only with --build-property build.partitions=huge_app but the problem of the size of the binary file is exactly the same.
Here is the final lines of the output of the command:
tmp/arduino/sketches/E17AC8752314FCAA762532757744502B/NerdMinerV2.ino.elf
esptool.py v3.0-dev
python /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/tools/gen_esp32part.py -q /tmp/arduino/sketches/E17AC8752314FCAA762532757744502B/partitions.csv /tmp/arduino/sketches/E17AC8752314FCAA762532757744502B/NerdMinerV2.ino.partitions.bin
Multiple libraries were found for "WiFi.h"
Used: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
Not used: /home/psysc0rpi0n/Arduino/libraries/WiFiNINA
Using library WiFi at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
Using library WebServer at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WebServer
Using library TFT_eSPI at version 2.5.23 in folder: /home/psysc0rpi0n/Arduino/libraries/TFT_eSPI
Using library SPI at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SPI
Using library FS at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/FS
Using library SPIFFS at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SPIFFS
Using library OpenFontRender at version 1.0.0 in folder: /home/psysc0rpi0n/Arduino/libraries/OpenFontRender
Using library ArduinoJson at version 6.21.1 in folder: /home/psysc0rpi0n/Arduino/libraries/ArduinoJson
Using library WiFiManager at version 2.0.15-rc.1 in folder: /home/psysc0rpi0n/Arduino/libraries/WiFiManager
Using library Update at version 1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Update
Using library DNSServer at version 1.1.0 in folder: /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/DNSServer
/home/psysc0rpi0n/.arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/1.22.0-97-gc752ad5-5.2.0/bin/xtensa-esp32-elf-size -A /tmp/arduino/sketches/E17AC8752314FCAA762532757744502B/NerdMinerV2.ino.elf
Sketch uses 1357754 bytes (103%) of program storage space. Maximum is 1310720 bytes.
Global variables use 40848 bytes (12%) of dynamic memory, leaving 286832 bytes for local variables. Maximum is 327680 bytes.
Sketch too big; see https://support.arduino.cc/hc/en-us/articles/360013825179 for tips on reducing it.
Used library Version Path
WiFi 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
WebServer 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WebServer
TFT_eSPI 2.5.23 /home/psysc0rpi0n/Arduino/libraries/TFT_eSPI
SPI 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SPI
FS 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/FS
SPIFFS 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/SPIFFS
OpenFontRender 1.0.0 /home/psysc0rpi0n/Arduino/libraries/OpenFontRender
ArduinoJson 6.21.1 /home/psysc0rpi0n/Arduino/libraries/ArduinoJson
WiFiManager 2.0.15-rc.1 /home/psysc0rpi0n/Arduino/libraries/WiFiManager
Update 1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/Update
DNSServer 1.1.0 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/DNSServer
Used platform Version Path
esp32:esp32 1.0.6 /home/psysc0rpi0n/.arduino15/packages/esp32/hardware/esp32/1.0.6
Error during build: text section exceeds available space in board
Then, I went to the folder where the binaries are saved, somewhere in /tmp/arudino/sketches/E17.../ and I see that there is a partitions.csv file here. I check the contents and compare them with the same file partitions.csv previously compiled with no --build-property build.partitions=huge_app and I see that the contents are different, so the option is working, however, I get same error about the binary files being too big.
I have been using board-options instead of board-properties. This command lists all board options for an ESP32 dev board.
acli board details -b esp32:esp32:esp32
Option: Partition Scheme PartitionScheme
Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS) ✔ PartitionScheme=default
Default 4MB with ffat (1.2MB APP/1.5MB FATFS) PartitionScheme=defaultffat
8M with spiffs (3MB APP/1.5MB SPIFFS) PartitionScheme=default_8MB
Minimal (1.3MB APP/700KB SPIFFS) PartitionScheme=minimal
No OTA (2MB APP/2MB SPIFFS) PartitionScheme=no_ota
No OTA (1MB APP/3MB SPIFFS) PartitionScheme=noota_3g
No OTA (2MB APP/2MB FATFS) PartitionScheme=noota_ffat
No OTA (1MB APP/3MB FATFS) PartitionScheme=noota_3gffat
Huge APP (3MB No OTA/1MB SPIFFS) PartitionScheme=huge_app
Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS) PartitionScheme=min_spiffs
16M Flash (2MB APP/12.5MB FATFS) PartitionScheme=fatflash
16M Flash (3MB APP/9.9MB FATFS) PartitionScheme=app3M_fat9M_16MB
RainMaker PartitionScheme=rainmaker
The build output shows "Maximum is 3145728 bytes" for program storage so it looks right.
arduino-cli compile -b esp32:esp32:esp32 --board-options PartitionScheme=huge_app hello/
Sketch uses 259217 bytes (8%) of program storage space. Maximum is 3145728 bytes.
Global variables use 22352 bytes (6%) of dynamic memory, leaving 305328 bytes for local variables. Maximum is 327680 bytes.
The Huge APP scheme allocates 3MB for program storage. "Maximum is 3145728 bytes" indicates to me the maximum program storage is 3,145,728 bytes ~ 3MB for the app.
Using the default 1.2MB APP, "Maximum is 1310720 bytes" indicates ~1.2MB allocated for program storage.
esp32.menu.PartitionScheme.huge_app=Huge APP (3MB No OTA/1MB SPIFFS)
esp32.menu.PartitionScheme.huge_app.build.partitions=huge_app
esp32.menu.PartitionScheme.huge_app.upload.maximum_size=3145728
Yours only set the build.partitions property. This is the reason for the different results for the command.
The --build-property flag allows doing very advanced things, but it should be used only when absolutely necessary because it requires an in depth understanding of the Arduino boards platform framework as well as the target platform's configuration. That configuration can change from one release of the platform to another without notice since the properties are not part of the platform's public API. In this case where the platform developers have provided a nice public interface for configuring the partition scheme, it doesn't make sense to use the --build-property flag.