Tags: ,

When you have a number of Arduino boards to flash with the same program, it can be interesting to flash the HEX compiled 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 the HEX file and upload it to an Arduino microcontroller. This method can be adapted for other microcontrollers like ESP8266 and ESP32 with other tools.

Generate the HEX 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 HEX 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 HEX file somewhere else on your computer.

Upload the HEX file using the Windows command prompt

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

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

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 HEX files from another computer (especially if the Arduino IDE is not installed), don’t forget to install the drivers necessary to recognize the microcontrollers.

Upload the HEX file with XLoader

Download the XLoader software.

Run the executable file XLoader.exe

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

Select the right baudrate. In our case, 115200.

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

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


How useful was this post?

Click on a star to rate it!

Average rating 4.6 / 5. Vote count: 19

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?