# # Twitch/penta setup. # # HW setup: atmega168 on internal oscillator. # PROGRAMMER = avrispmkII PORT = usb UISP = avrdude -c $(PROGRAMMER) -P $(PORT) -p m168 -F COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=atmega168 #-DDEBUG_LEVEL=1 OBJECTS = main.o # symbolic targets: all: main.hex .c.o: $(COMPILE) -c $< -o $@ .S.o: $(COMPILE) -x assembler-with-cpp -c $< -o $@ .c.s: $(COMPILE) -S $< -o $@ flash: all $(UISP) -U flash:w:main.hex -v # Set to 12MHz external clock # High: 1101 1111 0xdf # Low: 1110 0010 0xef SUT 10 CKSEL 0010 fuses168: $(UISP) -U lfuse:w:0xef:m $(UISP) -U hfuse:w:0xdf:m clean: rm -f main.bin main.hex main.eep.hex $(OBJECTS) # file targets: main.bin: $(OBJECTS) $(COMPILE) -o main.bin $(OBJECTS) main.hex: main.bin rm -f main.hex main.eep.hex avr-objcopy -j .text -j .data -O ihex main.bin main.hex # do the checksize script as our last action to allow successful compilation # on Windows with WinAVR where the Unix commands will fail. disasm: main.bin avr-objdump -d main.bin cpp: $(COMPILE) -E main.c # DO NOT DELETE