-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
40 lines (27 loc) · 1.18 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
all: main.hex
CLOCK = 48000000
TEENSY_PATH = ~/498/teensy-toolchain
COMPILER = $(TEENSY_PATH)/hardware/tools/arm-none-eabi/bin
VENDOR = ./minimal-k20-env/vendor
CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD -DF_CPU=$(CLOCK) -DUSB_SERIAL -I$(VENDOR) -D__MK20DX256__
CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
CFLAGS =
LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -T$(VENDOR)/mk20dx256.ld
LIBS = -lm
CC = $(COMPILER)/arm-none-eabi-gcc
CXX = $(COMPILER)/arm-none-eabi-g++
OBJCOPY = $(COMPILER)/arm-none-eabi-objcopy
SIZE = $(COMPILER)/arm-none-eabi-size
OBJECTS = parser.o parameters.o queue.o protocol/message_structs.o main.o hardware.o stepper.o control_isr.o utils.o peripheral.o homing.o
VENDOR_C = $(wildcard $(VENDOR)/*.c)
VENDOR_OBJECTS = $(patsubst %.c,%.o,$(VENDOR_C))
%.hex: %.elf
$(SIZE) $<
$(OBJCOPY) -O ihex -R .eeprom $< $@
main.elf: $(OBJECTS) $(VENDOR_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
parser_test.elf: parser.o parameters.o parser_test.o protocol/message_structs.o $(VENDOR_OBJECTS)
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
-include $(OBJS:.o=.d)
clean:
rm -f *.o *.d *.elf *.hex protocol/*.o $(VENDOR_OBJECTS)