-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile.extenmote_db9_v2.m88p
62 lines (46 loc) · 1.48 KB
/
Makefile.extenmote_db9_v2.m88p
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
CC=avr-gcc
AS=$(CC)
LD=$(CC)
PROGNAME=extenmote_db9_v2
OBJDIR=objs-$(PROGNAME)
CPU=atmega88p
CFLAGS=-Wall -mmcu=$(CPU) -DF_CPU=8000000L -Os -DWITH_EEPROM -DWITH_DB9 -DDB9_V2
LDFLAGS=-mmcu=$(CPU) -Wl,-Map=$(PROGNAME).map
HEXFILE=$(PROGNAME).hex
AVRDUDE=avrdude -p m88p -P usb -c avrispmkII
# - - - - - BOOTSZ1 BOOTSZ0 BOOTRST
# 0 0 0 0 0 0 0 1
#EFUSE=0x01
EFUSE=0xF9
# RSTDISBL DWEN SPIEN WDTON EESAVE BODLEVEL2 BODLEVEL1 BODLEVEL0
# 1 1 0 1 1 1 1 1
HFUSE=0xdf
#
# CKDIV8 CKOUT SUT1 SUT0 CKSEL3 CKSEL2 CKSEL1 CKSEL0
# 1 1 1 0 0 0 1 0
#
# Clock selected: 8mhz internal RC oscillator
LFUSE=0xE2
OBJS=$(addprefix $(OBJDIR)/, main.o wiimote.o eeprom.o classic.o analog.o tripleclick.o db9.o)
all: $(HEXFILE)
clean:
rm -f $(PROGNAME).elf $(PROGNAME).hex $(PROGNAME).map $(OBJS)
$(OBJDIR)/%.o: %.S
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR)/%.o: %.c %.h
$(CC) $(CFLAGS) -c $< -o $@
$(PROGNAME).elf: $(OBJS)
$(LD) $(OBJS) $(LDFLAGS) -o $(PROGNAME).elf
$(PROGNAME).hex: $(PROGNAME).elf
avr-objcopy -j .data -j .text -O ihex $(PROGNAME).elf $(PROGNAME).hex
avr-size $(PROGNAME).elf -C --mcu=$(CPU)
fuse:
$(AVRDUDE) -e -Uefuse:w:$(EFUSE):m -Uhfuse:w:$(HFUSE):m -Ulfuse:w:$(LFUSE):m -B 20.0 -v
flash: $(HEXFILE)
$(AVRDUDE) -Uflash:w:$(HEXFILE) -B 1.0 -F
chip_erase:
$(AVRDUDE) -e -B 1.0 -F
reset:
$(AVRDUDE) -B 1.0 -F