-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
77 lines (57 loc) · 2.23 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# GESTALT FIRMWARE MAKEFILE
# REVISED: 3/1/2013
# REVISED: 10/18/2013: added -networkedGestalt lib, now compiles bootloader correctly
# Ilan Moyer and Nadya Peek
# www.pygestalt.org
#Change filename as appropriate. Note: assumes .cpp
GESTALT_DIR = ../gestalt/gsArduino
MCU = atmega328p
FREQ = 18432000
#bootloader
PROJECT = 086-005a_boot
ADDRESS = 0x7000
GESTALT_DEFS = -DstandardGestalt -Dbootloader -DsingleStepper -Dgestalt328 -DnetworkedGestalt
#application program, uncomment if you want to use this instead.
#PROJECT = 086-005a
#ADDRESS = 0x0000
#GESTALT_DEFS = -DstandardGestalt -DnetworkedGestalt -DsingleStepper -Dgestalt328
#----INNER WORKINGS BEGIN HERE----
GESTALT_FILE = $(GESTALT_DIR)/gestalt.cpp
LDSECTION = --section-start=.text=$(ADDRESS)
SOURCES = $(PROJECT).cpp $(GESTALT_FILE)
CFLAGS = -g -Wall -Os -mmcu=$(MCU) -DF_CPU=$(FREQ) -I$(GESTALT_DIR) $(GESTALT_DEFS)
LDFLAGS = -Wl,$(LDSECTION)
all: $(PROJECT).hex clean
$(PROJECT).o: $(SOURCES)
avr-g++ $(CFLAGS) -c -Wall $(SOURCES)
$(PROJECT).elf: $(PROJECT).o
avr-g++ $(CFLAGS) $(LDFLAGS) gestalt.o -o $@ $^
$(PROJECT).hex: $(PROJECT).elf
avr-objcopy -j .text -j .data -O ihex $< $@
clean:
rm -rf *.o *.elf
####
# load program code
####
# note: if you only have the 328 instead of the 328p, just compile for 328
# and load with the -p m328 flag. You'll need to add 328 to your avrdude.
program-avrisp2-fuses:
avrdude -c avrisp2 -P usb -p m328p -U efuse:w:0x5:m -F
#note that only first 3 bits can be set
avrdude -c avrisp2 -P usb -p m328p -U hfuse:w:0xD8:m -F
avrdude -c avrisp2 -P usb -p m328p -U lfuse:w:0xEF:m -F
program-avrisp2:
# uncomment to program bootloader
# avrdude -e -c avrisp2 -P usb -p m328p -U flash:w:086-005a_boot.hex
# uncomment to program application
avrdude -e -c avrisp2 -P usb -p m328p -U flash:w:086-005a.hex
program-usbtiny:
# uncomment to program bootloader
# avrdude -e -c usbtiny -P usb -p m328p -U flash:w:086-005a_boot.hex
# uncomment to program application
avrdude -e -c usbtiny -P usb -p m328p -U flash:w:086-005a.hex
program-usbtiny-fuses:
avrdude -c usbtiny -P usb -p m328p -U efuse:w:0x5:m -F
#note that only first 3 bits can be set
avrdude -c usbtiny -P usb -p m328p -U hfuse:w:0xD8:m -F
avrdude -c usbtiny -P usb -p m328p -U lfuse:w:0xEF:m -F