Arduino 2.1.1, Custom Partitions with ESP32 Core

Hello,

Just wondering if anyone can point me in the right direction.

I have a custom board I made with ESP32-S3 SoC.
Using the latest Arduino ESP32 core from Espressif.

I want to create some new partition schemes, but I am having trouble getting them to compile.

I have edited the boards.txt file, and added in the partition listings.
I have created my board variant folder, which is referenced in the boards.txt file.

When it goes to compile, it says it cant find the partitions.csv file though.

When I select say the Adafruit MagTag board, which is set up similar for partitions, its CSV file is in its variants folder, nothing too different in its boards.txt file, but when that compiles, the compile text is quite different and it specifically looks at the Variants folder and the specific CSV selected in the Partition scheme menu, and copies that as is required to make the partitions.csv file.

Mine does not do that, it never looks in the variants folder for the CSV file, to copy over, and I have no idea why. I must be missing something, but I just cant figure out what it is.

If I have the partition csv files in the tools/partitions/ folder, it works fine - however that is not where it 'should' be I think, as I want to eventually submit this to merge into the ESP32 core, and it needs to then be in the Variants folder for my custom board.

Does anyone have any idea what is missing?

Error is:

FQBN: esp32:esp32:xxx-ESP32-S3R8n16
Using board 'xxx-ESP32-S3R8n16' from platform in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9
Using core 'esp32' from platform in folder: C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9

cmd /c if exist "C:\Users\xxx\Documents\Arduino\MinimalTest\partitions.csv" COPY /y "C:\Users\xxx\Documents\Arduino\MinimalTest\partitions.csv" "C:\Users\xxx\AppData\Local\Temp\arduino\sketches\A811B3FA3DA6C70399255D8FABE9EA9C\partitions.csv"
cmd /c if not exist "C:\Users\xxx\AppData\Local\Temp\arduino\sketches\A811B3FA3DA6C70399255D8FABE9EA9C\partitions.csv" if exist "C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\variants\esp32_s3r8n16\partitions.csv" COPY "C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\variants\esp32_s3r8n16\partitions.csv" "C:\Users\xxx\AppData\Local\Temp\arduino\sketches\A811B3FA3DA6C70399255D8FABE9EA9C\partitions.csv"
cmd /c if not exist "C:\Users\xxx\AppData\Local\Temp\arduino\sketches\A811B3FA3DA6C70399255D8FABE9EA9C\partitions.csv" COPY "C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\tools\partitions\partitions-16MB-config1.csv" "C:\Users\xxx\AppData\Local\Temp\arduino\sketches\A811B3FA3DA6C70399255D8FABE9EA9C\partitions.csv"
The system cannot find the file specified.

exit status 1

Compilation error: exit status 1

The CSV file I have selected is called "partitions-16MB-config1.csv" and its in the "C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.9\variants\xxx-esp32-s3r8n16" folder

I just cant find what I am missing.

When I select the Adafruit board, and compile, it shows this (correctly getting their custom CSV file from their variants folder, and copying that):

cmd /c if exist "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\partitions.csv" COPY /y "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\partitions.csv" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\partitions.csv"
cmd /c if not exist "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\partitions.csv" if exist "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\variants\\adafruit_magtag29_esp32s2\\partitions-4MB-tinyuf2.csv" COPY "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\variants\\adafruit_magtag29_esp32s2\\partitions-4MB-tinyuf2.csv" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\partitions.csv"
        1 file(s) copied.
cmd /c if not exist "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\partitions.csv" COPY "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\tools\\partitions\\default.csv" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\partitions.csv"
cmd /c IF EXIST "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\bootloader.bin" ( COPY /y "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\bootloader.bin" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\MinimalTest.ino.bootloader.bin" ) ELSE ( IF EXIST "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\variants\\adafruit_magtag29_esp32s2\\bootloader-tinyuf2.bin" ( COPY "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\variants\\adafruit_magtag29_esp32s2\\bootloader-tinyuf2.bin" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\MinimalTest.ino.bootloader.bin" ) ELSE ( "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\tools\\esptool_py\\4.5.1/esptool.exe" --chip esp32s2 elf2image --flash_mode dio --flash_freq 80m --flash_size 4MB -o "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\MinimalTest.ino.bootloader.bin" "C:\\Users\\xxx\\AppData\\Local\\Arduino15\\packages\\esp32\\hardware\\esp32\\2.0.9\\tools\\sdk\\esp32s2\\bin\\bootloader_qio_80m.elf" ) )
        1 file(s) copied.
cmd /c if exist "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\build_opt.h" COPY /y "C:\\Users\\xxx\\Documents\\Arduino\\MinimalTest\\build_opt.h" "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\build_opt.h"
cmd /c if not exist "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\build_opt.h" type nul > "C:\\Users\\xxx\\AppData\\Local\\Temp\\arduino\\sketches\\A811B3FA3DA6C70399255D8FABE9EA9C\\build_opt.h"

Please help if you know

Thanks

Hi @WanaGo

How did you select it? From the output you shared:

I can see that the default filename partitions.csv configured in the platform.txt configuration file is being used in the generated commands instead of partitions-16MB-config1.csv. This default filename is used if you didn't set a build.custom_partitions property in the board definition:

https://github.com/espressif/arduino-esp32/blob/2.0.9/platform.txt#L138-L146

# This can be overriden in boards.txt

[...]

build.custom_partitions=partitions

You can see how the build.custom_partitions property is set in the board definition of the "Adafruit MagTag 2.9"" board definition here:

That line is quite complex because the board definition uses the "custom board options" feature to allow the user to configure which partition scheme will be used via the Tools > Partition Scheme menu in Arduino IDE when they have selected the "Adafruit MagTag 2.9"" board. If you don't need to provide such configurability for your board definition, then the code to set the property is more simple. For example, if the ID of your board was foobar, then the build.custom_partitions property can be set by adding this line to that board definition in the boards.txt configuration file:

foobar.build.custom_partitions=partitions-16MB-config1
1 Like

Thanks, yes I just discovered this about an hour after posting too.
I could not find this documented anywhere though!

Thank you for confirming I got it right though, the custom_partitions was the key.

Is this docuemented somewhere that you know of?
We searched for ages and could not find the process to set the CSV from the variants folder.

Not that I'm aware of

This partition system is only an arbitrary construct created by the ESP32 boards platform developers using the general purpose "properties" templating system of the Arduino boards platform framework. The partition system itself isn't anything inherent to the platform framework, so it wouldn't be documented by Arduino.

An analogue would be this sketch some 3rd party had written:

byte foo = 123;
void setup() {}
void loop() {}

You could reasonably expect that Arduino would provide documentation about declaring, defining, and assigning variables in general, but it would not make sense to expect Arduino to provide documentation that, in this particular 3rd party sketch, if you don't assign a value to the foo variable then it will default to 123.

If such documentation would be produced, it would either be in documentation targeted to the ESP32 boards platform developers, or in a tutorial produced by some community member on their own initiative.

But I do think we should provide better general documentation of this "properties" system used by the Arduino boards platform. The platform specification is pretty good at helping those who already understand the basics of the system to use the advanced capabilities, but often leaves the basics (which are not at all obvious) to be inferred by the platform developer.

1 Like

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