# Processortyp M fuer Compiler, N fuer avrdude:
M=attiny2313
N=t2313
# Compileraufrufe:
C=avr-gcc -mmcu=$M -Wall -Os -c
A=avr-as
L=avr-gcc -mmcu=$M -Wall -Os

# fuer avrdude-Aufruf unter Linux:
TTY=/dev/ttyUSB0
# fuer avrdude-Aufruf unter MacOSX:
#TTY=/dev/tty.serial-0001

# verwendeter Programmer:
#P=avr910  #fuer mySmartUSB MK2
P=stk500v2 #fuer mySmartUSB light

all: tast5x5.hex

tast5x5.hex: tast5x5.cc
	$L tast5x5.cc -o tast5x5.elf
	avr-objcopy -O ihex -R .eeprom tast5x5.elf tast5x5.hex
	avr-objdump -h -S tast5x5.elf > tast5x5.lss

check:
	avrdude -p $N -c $P -P $(TTY) -v
check2:
	avrdude -p $N -F -c $P -P $(TTY) -v

# Fuses fuer 16MHz Quarz, fuer Tiny2313:
fusesetzen:
	avrdude -p $N -c $P -P $(TTY) -U lfuse:w:0xEF:m
	avrdude -p $N -c $P -P $(TTY) -U hfuse:w:0xDF:m

install: tast5x5.hex
	avrdude -p $N -c $P -P $(TTY) -U flash:w:tast5x5.hex:i

clean:
	rm -f *~ *.o *.elf
clean_all:
	rm -f *~ *.o *.elf *.lss *.hex
