14 ISP_BAUD=115200 |
14 ISP_BAUD=115200 |
15 ifdef USB |
15 ifdef USB |
16 PORT=/dev/ttyUSB$(USB) |
16 PORT=/dev/ttyUSB$(USB) |
17 else |
17 else |
18 PORT=/dev/ttyS0 |
18 PORT=/dev/ttyS0 |
|
19 endif |
|
20 |
|
21 PROGRAMMER=-P $(PORT) -c stk500v2 |
|
22 ifdef IF |
|
23 PROGRAMMER=-c $(IF) |
19 endif |
24 endif |
20 |
25 |
21 #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c |
26 #SRC = main.c seriald.c driver/ADC.c driver/clock.c driver/timer.c |
22 #SRC = main.c driver/rs232.c driver/manchester.c |
27 #SRC = main.c driver/rs232.c driver/manchester.c |
23 SRC = main.c driver/rs232.c driver/adc.c |
28 SRC = main.c driver/rs232.c driver/adc.c |
77 $(OBJCOPY) -j .text -j .data -O ihex $< $@ |
82 $(OBJCOPY) -j .text -j .data -O ihex $< $@ |
78 rm $(PRG).elf |
83 rm $(PRG).elf |
79 rm $(PRG).map |
84 rm $(PRG).map |
80 |
85 |
81 program: code |
86 program: code |
82 $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i |
87 $(AVRDUDE) $(PROGRAMMER) -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:w:$(PRG).hex:i |
83 |
88 |
84 backup: |
89 backup: |
85 $(AVRDUDE) -P $(PORT) -c stk500v2 -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:r:$(PRG)_backup.hex:i |
90 $(AVRDUDE) $(PROGRAMMER) -b $(ISP_BAUD) -i 1 -p $(MCU) -V -U flash:r:$(PRG)_backup.hex:i |
86 |
91 |
87 fuse: |
92 fuse: |
88 $(AVRDUDE) -P $(PORT) -c stk500v2 -p $(MCU) -V $(FUSES) |
93 $(AVRDUDE) -c $(PROGRAMMER) -p $(MCU) -V $(FUSES) |
89 |
94 |
90 clean: |
95 clean: |
91 rm -rf *.o *.elf *.elf.src *.s *.i |
96 rm -rf *.o *.elf *.elf.src *.s *.i |
92 rm -rf driver/*.o |
97 rm -rf driver/*.o |
93 |
98 |