Subversion Repositories group.electronics

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
130 pfowler 1
 
132 pfowler 2
DEVICE=attiny85
3
F_CPU=16500000
136 pfowler 4
 
5
 
132 pfowler 6
HFUSE=0xdd
7
LFUSE=0xe1
130 pfowler 8
 
9
HDUSE=0xdf	# Default fuses for device
10
LDUSE=0x62
11
 
12
PROGTYPE=avrispmkii
13
PROGPORT=usb
14
 
136 pfowler 15
INCLUDES=-I. -I./lib/ -I./usbdrv/
130 pfowler 16
VALUES=-DF_CPU=$(F_CPU)
17
AVRDUDE = avrdude -c $(PROGTYPE) -P $(PROGPORT) -p $(DEVICE)
18
#COMPILE = avr-gcc  -Wall -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
19
 
132 pfowler 20
# Use this one to rip out unused functions
130 pfowler 21
COMPILE = avr-gcc -mtiny-stack  -Wall -Wl,-gc-section -fdata-sections -ffunction-sections -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
22
 
23
OBJECTS = main.o
136 pfowler 24
OBJECTS += lib/avrutil.o
25
OBJECTS += lib/i2cbb.o 
26
OBJECTS += usbdrv/usbdrv.o
27
OBJECTS += usbdrv/usbdrvasm.o
130 pfowler 28
 
29
# Compiling:
30
all:	main.hex
31
 
32
.c.o:
33
	$(COMPILE) -c $< -o $@
34
 
35
.S.o:
36
	$(COMPILE) -x assembler-with-cpp -c $< -o $@
37
 
38
.c.s:
39
	$(COMPILE) -S $< -o $@
40
 
41
main.bin:	$(OBJECTS)
42
	$(COMPILE) -o main.bin $(OBJECTS) -lm
43
 
44
main.hex:	main.bin
45
	rm -f main.hex main.eep.hex
46
	avr-objcopy -j .text -j .data -O ihex main.bin main.hex
47
	./checksize main.bin 4096 256
48
# do the checksize script as our last action to allow successful compilation
49
# on Windows with WinAVR where the Unix commands will fail.
50
 
51
disasm:	main.bin
52
	avr-objdump -d main.bin
53
 
54
 
55
clean:
56
	rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o lib/*.o main.s
57
 
58
# Functions interfacing to the device
59
flash:	all
60
	sudo $(AVRDUDE) -U flash:w:main.hex:i
61
 
62
fuse:
63
	sudo $(AVRDUDE) -U hfuse:w:$(HFUSE):m -U lfuse:w:$(LFUSE):m
64
 
65
fusedef:
66
	sudo $(AVRDUDE) -U hfuse:w:$(HDUSE):m -U lfuse:w:$(LDUSE):m
67
 
68
readcal:
69
	sudo $(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
70
 
71
readfuse:
136 pfowler 72
	sudo $(AVRDUDE) -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h
73
 
74
$(CMDLINE): usbtest.c
75
	gcc -I ./libusb/include -L ./libusb/lib/gcc -O -Wall usbtest.c -o usbtest -lusb