-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
68 lines (52 loc) · 1.97 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
# --------------------------------------------------------
# Custom M2 Makefile
# written by: Jonathan Bohren & Jonathan Fiene
# modified by: Nick McGill
# updated: Sept. 4, 2012
# --------------------------------------------------------
# --------------------------------------------------------
# if you write separate C files to include in ADC_live_plot
# add their .o targets to the OBJECTS line below
# (e.g. "OBJECTS = ADC_live_plot.o myfile.o")
# --------------------------------------------------------
OBJECTS = ADC_live_plot.o /m2_libraries/m_usb.o
# --------------------------------------------------------
# if you need to use one of our pre-compiled libraries,
# add it to the line below (e.g. "LIBRARIES = libsaast.a")
# --------------------------------------------------------
LIBRARIES =
# --------------------------------------------------------
# Default settings for the M2:
# --------------------------------------------------------
DEVICE = atmega32u4
CLOCK = 16000000
# --------------------------------------------------------
# you shouldn't change anything below here,
# unless you really know what you're doing
# --------------------------------------------------------
COMPILE = avr-gcc -std=c99 -I /m2_libraries -Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(DEVICE)
# symbolic targets:
all: ADC_live_plot.hex
.c.o:
$(COMPILE) -c $< -o $@
.S.o:
$(COMPILE) -x assembler-with-cpp -c $< -o $@
.c.s:
$(COMPILE) -S $< -o $@
install: flash
flash: all
dfu-programmer atmega32u4 erase
dfu-programmer atmega32u4 flash ADC_live_plot.hex
clean:
rm -f ADC_live_plot.hex ADC_live_plot.elf $(OBJECTS)
# file targets:
ADC_live_plot.elf: $(OBJECTS)
$(COMPILE) -o ADC_live_plot.elf $(OBJECTS) $(LIBRARIES)
ADC_live_plot.hex: ADC_live_plot.elf
rm -f ADC_live_plot.hex
avr-objcopy -j .text -j .data -O ihex ADC_live_plot.elf ADC_live_plot.hex
# Targets for code debugging and analysis:
disasm: ADC_live_plot.elf
avr-objdump -d ADC_live_plot.elf
cpp:
$(COMPILE) -E ADC_live_plot.c