Subversion Repositories group.NITPanels

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 pfowler 1
 
2
DEVICE=attiny85
3
F_CPU=16500000
4
 
5
 
6
HFUSE=0xdd
7
LFUSE=0xe1
8
 
9
HDUSE=0xdf	# Default fuses for device
10
LDUSE=0x62
11
 
12
PROGTYPE=avrispmkii
13
PROGPORT=usb
14
 
15
INCLUDES=-I. -I./lib/ -I./usbdrv/
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
 
20
# Use this one to rip out unused functions
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
24
OBJECTS += lib/avrutil.o
25
OBJECTS += lib/i2cbb.o 
26
OBJECTS += usbdrv/usbdrv.o
27
OBJECTS += usbdrv/usbdrvasm.o
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
 
49
disasm:	main.bin
50
	avr-objdump -d main.bin
51
 
52
clean:
53
	rm -f main.hex main.lst main.obj main.cof main.list main.map main.eep.hex main.bin *.o lib/*.o main.s
54
 
55
# Functions interfacing to the device
56
flash:	all
57
	sudo $(AVRDUDE) -U flash:w:main.hex:i
58
 
59
fuse:
60
	sudo $(AVRDUDE) -U hfuse:w:$(HFUSE):m -U lfuse:w:$(LFUSE):m
61
 
62
fusedef:
63
	sudo $(AVRDUDE) -U hfuse:w:$(HDUSE):m -U lfuse:w:$(LDUSE):m
64
 
65
readcal:
66
	sudo $(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
67
 
68
readfuse:
69
	sudo $(AVRDUDE) -U lfuse:r:-:h -U hfuse:r:-:h -U efuse:r:-:h
70
 
71
usbtest: usbtest.c
72
	gcc -o usbtest usbtest.c -lusb -lncurses