I build .hex files for Arduino. How can I do this in Linux? I use the Linux distro Mint 17.2.

I need a program to make [.hex files] (in Linux).

Can anyone help me?

  • 1
    With the Arduino IDE of course. – Majenko Apr 16 '16 at 19:40
  • What are you asking for? How to build .hex files on Linux? Or how to upload .hex files on Linux? Please clarify your question, because as it stands it is rather unclear and is likely to be closed. – Greenonline Apr 17 '16 at 11:39
  • @Majenko - I may be wrong, but looking at your edit, I would have said (as a non-native Brazilian Portugese speaker) that Necessito de um programa para fazer. should be translated as I need a program to make [.hex files], rather than I need to make a program.This may be the reason why the question seems a little unclear... :-) – Greenonline Apr 18 '16 at 11:11
  • 1
    @Greenonline Don't complain to me - complain to Google Translate ;) – Majenko Apr 18 '16 at 11:11
  • @Majenko - ah, ok :-) Anyways, I've changed the meaning of the question, and it all makes a bit more sense now. I've voted to reopen. – Greenonline Apr 18 '16 at 11:15

How are you creating your .hex files? Where are they coming from? Are you cross compiling the .hex files on some other machine and then transferring them to the Linux box? What is your Arduino connected to, the Linux box, or some other machine? Why are you even bothering with the .hex files? Your question is a little unclear. As Mikael states in his comment, you do not need to compile the .hex files, they are already compiled, you merely need to upload them, which the Arduino IDE would do for you anyway...

As ARK points out in his answer, you may find the answers to the question Where are the hex files compiled by Arduino? useful, although it seems like you know where they are but you don't know how to upload them.

Why can you not just use the Arduino IDE, to write your sketch, and then allow it to automatically compile the sketch and upload the .hex file for you? That way you do not need to manually play with the .hex file. Maybe I am missing something.

Is the Arduino IDE bombing out and not uploading the sketch on to the Arduino board?

However, if you are merely asking, how can I upload a .hex file to an Arduino, in Linux without using the Arduino IDE, then you would use avrdude. Taking the answer from How do I upload a hex file firmware to a target board without using the arduino IDE?

avrdude -C/usr/share/arduino/hardware/tools/avrdude.conf -v -v -v -v -patmega328p -carduino -P/dev/ttyUSB0 -b57600 -D -Uflash:w:/tmp/build8135728863211847829.tmp/sketch_may21b.cpp.hex:i 

or alternatively, taking the answer from Uploading Arduino hex file using avrdude

avrdude -U flash:w:[put-hex-file-path-here]:i -C avrdude.conf -v -p atmega328 -b 115200 -c stk500v2 -P [put-device-path-here]

You can download the Arduino IDE for Linux from the Arduino site.

As mentioned in Where are the hex files compiled by Arduino?, in the Arduino program: go to Arduino -> Preferences and then select Show verbose output during -> compilation.

Finally, when you are compiling, the program will show you lots of data. At the last lines, you will find the path to the .hex file (Every time the path changes!).

If you want to upload this .hex file to your ATmega328P (the micro controller inside Arduino Uno), avrdude can do that for you.

Here, are few useful links:

  1. Setup Avrdude on Linux
  2. Programming your chip
  3. Choosing a Programmer
  4. Uploading your .hex file
  • ok. But it not is my problem. I have an .hex file and I need compiler this file to the arduino. – Junior Duarte Apr 16 '16 at 22:06
  • 2
    Upload? Compile seems strange. Please elaborate. – Mikael Patel Apr 16 '16 at 22:42
  • from what i understand of your question is that you have a .hex file and you want to upload it to your Arduino Board. Well, First you need to know which microcontroller is being used in your Arduino Board you can use AVRDUDE, as shown in this tutorial, you can upload that .hex file to your micro controller. (Arduino UNO have a ATMega328P) – ARK Apr 17 '16 at 5:59
  • Unfortunately, your answer and the link only shows how to install avrdude, but not how to use it to upload a .hex file. – Greenonline Apr 17 '16 at 11:26
  • Unfortunately, you did paid attention while visiting the given link. There was menu in which different section were listed. Anyways, I have edited my answer. – ARK Apr 17 '16 at 16:41

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