Site icon AranaCorp

Generating and uploading BIN files for ESP32

When you have a number of microcontrollers to flash with the same program, it can be interesting to flash the compiled BIN file directly. This has two interests. It saves you time on uploading and it allows third parties to upload a program without using the Arduino IDE.

You should not need it every day but I will show you the method to generate BIN files and upload it to an ESP32 microcontroller. This method can be adapted for other microcontrollers like Arduino and ESP8266 with other tools.

Generate the BIN file with the Arduino IDE

In the Arduino software, go to the File menu then Preferences.

Check the boxes “detailed results during” for compilation and upload (Verbose mode)

Select the port and type of card to which you want to upload the program.

When you press Compile or Upload, the Arduino IDE creates a build file in the folder AppData\Local\Temp\ in which the BIN file is located. You can find the name of the file in the console of the IDE during the compilation or the upload.

After the compilation:

After an upload:

You can copy the generated BIN file somewhere else on your computer.

Upload the BIN file using the Windows command prompt

After launching the upload on the Arduino IDE, you get the upload command.

You can copy this line into the command prompt to upload the program to the microcontroller. Don’t forget to modify with the new path of the BIN file and to add quotation marks around the paths containing spaces, if needed.

Then press the “Enter” key to upload the program. (Tip: once you know the command, you can create a bash file to automate the process).

N.B.: If you want to upload the BIN file from another computer (especially if the Arduino IDE is not installed), don’t forget to install the drivers necessary to recognize the microcontrollers.

Upload BIN file with Flash Download Tool

Download the Flash Download Tool software.

Run the executable file flash_download_tool_3.8.5.exe and select the developer mode

Then select the ESP32 DownloadTool

To find the address where to write the BIN file, you have to find the right instruction in the upload command (here 0x10000).

0x10000 C:\Users\ADMIN\AppData\Local\Temp\arduino_build_277133/splecode.ino.bin  

You can find the name of the port used to communicate with the ESP32 in the device manager (COM6).

Select the correct baudrate. In our case, 921600. You can find this value in the upload command preceded by “-baud”.

C:\Users\ADMIN\AppData\Local\Arduino15\packages\esp32\tools\esptool_py\2.6.1/esptool.exe --chip esp32 --port COM6 --baud 921600

Then select the BIN file at the location where you saved it.

You can then press “Start” to upload the file.

Sources

Exit mobile version