Categories
ATMEL General

Installing AVR Development Tools on Debian Linux

Setting up Debian Linux to develop software for the Atmel AVR microcontroller (i.e. Not Arduino) is quite straightforward and simply involves installed several packages as show below:-

  • sudo apt install binutils
  • sudo apt install gcc-avr
  • sudo apt install avr-libc
  • sudo apt install uisp
  • sudo apt 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