ESP32: How to specify destination partition for app

I know how to use esptool to write different firmware to different partitions on the ESP32. What I would like to do is when I build the project, to be able to have the built app go to a specific partition. And I would like the other app partition to remain untouched.

My partition file:

# Name,   Type, SubType, Offset,  Size, Flags
nvs,      data, nvs,     0x9000,  0x5000,
otadata,  data, ota,     0xe000,  0x2000,
red,      app,  ota_0,   0x10000, 0xF0000,
blue,     app,  ota_1,   0x100000, 0x80000,

I want to build one project and have my app placed in location “red” or 0x10000 and then build another project and have the app placed in location “blue” 0x100000 - leaving “red” untouched.


You have to create two environments with board_upload.offset_address set accordingly, e.g.,

platform = espressif32
board = esp32dev
framework = espidf
board_build.partitions = partitions_custom.csv

board_upload.offset_address = 0x10000

board_upload.offset_address = 0x100000

Very nice, thank you!