-
- MCU=MK20DX256
-
-
- LOWER_MCU := $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(MCU)))))))))))))))))))))))))))
- MCU_LD = $(LOWER_MCU).ld
-
-
- TARGET = main
-
-
-
-
-
- ifndef NO_ARDUINO
-
- ARDUINOPATH ?= ../../../../..
-
- endif
-
-
- OPTIONS = -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH -DUSING_MAKEFILE
-
-
- OPTIONS += -D__$(MCU)__ -DARDUINO=10600 -DTEENSYDUINO=121
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ifdef ARDUINOPATH
-
-
- TOOLSPATH = $(abspath $(ARDUINOPATH)/hardware/tools)
-
-
- LIBRARYPATH = $(abspath $(ARDUINOPATH)/libraries)
-
-
- COMPILERPATH = $(abspath $(ARDUINOPATH)/hardware/tools/arm/bin)
-
- else
-
-
- COMPILERPATH ?= /usr/bin
-
- endif
-
-
-
-
-
-
- CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -MMD $(OPTIONS) -I.
-
-
- CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
-
-
- CFLAGS =
-
-
- LDFLAGS = -Os -Wl,--gc-sections,--defsym=__rtc_localtime=0 --specs=nano.specs -mcpu=cortex-m4 -mthumb -T$(MCU_LD)
-
-
- LIBS = -lm
-
-
-
- CC = $(COMPILERPATH)/arm-none-eabi-gcc
- CXX = $(COMPILERPATH)/arm-none-eabi-g++
- OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
- SIZE = $(COMPILERPATH)/arm-none-eabi-size
-
-
-
- C_FILES := $(wildcard *.c)
- CPP_FILES := $(wildcard *.cpp)
- OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
-
-
-
-
- all: $(TARGET).hex
-
- $(TARGET).elf: $(OBJS) $(MCU_LD)
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
-
- %.hex: %.elf
- $(SIZE) $<
- $(OBJCOPY) -O ihex -R .eeprom $< $@
- ifneq (,$(wildcard $(TOOLSPATH)))
- $(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(TOOLSPATH)
- -$(TOOLSPATH)/teensy_reboot
- endif
-
-
- -include $(OBJS:.o=.d)
-
- clean:
- rm -f *.o *.d $(TARGET).elf $(TARGET).hex
|