forked from joeyzhaozhao/main
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile-template
More file actions
120 lines (96 loc) · 3.58 KB
/
Copy pathMakefile-template
File metadata and controls
120 lines (96 loc) · 3.58 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# #######################################################################
# Makefile for inclusion by other projects
# heavily copied from original libarduino sources
# (c) 2009, for all changes belong to Henrik Sandklef
# which lead to the current version
# (c) 2011, for all changes belong to Petre Mihail Anton
#######################################################################
<<<<<<< HEAD
# *** Change device port to corespond to your system ***
#
# Example port names:
# if you're using GNU/Linux (Ubuntu/Debian/Fedora.....):
# USB_PORT=/dev/ttyACM0
#
# if you're using Mac:
# USB_PORT=/dev/tty.usbmodemfa141
#
=======
# Change device names to corespond to your system
#
# here are various USB device names for various operating system and Arduinos:
# if you're using GNU/Linux (Ubuntu/Debian/Fedora.....):
# UUSB_PORT=/dev/ttyACM0
# if you're using Mac:
# USB_PORT=/dev/tty.usbmodemfa141 (check name!)
>>>>>>> 0284c8de55ff017320e469b5b566e60d1e96d17b
# Hint:
# Launch Arduino IDE to see what your USB device
# is called (look under the port settings)
<<<<<<< HEAD
# Alternatively, type in your terminal:
# ls /dev/tty*
# USB_PORT=/dev/ttyACM0
USB_PORT=/dev/tty.usbmodem411
=======
USB_PORT=/dev/ttyACM0
#USB_PORT=/dev/tty.usbmodem411
>>>>>>> 0284c8de55ff017320e469b5b566e60d1e96d17b
# *** DO NOT EDIT TEXT BELOW! ***
# *** IF YOU NEED TO ADD YOUR OWN RULES, GO TO THE END OF THE FILE! ***
#########################################################################
#########################################################################
#########################################################################
# the speed that corresponds to your arduino (normally 16MHz)
F_CPU=16000000
#F_CPU=8000000
VERS="Arduino Portable Makefile [APM] version 1.2, dated 10-04-2011"
PROG=test
SRC=src/*.c
OBJ=bin/*.o
mega: MMCU=atmega2560
mega: STK=stk500v2
mega: BAUD=115200
mega: LIB=coremega
mega: EXT=elf
uno: MMCU=atmega328p
uno: STK=stk500v1
uno: BAUD=115200
uno: LIB=coreuno
uno: EXT=elf
test: MMCU=atmega328p
test: LIB=coreuno
test: EXT=x
# -Wstrict-prototypes
#-Wa,-ahlms=$(PROG).lst
$(OBJ): $(SRC)
@ cd bin && \
avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -mmcu=$(MMCU) -DARDUINO=22 -DF_CPU=$(F_CPU) -DARDUINO=22 -I../include ../$(SRC)
@ echo "Object files created"
compile:
@ avr-gcc $(OBJ) -Os -Wl,--gc-sections -mmcu=$(MMCU) -o bin/$(PROG).$(EXT) -l$(LIB) -Llib -lm
@ echo "Project compiled"
#-DENABLE_PWM
# avr-gcc $(OBJ) -Os -Wl,-Map=$(PROG).map,--cref -mmcu=$(MMCU) -DARDUINO=22 -l$(LIB) -Llib -lm \
# -fno-exceptions -ffunction-sections -fdata-sections -o bin/$(PROG).x
test: clean $(OBJ) compile
@ echo "Test passed"
install: $(OBJ) compile
@ cd bin && avr-objcopy -O srec $(PROG).elf $(PROG).rom
# checksize $(PROG).elf
@ avrdude -p $(MMCU) -P $(USB_PORT) -c $(STK) -b $(BAUD) -F -u -U flash:w:bin/$(PROG).rom
mega: clean install
uno: clean install
pc: clean
gcc -DPC $(SRC) -o bin/$(PROG).x
clean:
@ cd bin && rm -f *.o *.rom *.elf *.map *~ *.lst *.x
@ echo "Project cleaned"
version:
@ echo $(VERS)
help:
@ echo "Check: \n - the declared usb port\n - if all required folders exist\n - if your code includes 'WProgram.h'\n - if you call 'init()'\n - try removing '@' from this makefile to get more output"
# reprogram the fuses for the right clock source
#fuse:
# avrdude -p atmega168 -c stk200 -U lfuse:w:0x62:m
.PHONY : clean compile test uno mega pc install help version