-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (38 loc) · 950 Bytes
/
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
TARGET=codigo
SRCS=$(TARGET).c
SRCS+=lib/mi2c.c
SRCS+=lib/uart.c
SRCS+=estimation/compl3d.c
SRCS+=control/pid.c
SRCS+=sensors/itg3200.c
SRCS+=sensors/bma180.c
SRCS+=sensors/hmc5883l.c
SRCS+=rc/rc.c
SRCS+=pwm/pwm.c
SRCS+=led/led.c
PROCESSOR=atmega328p
CLOCK=16000000
SERIAL=57600
COM=/dev/tty.NAMIMOTE001-DevB
COM=/dev/tty.usbserial-A7035F2Y
FLAGS=-Wall -Os -DF_CPU=$(CLOCK) -mmcu=$(PROCESSOR)
INCLUDE=
LIBS=-lm
CC=/usr/local/CrossPack-AVR/bin/avr-gcc
OC=/usr/local/CrossPack-AVR/bin/avr-objcopy
DUDE=/usr/local/CrossPack-AVR/bin/avrdude
CFLAGS=$(FLAGS) $(INCLUDE)
LDFLAGS=$(LIBS)
all: $(TARGET).hex
$(TARGET).hex:$(SRCS:.c=.o)
$(CC) $(CFLAGS) -o $(TARGET).elf $^ $(LDFLAGS)
$(OC) -O ihex $(TARGET).elf $(TARGET).hex
%.o:%.c
$(CC) $(CFLAGS) -c -o $@ $<
flash:all
$(DUDE) -c arduino -p $(PROCESSOR) -b$(SERIAL) -P $(COM) -U flash:w:$(TARGET).hex
clear:
rm -f *.o *.a *.elf
rm -f $(SRCS:.c=.o)
distclear:clear
rm -f $(TARGET).hex