Categories
ATMEL

Installing AVR Development Tools on an iMac

Setting up an iMac to develop software for the Atmel AVR microcontroller (i.e. Not Arduino) is quite straightforward however you do need to have the Homebrew package manager installed.

If you have not got Homebrew then you can install it by opening up a terminal window and entering the following command:-

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

The AVR development tools can now be installed by entering the following commands in the terminal window:-

brew tap osx-cross/avr
brew install avr-gcc
brew install avrdude

Once this has been done a single source file containing an AVR program can be compiled for an AVR microcontroller as follows (update microcontroller to reflect the one you are using):-

avr-gcc -std=c99 -O3 -mmcu=atmega32a main.c -o main.elf
avr-objcopy -j .text -j .data -O ihex main.elf main.hex

Now connect the AVR microcontroller to your AVR programmer, and your AVR programmer to your computer. You should now be able to use avrdude to program your microcontroller.

Programming AVR using usbasp

avrdude -p m32 -c usbasp -P usb -e -U flash:w:main.hex

Programming AVR using JTAG and AVRDRAGON

avrdude -p m32 -c dragon_jtag -P usb -e -U flash:w:main.hex