0

I currently have a .ino firmware file that I use in the Arduino IDE to program an ATmega328 micro-controller. I would like to get the file that the Arduino IDE uses to program the micro-controller.

Probably the IDE uses a hexadecimal (hex) file or something and sends it to the micro-controller through the serial.

How can I get this file being the only file that the IDE generates is the .ino?

  • These questions have been answered here before. – Chris Stratton Jan 4 '18 at 16:55
  • @ChrisStratton I removed my question (was not aware of what you wrote) ... if the question has already been answered, it should be marked as duplicate question (s). – Michel Keijzers Jan 4 '18 at 17:06
  • I am getting .BIN file while using the above method in Arduino IDE. – Akash Agarwal Dec 11 '18 at 15:42
6

In the setting of the Arduino IDE; after Show verbose output during: check the box next to compilation.

Then when you compile you should get something like this at the bottom of the window:

...
...
"/Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-objcopy" -O ihex -R .eeprom  "/var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.elf" "/var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.hex"
Sketch uses 928 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.

At the end of the third line from the bottom you get the .hex filename. In this case (on OSX) that would be /var/folders/tp/grrlc56j3z7057f12_7f1_0r0000gn/T/arduino_build_635063/Blink.ino.hex

  • 1
    Perfect, this I needed. Now if I send through the serial this .hex file to the microcontroller it will work as the UPLOAD of the IDE? – Eduardo Cardoso Jan 4 '18 at 18:41
  • 1
    Click the checkbox next to it to get verbose output on upload. You can the see the command the IDE uses to upload. Just a hint. It uses the avrdude command line program for that. – Gerben Jan 4 '18 at 20:28
4

The easiest way to get the file is:

  1. Sketch > Export Compiled Binary
  2. Wait for the compilation process to finish
  3. Sketch > Show Sketch Folder

You will find an extra file in the sketch folder, which in this case will have a .hex extension. This is the compiled file which would normally be uploaded to the Arduino board via Sketch > Upload.

Note that the "Export Compiled Binary" feature is only available from Arduino IDE 1.6.5 and newer.

4

You are asking how to locate the compiled hex file. It's easy! Follow these steps:

  1. In the Arduino IDE select Sketch > Export Compiled Binary. This performs a compile. Once complete, this command places a copy of the compiled .hex file into the directory of your sketch.
    Export Compiled Binary
  2. Then either browse to the sketch folder or in the IDE select Sketch > Show Sketch Folder.
    Show Sketch Folder

This generates two hex files for the target micro-controller; one with the bootloader and one without the bootloader. These hex files can be uploaded to the micro-controller using a programmer such as the Atmel Ice or AVRISPmkII.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.