Electronic – How to program an AVR Raven with Linux or a Mac

avrlinux

This tutorial starts with programming the Ravens and Jackdaw with a Windows box. Can I do those initial steps with a Linux or OS X machine instead? If so, how? Is there any risk of bricking the hardware if I just try?

I have a USB JTAG ICE MKii clone, which is supposed to work for this.

I'm totally new to AVR, but very experienced with C/C++ programming on Linux or OS X, up to and including kernel programming.

Best Answer

Under Linux, you'd probably use avrdude to program them. It supports most programmers and most AVR chips. The main thing to watch out for, is that I think you need to use avr-objcopy to extract the data from the 'ELF' binary files, you can't program the 'ELF' directly with avrdude.


Random googling for avr-objcopy / avrdude commandlines comes up with this, which looks like it might work:

# create demo.bin from demo.elf
avr-objcopy -j .text -j .data -O binary demo.elf demo.bin

# program demo.bin to the 'flash' memory in an 'atmega128' chip,
# using a 'stk200' programmer connected to the 'lpt1' port on your computer
avrdude -p atmega128 -c stk200 -P lpt1 -U flash:w:demo.bin:r