|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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=10805 -DTEENSYDUINO=144
-
-
-
- CPUARCH = cortex-m4
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 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=$(CPUARCH) -mthumb -MMD $(OPTIONS) -I.
-
-
- CXXFLAGS = -std=gnu++14 -felide-constructors -fno-exceptions -fno-rtti
-
-
- CFLAGS =
-
-
- LDFLAGS = -Os -Wl,--gc-sections,--defsym=__rtc_localtime=0 --specs=nano.specs -mcpu=$(CPUARCH) -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
|