all : program.hex burn program.lst CC = avr-gcc OBJS = main.o ntsc.o video.o SRCS = main.c ntsc.c video.c PROCESSOR=atmega168 PROGRAMCODE=m168 CFLAGS = -Wall -Os -mmcu=$(PROCESSOR) -DF_CPU=28636363UL -I. -Iusbdrv ASFLAGS = $(CFLAGS) -x assembler-with-cpp EXTRA_LD_FLAGS= -Wl,--relax -Wa,-a,-ad -mcall-prologues program.elf : $(SRCS) avr-gcc --combine -fwhole-program -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 program.lst : $(SRCS) avr-gcc -c -g -Wa,-a,-ad $(CFLAGS) $^ > $@ burn : program.hex avrdude -c usbtiny -p $(PROGRAMCODE) -U flash:w:program.hex readfuses : sudo avrdude -c usbtiny -p $(PROGRAMCODE) -U hfuse:r:high.txt:b -U lfuse:r:low.txt:b burnfuses : sudo avrdude -c usbtiny -p $(PROGRAMCODE) -U lfuse:w:0xA6:m -U hfuse:w:0xDF:m #don't forget: clock out! burnfuses_default : sudo avrdude -c usbtiny -p $(PROGRAMCODE) -U lfuse:w:0x62:m -U hfuse:w:0xDF:m clean : rm -f *~ high.txt low.txt program.hex program.map program.elf $(OBJS) *.o usbdrv/*.o usbdrv/*~ program.lst serial : stty -F /dev/ttyUSB0 4800 -parenb -echo -cstopb