all : program.hex burn program.lst CC = avr-gcc OBJS = test.o avr_print.o mcp23008.o SRCS = test.c avr_print.c mcp23008.c PROCESSOR=atmega168 PROGRAMCODE=m168 CFLAGS = -Wall -Os -mmcu=$(PROCESSOR) -DF_CPU=12000000UL -I. -Iusbdrv -flto -fwhole-program #-DMUTE_PRINTF EXTRA_LD_FLAGS=-Wl,--relax -Wa,-a,-ad # -mcall-prologues ASFLAGS = $(CFLAGS) -x assembler-with-cpp program.elf : $(SRCS) avr-gcc -I -mmcu=$(PROCESSOR) $(CFLAGS) -Wl,-Map,program.map -o $@ $^ -L /usr/lib64/binutils/avr/2.19.1 $(EXTRA_LD_FLAGS) > program.lst program.hex : program.elf avr-objcopy -j .text -j .data -O ihex program.elf program.hex burn : program.hex avrdude -c usbtiny -p $(PROGRAMCODE) -U flash:w:program.hex -F readfuses : avrdude -c usbtiny -p $(PROGRAMCODE) -U hfuse:r:high.txt:b -U lfuse:r:low.txt:b burnfuses : avrdude -c usbtiny -p $(PROGRAMCODE) -U lfuse:w:0xEE:m -U hfuse:w:0xDF:m -F #-U efuse:w:0xCC:m #Setup clock / Disable hardware booter - we want the SPI Programmer only! clean : rm -f *~ high.txt low.txt program.hex program.map program.elf $(OBJS) *.o program.lst