Export of Binary firmware files for ESP32 download tool

I am developing on ESP32 arduino framework and I would like to get the compiled firmware files so I can upload more units using ESP flash download tool.

I got the flash tool from here:
Tools → Flash Download Tool

In project folder/.pio/build/platform/
I found these files

I read I need:

  • bootloader file
  • partition table file
  • firmware/app file.

Could anyone help me to locate these files compiled by platform io and help how to use them in ESP flash tool?

I appreciate any help, Thanks!

I’m not familiar with this ESP32 tool. But I think I have a good idea what it expects.

Run the following command in a terminal:

pio run -v -t upload

In the generated output, there is the full command line for esptool, e.g.:

“/Users/me/.platformio/penv/bin/python2.7” “/Users/me/.platformio/packages/tool-esptoolpy/esptool.py” --chip esp32 --port “/dev/cu.usbmodem144101” --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 /Users/me/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin 0x8000 /Users/me/Documents/PlatformIO/Projects/ESP32Proj/.pio/build/esp32doit-devkit-v1/partitions.bin 0xe000 /Users/me/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/esp32doit-devkit-v1/firmware.bin

If you split the output, you’ll find:

0x1000 /Users/me/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin
0x8000 /Users/me/Documents/PlatformIO/Projects/ESP32Proj/.pio/build/esp32doit-devkit-v1/partitions.bin
0xe000 /Users/me/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin
0x10000 .pio/build/esp32doit-devkit-v1/firmware.bin

I guess these are the files you are looking for. It’s slightly confusing because two files come from your project directory, yet one uses the full and one uses a relative path. Two further files come from the PlatformIO installation directory.


Thanks! works like a charm.

Thank you, helped me a lot.

Sorry for activating this older thread, but this was very helpful. Especially this complete command for esptool is very cool to know.
I made a batch file which collects the bin files to one “BinFiles” folder.
Instead of using the “Flash download tool” mentioned above, it is much more comfortable to install the esptool and use it per command line.

Installing esptool:

pip install esptool
pip install pyserial

Batch file (stored under PlatformIO project folder - new subfolder named “Flash”) to copy bin files to separate folder named “BinFiles”:

@echo off
xcopy "..\.pio\build\esp32dev\firmware.bin" "BinFiles\" /v /f /y
xcopy "..\.pio\build\esp32dev\partitions.bin" "BinFiles\" /v /f /y
xcopy "%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\sdk\bin\bootloader_dio_40m.bin" "BinFiles\" /v /f /y
xcopy "%userprofile%\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin" "BinFiles\" /v /f /y

And the cmd file (also in the “Flash” folder):

@echo off
echo Available COM ports: 
wmic path win32_pnpentity get caption /format:table| find "COM" 
SET /P portNr="Which COM port should be used? Please enter the number: "
SET COMport=COM%PortNr%
echo Using %COMport% ...
esptool.py --chip esp32 --port %COMport% --baud 460800 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 40m --flash_size detect 0x1000 BinFiles\bootloader_dio_40m.bin 0x8000 BinFiles\partitions.bin 0xe000 BinFiles\boot_app0.bin 0x10000 BinFiles\firmware.bin

In this way, I can give the “Flash” folder to anyone who is able to install python and the esptool, and then flash very comfortably a bigger amount of decives with the same binaries. Very cool for my use case.


Very brilliant solution. I have additional info. If you like me landed here because you need to upload Arduino .bin files to an ESP32 that has been completely erase make sure that when you generate the .bin file in Arduino you have manually selected the following parameters (upload speed, flash frequency, partition scheme, core debug level). See the image. Be careful because Arduino will create the .bin even if these paramenters are empty and you will be able to upload it, but once launched your code it will not work, on the serial monitor you will see inizialization and then all blank.

According to the board you are using make sure you respect the partition scheme that you can find in:
In my case I used an ESP32 with 16MB of flash so I selected the SparkFun Esp32 Thing Plus with default_16MB.csv file where to look at the partition. If, like in my case, you need to upload also a spiffs.bin image you can easily create the spiffs image just cliking on Build Filesystem Image in PlatformIO under ‘platform’.
Once you have the spiffs image and you know the partition memory address for spiffs you can upload it together with the other .bins. See the picture.