fbpixel
Tags: ,

When you have a number of cards to flash with the same program, it can be interesting to flash the compiled BIN file directly into the ESP8266. This has two interests. It saves you time on uploading and it protects your source code if you share the program with others. It gives them the possibility to upload the program on other microcontrollers (in case of failure, for example) without risk of modifying the source code.

You should not need it every day but I will show you the method to generate the BIN file and upload it to an ESP8266 microcontroller. This method can be adapted for other microcontrollers like Arduino and ESP32 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)

arduino-preference-verbose-mode Generating and uploading BIN files to an ESP8266

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\ where the binary 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:

arduino-preference-verbose-mode-result-1280x249 Generating and uploading BIN files to an ESP8266

After an upload:

arduino-preference-verbose-upload-result-1280x251 Generating and uploading BIN files to an ESP8266

You can copy and store the generated BIN file anywhere on your computer.

Load the BIN file using the Windows command prompt

You can simplify the task by installing PowerShell which works like the terminal but with the ability to use copy/paste.

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

arduino-preference-verbose-upload-result-1-1280x251 Generating and uploading BIN files to an ESP8266

You can copy this command in the command prompt to upload the program to the microcontroller. Don’t forget to modify with the new path of the BIN file.

powershell-copy-upload-command-1 Generating and uploading BIN files to an ESP8266

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).

powershell-run-upload-command Generating and uploading BIN files to an ESP8266

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

Load the BIN file using NodeMCU Programmer

Download the NodeMCU flasher software.

Open the version that corresponds to your system (32 or 64 bits).

nodemcu-flasher-interface Generating and uploading BIN files to an ESP8266


Select the port of the microcontroller that you can find in the device manager.

device-manager-port-com-nodemcu Generating and uploading BIN files to an ESP8266

In the “Advanced” tab, select the “DOUT” option for SPI Mode.

nodemcu-flasher-advanced-dout Generating and uploading BIN files to an ESP8266

Select the BIN file where you saved it.

nodemcu-flasher-config-select-bin Generating and uploading BIN files to an ESP8266

In the “Operation” tab, you can now press “Flash” to upload the binary file

nodemcu-flasher-operation-flash Generating and uploading BIN files to an ESP8266

Don’t forget to reset the card so that the upload is taken into account.

Sources