-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (40 loc) · 1.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
CHIBIOS = ./ChibiOS
PORTDIR = ./xmega_port/os/ports/GCC/AVRXMEGA
BOARDDIR = ./xmega_port/boards/ATMEL_XPLAIN
PLATFORMDIR = ./xmega_port/os/hal/platforms/AVRXMEGA
PROJECTDIR = ./xmega_demo
TARGET = xmega_demo
CFLAGS = -fomit-frame-pointer -Os -ggdb -Wl,-static -fdata-sections -ffunction-sections -DF_CPU=32000000 -Wall
LDFLAGS = -Wl,--gc-sections
include $(CHIBIOS)/os/kernel/kernel.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(PLATFORMDIR)/platform.mk
include $(PORTDIR)/port.mk
include $(BOARDDIR)/board.mk
include $(CHIBIOS)/test/test.mk
include $(PROJECTDIR)/project.mk
SOURCES = $(KERNSRC) \
$(HALSRC) \
$(PLATFORMSRC) \
$(PORTSRC) \
$(BOARDSRC) \
$(TESTSRC) \
$(PROJECTSRC)
INCDIRS = -I$(KERNINC) \
-I$(HALINC) \
-I$(PLATFORMINC) \
-I$(PORTINC) \
-I$(BOARDINC) \
-I$(TESTINC) \
-I$(PROJECTINC)
OBJECTS = $(SOURCES:.c=.o)
all: $(TARGET).elf
$(TARGET).elf: $(OBJECTS)
avr-gcc $(LDFLAGS) -o $@ $(OBJECTS)
avr-size --format=avr --mcu=$(MCU) $(TARGET).elf
%.o: %.c
avr-gcc $(CFLAGS) $(INCDIRS) -c -o $@ $<
.PHONY: clean
clean:
rm -rf $(OBJECTS)
rm -rf $(TARGET).elf