Subversion Repositories group.electronics

Rev

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

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