-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (43 loc) · 1.8 KB
/
Makefile
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
# styl - Nano Stylophone for attiny13a
# Copyright (C) 2011 Bob Clough <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
CC=avr-gcc
OBJCOPY=avr-objcopy
STRIP=avr-strip
AVRDUDE=avrdude
# Change this to change the default output name
PROGNAME=minimorse
# Change this section to change the chip type.
PART=attiny25
# Change this secton to change AVRDUDE settings
AVRDUDE_PART=t25
AVRDUDE_PROG=usbtiny
AVRDUDE_PORT=/dev/ttyUSB0
# Set the default action to be compiling everything, then writing the chip
default: $(PROGNAME).hex
$(PROGNAME).o: $(PROGNAME).c
$(CC) -g -O -mmcu=$(PART) -c $^ -o $@
$(PROGNAME): $(PROGNAME).o
$(CC) -g -O -mmcu=$(PART) $^ -o $@
$(PROGNAME)-stripped: $(PROGNAME)
$(STRIP) $^ -o $@
$(PROGNAME).hex: $(PROGNAME)-stripped
$(OBJCOPY) -O ihex $^ $@
# Program the chip, using avrdude and the variables set above
program: $(PROGNAME).hex
$(AVRDUDE) -p $(AVRDUDE_PART) -c $(AVRDUDE_PROG) -U flash:w:$(PROGNAME).hex
fuses:
$(AVRDUDE) -p $(AVRDUDE_PART) -c $(AVRDUDE_PROG) -U lfuse:w:0x22:m -U hfuse:w:0xdf:m -U efuse:w:0xff:m
# Cleanup, leave only makefile and any .c/.h files
clean:
rm -f *.o $(PROGNAME) $(PROGNAME).hex $(PROGNAME)-stripped