This guide shows how to generate a .bin (binary) file from your sketch on Arduino IDE.
Generate a .bin file in Arduino IDE
As an example, we’ll generate a .bin file from the Blink example. Follow the next steps to generate a .bin file from your sketch in Arduino IDE.
1) First, go to Tools > Board and select the right board (for example, ESP32 DEVKIT DOIT Board).
2) Save your sketch.
3) To generate a .bin file from your sketch, go to Sketch > Export compiled Binary
4) A new file on the folder sketch should be created. Go to Sketch > Show Sketch Folder.
5) You should have two files in your Sketch folder: the .ino and the .bin file.
Related content: ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE
We hope you’ve found this guide useful.
Thanks for reading!
Thank you Sarah, for the instructions on making a .bin file.
Now please tell me/us why we would do that?
What advantage is there to having a .bin file?
Possible it might load faster but so what, a few seconds more to load doesn’t seem like I want to do this.
Thank you, I really appreciate your tutorials!
Ralph
Hi Ralph.
We created this tutorial after the “ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE“.
That tutorials requires you to upload a .bin file. At the time of building that tutorial we’ve also built this one to make it easier to know how to get .bin files.
I’m sure they have other applications that I’m not aware of.
Thank you for supporting our work.
Regards,
Sara 🙂
Another application is when one has few arduini to get the same program (ex : detect tft shield; detect I2C devices; according to the presnce of I2C devices, display the sensor -might be temperature in different rooms- ; if serial is avalaible, send it to the PC…) Having the same program is not that absurd on an Arduino Mega…. if it can handle gracefully the lack of sensors+screens, and cope with the existing ones…This makes software somewhat bigger, and compiling/linking can be felt too slow to be comfortable (remains “only” uploading : theoretically, detecting avrdudes option can make this last step almost automatic)
Hi Dennis!
Thank you so much for sharing your expertise about this topic!
Regards,
Sara 🙂
Hi Sara! What is the purpose of this? Thank you
Hello Daniel, you can read what you can do with it in the comment’s above. Here’s a summary: We created this tutorial after the “ESP32 Over-the-air (OTA) Programming – Web Updater Arduino IDE“: https://randomnerdtutorials.com/esp32-over-the-air-ota-programming/
That tutorials requires you to upload a .bin file. At the time of building that tutorial we’ve also built this one to make it easier to know how to get .bin files.
I had to program a remote-control module which had no bootloader (STM32).
The bin-file was copied to a sd-card and plugged into the remotecontrol and programmed
to the STM32 internally.
I was very happy to find this how2 here – Thanks a lot !
Well, there is something people sometimes miss :
can one generate an easy to read assembly file (to detect where pieces of code can be optimized, or, more likely, to get an idea of time spent servicing an IT or a time constrained part): this is rather easy with gcc (–save-temps ), of course with g++, whatever the cpu. But I feel the arduino IDE does hide this option, which may be useful when there are some time constraints (at least, to detect something cannot be done)
I am using the ESP8266 implementation of the Homie Convention and this bin can be used by the built-in OTA for easy firmware upgrades over WiFi.
Thank you Sara for sharing this!
Thanks.
Regards,
Sara 😀
When creating a bin file, it is automatically named as follows: FileName.ino.esp32.bin. Is it possible to change the automatic naming to exclude or change esp32 to something other than esp32? Thank you, Florian
No, it generates a .hex file and a bootloader.bin file, but not a .bin file without bootloader