Uploading .bin files to ESP32 without Arduino IDE

I recently needed to send new firmware for one of my products to a customer. While he had the neccessary USB-UART converter, he didn’t have any of the software (ie Arduino IDE with ESP32 boards and all the libraries) and I didn’t want to bother him with installing all of that.

Originally, I thought this would be simple – I’ll just generate the .bin file with compiled firmware, send it to him and tell him to download some sort of utility for uploading (that’s at least how it would work with the STM32’s – the utility being their excellent STM32CubeProgrammer). However, the workflow is a little bit more complicated than that, so in this article, I’d like to exaplain what I believe is the simplest method for uploading firmware to an ESP32.

Now, in order to not reinvent the wheel, there’s a pretty good video by Kevin Darrah on uplading compiled binaries to AVRs and ESPs. However, Kevin’s approach still requires the customer (or the end-user) to have Arduino IDE and ESP32 BSP installed (because it invokes the bootloaders etc. from ESP32’s Arduino installation). I wanted my process to be totally IDE-independent, so here’s how it works:

First, you turn on verbose output for uploading in Arduino IDE (File – Preferences) and copy the output. It should look like this:

C:\Users\name\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM12 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 C:\Users\name\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/partitions/boot_app0.bin 0x1000 C:\Users\name\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.4/tools/sdk/bin/bootloader_qio_80m.bin 0x10000 C:\Users\name\AppData\Local\Temp\arduino_build_75007/Sketch-Name.ino.bin 0x8000 C:\Users\name/Sketch-Name.ino.partitions.bin

The five long strings are paths to four *.bin files, which must be uploaded to the ESP32, and one .exe, which is the esptool itself. Now what I did is I copied all those five paths into Windows Explorer and copied the respective files into a single folder. This folder can then be zipped and send to the end user. He unzips it, copies the current path and replaces the <PATH> placeholder. The placeholder <PORT> also needs to be substituted with the relevant COM port name. So the final command looks like this:

<PATH>/esptool.exe --chip esp32 --port <PORT> --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size detect 0xe000 <PATH>/boot_app0.bin 0x1000 <PATH>/bootloader_qio_80m.bin 0x10000 <PATH>/Sketch-Name.ino.bin 0x8000 <PATH>/Sketch-Name.ino.partitions.bin

This command can then be executed in command line, or in Windows by simply pasting it into the Windows Explorer Address Bar (which is a nice trick for people who are not used to working with CMD).

Conclusion

This simple and relatively primitive approach has two advantages, I’d say – you don’t need to install anything (like some sketchy ESP GUI uploaders) or Python in case of the official ESP tool. And you of course don’t need to install the Arduino IDE or anything similar.

2 Replies to “Uploading .bin files to ESP32 without Arduino IDE”

  1. Wow! Very helpful. This was written THREE YEARS AGO, and there is still no simple tool for uploading the ESP32 flash without all this Mickey Mousing around.
    NOTE in the string all the quotes must be removed.

  2. There is an even simpler way.
    Copy all the required application’s files to be loaded/sent to user: .ino.bin, ini.bootloader.bin, and ino.partitions.bin to a single directory of your choosing. Copy in the esptool.exe.
    Create a batch file with the command string but remove the paths and name it “LoadESP32.bat” or whatever.
    Zip them into a single file for distribution.
    The user then extracts the files and runs the batch file.
    Simply executing the batch file will run the exe in the current directory and load the files from the current directory. No need to manipulate path names.
    You could get fancy and add an argument to the batch file of the application’s name. i.e., LoadESP32 MyLatestApp

    Batch file would look something like this:

    echo Loading files for ESP32 app %1
    esptool.exe –chip esp32 –port COM6 –baud 921600 –before default_reset –after hard_reset write_flash -z –flash_mode dio –flash_freq 80m –flash_size 4MB 0x1000 %1.ino.bootloader.bin 0x8000 %1.ino.partitions.bin 0xe000 boot_app0.bin 0x10000 %1.ino.bin

    Note the batch file must be run from the command line to pass an argument. Clicking on the batch file would result in a blank filename.

Leave a Reply

Your email address will not be published.