Subversion Repositories group.NITPanels

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 24
Line 1... Line -...
1
 
-
 
-
 
1
#HW_VERSION=0x01
2
DEVICE=attiny24
2
HW_VERSION=0x02
3
F_CPU=8000000
3
F_CPU=8000000
4
HFUSE=0xdf
-
 
5
LFUSE=0xe2
-
 
6
 
4
 
-
 
5
ifeq ($(HW_VERSION),0x01)
-
 
6
	DEVICE=attiny24
-
 
7
	HFUSE=0xdf
-
 
8
	LFUSE=0xe2
7
HDUSE=0xdf	# Default fuses for device
9
	HDUSE=0xdf	# Default fuses for device attiny24
-
 
10
	LDUSE=0x62
-
 
11
	DEVMEM=2048
-
 
12
	DEVPRG=256
-
 
13
endif
-
 
14
 
-
 
15
ifeq ($(HW_VERSION),0x02)
-
 
16
	DEVICE=attiny4313
-
 
17
	HFUSE=0xdf
-
 
18
	LFUSE=0xe4
-
 
19
	HDUSE=0xdf	# Default fuses for device attiny24
8
LDUSE=0x62
20
	LDUSE=0x62
-
 
21
	DEVMEM=4096
-
 
22
	DEVPRG=256
-
 
23
endif
-
 
24
 
-
 
25
 
9
 
26
 
10
PROGTYPE=avrispmkii
27
PROGTYPE=avrispmkii
11
PROGPORT=usb
28
PROGPORT=usb
12
 
29
 
13
INCLUDES=-I. -I./lib/
30
INCLUDES=-I. -I./lib/
14
VALUES=-DF_CPU=$(F_CPU)
31
VALUES=-DF_CPU=$(F_CPU) -DHW_VERSION=$(HW_VERSION)
15
AVRDUDE = avrdude -c $(PROGTYPE) -P $(PROGPORT) -p $(DEVICE)
32
AVRDUDE = avrdude -c $(PROGTYPE) -P $(PROGPORT) -p $(DEVICE)
16
#COMPILE = avr-gcc  -Wall -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
33
#COMPILE = avr-gcc  -Wall -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
17
 
34
 
18
# Use this one to trip out unused functions
35
# Use this one to trip out unused functions
19
COMPILE = avr-gcc -mtiny-stack  -Wall -Wl,-gc-section -fdata-sections -ffunction-sections -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
36
COMPILE = avr-gcc -mtiny-stack  -Wall -Wl,-gc-section -fdata-sections -ffunction-sections -Os -DDEBUG_LEVEL=0  -mmcu=$(DEVICE) $(INCLUDES) $(VALUES)
Line 22... Line 39...
22
OBJECTS += lib/avrutil.o 
39
OBJECTS += lib/avrutil.o 
23
OBJECTS += lib/hc595.o
40
OBJECTS += lib/hc595.o
24
OBJECTS += lib/usiTwiSlave.o
41
OBJECTS += lib/usiTwiSlave.o
25
OBJECTS += lib/twires.o
42
OBJECTS += lib/twires.o
26
 
43
 
27
#OBJECTS += lib/uart.o 
-
 
28
#OBJECTS += lib/twi.o 
-
 
29
#OBJECTS += lib/wire.o 
-
 
30
#OBJECTS += lib/lcd.o 
-
 
31
#OBJECTS += lib/e2p.o 
-
 
32
#OBJECTS += lib/mio.o 
-
 
33
#OBJECTS += lib/oled.o 
-
 
34
#OBJECTS += lib/gfx.o
-
 
35
#OBJECTS += lib/dht.o 
-
 
36
 
-
 
37
#OBJECTS += lib/lmd.o 
-
 
38
 
-
 
39
# Compiling:
44
# Compiling:
40
all:	main.hex
45
all:	main.hex
41
 
46
 
42
.c.o:
47
.c.o:
43
	$(COMPILE) -c $< -o $@
48
	$(COMPILE) -c $< -o $@
Line 52... Line 57...
52
	$(COMPILE) -o main.bin $(OBJECTS) -lm
57
	$(COMPILE) -o main.bin $(OBJECTS) -lm
53
 
58
 
54
main.hex:	main.bin
59
main.hex:	main.bin
55
	rm -f main.hex main.eep.hex
60
	rm -f main.hex main.eep.hex
56
	avr-objcopy -j .text -j .data -O ihex main.bin main.hex
61
	avr-objcopy -j .text -j .data -O ihex main.bin main.hex
57
	./checksize main.bin 4096 256
62
	./checksize main.bin $(DEVMEM) $(DEVPRG)
58
# do the checksize script as our last action to allow successful compilation
63
# do the checksize script as our last action to allow successful compilation
59
# on Windows with WinAVR where the Unix commands will fail.
64
# on Windows with WinAVR where the Unix commands will fail.
60
 
65
 
61
disasm:	main.bin
66
disasm:	main.bin
62
	avr-objdump -d main.bin
67
	avr-objdump -d main.bin
Line 71... Line 76...
71
 
76
 
72
fuse:
77
fuse:
73
	sudo $(AVRDUDE) -U hfuse:w:$(HFUSE):m -U lfuse:w:$(LFUSE):m
78
	sudo $(AVRDUDE) -U hfuse:w:$(HFUSE):m -U lfuse:w:$(LFUSE):m
74
 
79
 
75
fusedef:
80
fusedef:
76
	sudo $(AVRDUDE) -U hfuse:w:$(HDUSE):m -U lfuse:w:$(LDUSE):m
81
	sudo $(AVRDUDE) -U hfuse:w:$(HDUSE):m -U lfuse:w:$(LDUSE):m 
77
 
82
 
78
readcal:
83
readcal:
79
	sudo $(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
84
	sudo $(AVRDUDE) -U calibration:r:/dev/stdout:i | head -1
80
	
85
	
81
readfuse:
86
readfuse: