X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Makefile;fp=Makefile;h=d934bba419406a6d96eeff442283cfdd8a09cab4;hb=0c1e003e9d6aa58868c13de9618a9114181f921c;hp=0000000000000000000000000000000000000000;hpb=5b1ee79c96708a86794c17057023dbd0b8bc81f0;p=teensytas.git diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d934bba --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +CC = $(CROSS_COMPILE)gcc +CXX = $(CROSS_COMPILE)g++ +OBJCOPY = $(CROSS_COMPILE)objcopy +SIZE = $(CROSS_COMPILE)size + +TOOLSPATH = tools + +TARGET = test + +# CPPFLAGS += -DUSB_SERIAL -DLAYOUT_US_ENGLISH +CPPFLAGS += -D__MK20DX256__ -DF_CPU=48000000 +CPPFLAGS += -DUSB_RAWHID +CPPFLAGS += -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib # -MMD +CXXFLAGS += -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti +LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tteensy3/mk20dx256.ld +LDLIBS += -lm + +C_FILES := $(wildcard *.c) +CT_FILES := $(wildcard teensy3/*.c) +OBJS += $(C_FILES:.c=.o) $(CT_FILES:.c=.o) + +all: $(TARGET).hex + +$(TARGET).elf: $(OBJS) $(LDSCRIPT) + $(CC) $(LDFLAGS) -o "$@" $(OBJS) $(LDLIBS) + +%.hex: %.elf + $(SIZE) "$<" + $(OBJCOPY) -O ihex -R .eeprom "$<" "$@" + +clean: + $(RM) $(TARGET).hex $(TARGET).elf $(OBJS) + +up: $(TARGET).hex + teensy_loader_cli -mmcu=mk20dx128 -w $<