all : test.hex burn #PART=attiny44 #PROGPART=t44 PART=atmega328 PROGPART=m328 CFLAGS:=-g -Wall -Os -mmcu=$(PART) -DF_CPU=20000000 LDFLAGS:=-I -g -Wall -Os -mmcu=$(PART) -Wl,-Map,test.map -L/usr/lib/binutils/avr/2.18 CC:=avr-gcc test.elf : test.o avr_print.o avr-gcc $(LDFLAGS) -o $@ $^ test.hex : test.elf avr-objcopy -j .text -j .data -O ihex test.elf test.hex burn : test.hex avrdude -c usbtiny -p $(PROGPART) -U flash:w:test.hex #for attiny44 #default fuses are 62/df -> we are using d7 so we can save the eeprom. #burnfuses : # avrdude -c usbtiny -p $(PROGPART) -U lfuse:w:0x62:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m #for atmega168 - allow EESAVE burnfuses : avrdude -c usbtiny -p $(PROGPART) -U lfuse:w:0x62:m -U hfuse:w:0xd7:m -U efuse:w:0xff:m readfuses : avrdude -c usbtiny -p $(PROGPART) -U hfuse:r:high.txt:b -U lfuse:r:low.txt:b clean : rm -f *~ high.txt low.txt test.hex test.map test.elf test.o *.o