--- a/trackswitch/Makefile Sun Oct 28 16:18:53 2012 +0100 +++ b/trackswitch/Makefile Sun Oct 28 17:41:10 2012 +0100 @@ -13,6 +13,11 @@ BAUD=38400 ISP_BAUD = 115200 +ifdef USB +PORT=/dev/ttyUSB$(USB) +else +PORT=/dev/ttyS0 +endif #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c #SRC = main.c driver/rs232.c driver/manchester.c @@ -74,7 +79,10 @@ rm $(PRG).map program: code - $(AVRDUDE) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i + +backup: + $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:r:$(PRG)_backup.hex:i fuse: $(AVRDUDE) -c stk500 -p $(MCU) -V $(FUSES)