Subversion Repositories group.electronics

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
117 pfowler 1
DEVICE=atmega168
2
DEV_CODE=16384
3
DEV_DATA=1024
4
F_CPU=20000000
5
HID_SIZE=81
6
H_FUSE=0xdf
7
L_FUSE=0xff
8
 
9
HD_FUSE=0xdf
10
LD_FUSE=0x62
11
 
12
AVRDUDE = avrdude -c avrispmkii -P usb -p $(DEVICE)
13
 
14
COMPILE = avr-gcc -Wall -Os -Iusbdrv -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -DHID_SIZE=$(HID_SIZE) -DDEBUG_LEVEL=0
15
 
16
OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o main.o twi.o wire.o avrutil.o lcd.o
17
 
18
# symbolic targets:
19
all:	main.hex
20
 
21
.c.o:
22
	$(COMPILE) -c $< -o $@
23
 
24
.S.o:
25
	$(COMPILE) -x assembler-with-cpp -c $< -o $@
26
 
27
.c.s:
28
	$(COMPILE) -S $< -o $@
29
 
30
flash:	all
31
	$(AVRDUDE) -U flash:w:main.hex:i
32
 
33
 
34
fuse:
35
	$(AVRDUDE) -U hfuse:w:$(H_FUSE):m -U lfuse:w:$(L_FUSE):m
36
 
37
fusedef:
38
	$(AVRDUDE) -U hfuse:w:$(HD_FUSE):m -U lfuse:w:$(LD_FUSE):m
39
 
40
readcal:
41
	$(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
42
 
43
 
44
clean:
45
	rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s usbtest
46
 
47
# file targets:
48
main.bin:	$(OBJECTS)
49
	$(COMPILE) -o main.bin $(OBJECTS)
50
 
51
main.hex:	main.bin
52
	rm -f main.hex main.eep.hex
53
	avr-objcopy -j .text -j .data -O ihex main.bin main.hex
54
#	./checksize main.bin $(DEV_CODE) $(DEV_DATA)
55
# do the checksize script as our last action to allow successful compilation
56
# on Windows with WinAVR where the Unix commands will fail.
57
 
58
disasm:	main.bin
59
	avr-objdump -d main.bin
60
 
61
cpp:
62
	$(COMPILE) -E main.c
63
 
64
# Command-line client
65
CMDLINE = usbtest
66
 
67
# One-liner to compile the command-line client from usbtest.c
68
$(CMDLINE): usbtest.c
69
	gcc -I ./libusb/include -L ./libusb/lib/gcc -O -Wall usbtest.c -o usbtest -lusb