Go Down

Topic: The simplest way to upload a compiled .hex file without the IDE  (Read 43534 times) previous topic - next topic

robertworeilly

Hey guys,

anybody know a simple easy way to upload a compiled .hex file to an Arduino board without using the IDE?

Thanks so much,
Rob :)

pert

  • Plug in your Arduino
  • Select your Arduino board from the Arduino IDE Tools > Board menu
  • Select your Arduino board's port from the Tools > Port menu
  • File > Preferences > Show verbose output during > upload(check)
  • Sketch > Upload
  • After Upload completes, scroll up in the console window until you see the avrdude command. On windows with Uno selected it looks something like:

Code: [Select]
C:\Program Files (x86)\arduino-1.6.10\hardware\tools\avr/bin/avrdude -CC:\Program Files (x86)\arduino-1.6.10\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM21 -b115200 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\builda0905d717cd3fb20c5f6c59067701315.tmp/serial.ino.hex:i

  • Select and copy the avrdude command.
  • Paste the avrdude command to the command line
  • Change the file name to the hex file you want to upload. In my case I also had to add quotes around the paths that had spaces in them
  • Press Enter


You can use the same system to generate the correct commands for burning a bootloader or to upload using a programmer.

robertworeilly

Thanks for the great advice :-)

Presumably if I send somebody the .hex file and they want to upload it, they first need to download AVRDude?

Will this method still work if I tell them to put the .hex file in a certain location and send them the command line?

Thanks so much,
Rob

pert

they first need to download AVRDude?
That's correct. You can download it here: http://download.savannah.gnu.org/releases/avrdude/

Will this method still work if I tell them to put the .hex file in a certain location and send them the command line?
You will need to know the location of avrdude, avrdude.conf, and the hex file which is no problem but the difficulty is the port will probably be different from one computer to another so they would need to find which port was assigned to their Arduino and update the -P option of the command. I was assuming this was for someone with the Arduino IDE installed. For your purposes it might be more user friendly to find some kind of a GUI wrapper application for avrdude that will allow the port to be selected from a menu as the Arduino IDE does. I'm pretty sure I've seen people refer to something like that here before but I don't remember the name.

Budvar10

Avrdude is free tool, it is part of Arduino SW but it can be downloaded separately. Arduino IDE is just calling the command line. It will work the same way directly from the command line, of course correct paths to the files must be passed.
Arduino clone with ATmega1284P   http://forum.arduino.cc/index.php?topic=277260.0

OldSteve

For your purposes it might be more user friendly to find some kind of a GUI wrapper application for avrdude that will allow the port to be selected from a menu as the Arduino IDE does. I'm pretty sure I've seen people refer to something like that here before but I don't remember the name.
Was it "XLoader"?

Available here:- XLoader
I have a copy, but I've never used it.

Incidentally, in the download are also "avrdude.exe", "avrdude.conf" and "libusb0.dll", so it works without needing to include anything apart from the *.hex file.

Edit: I just gave it a spin with an UNO and it works fine.
Edit2: And a Mega2560. No problems. :)
Please do not PM me for help. I am not a personal consultant.
And others will benefit as well if you post your question publicly on the forums.

barth_bh

Plese try it , http://barth.pl/BarthLoader.rar it is my small app for bossac.exe and avrdude

Sun_Wuk0ng

Thanks for the good description! I compiled the Blink Sketch, adjusted the output of the IDE for my firmware and copied the firmware to the Temp directory where the binary of Blink is located. All I had to do was add the quotes needed under Windows and the command to upload to the display now looks like this:
Code: [Select]
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" "-CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega328p -carduino -PCOM13 -b9600 -D -Uflash:w:C:\Users\mike\AppData\Local\Temp\arduino_build_221325/OpenLCD.ino.arduino_standard.hex:i
Windows can't process the spaces before and after files without the quotes. Program Files (x86) Therefore, the command and the reference to the config file must be enclosed in quotation marks.

NICHOLAS_K

Good info in this thread.  Here I am trying it about 15 months later. After adjusting the quotes for the path names I was able to get to the point where the error was "access denied".  No doubt due to trying to work within the Program Files folder. Opening the Command Window as administrator didn't help.

Eventually I remembered that I have the WinAVR complier installed from years ago under C:\, so no rights issues there. I replaced the path to point there for avrdude.exe and avrdude.conf and then I was able to upload a HEX file to the Arduino.

My problems were more Windows related than Arduino related, and my solution wouldn't work for most folks, but I add it anyway as another viewpoint.

Nick Kennedy

Go Up