Burning a compiled hex file for Atmega chips using Arduino avrdude command line

For my latest project i wanted to use the famous GRBL firmware that loads into an arduino and helps drive steppers with G-code as input. I had an Arduino-Uno that i wanted to use.

Now the arduino IDE can be used to compile and upload sketches. But what if you had the compiled ‘hex’ file itself? : Like in the case of GRBL. The github page hosts hex files compiled for the Atmega328p.

You can use external programs like Xloader to do the job. However it looks like these programs have their own issues. So why not make use of the Arduino that you already have ?

The arduino IDE does 2 things.

  1. First it compiles your C/C++ sketch for a particular Atmega processor (depending upon the type of the arduino board) and generates a ‘hex’ file or a binary file that the processor can understand. 
  2. Then it uses its own ‘avrdude’ and config file and uploads this hex file.

Here’s a typical output command of the uploading process from arduino.

C:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/bin/avrdude -CC:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\rkovvuri\AppData\Local\Temp\build37.tmp\BlinkWithoutDelay.cpp.hex:i

So for my case, to burn in the GRBL hex file, i did the following

  • cd Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/bin
  • avrdude -CC:\Users\rkovvuri\Downloads\arduino-1.0.2-windows\arduino-1.0.2\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -carduino -P\\.\COM5 -b115200 -D -Uflash:w:C:\Users\rkovvuri\Desktop\grbl.hex:i

Thats it!

Advertisements
About

I am a computer engineer living in the beautiful city of Austin,TX. While my day job is designing computer chips, I love to dabble in woodworking, metalworking, r/c and electronics.

Tagged with: , ,
Posted in Electronics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives
Categories
%d bloggers like this: