# The name of your project (used to name the compiled .hex file)
TARGET = main
# configurable options
OPTIONS = -DF_CPU=48000000 -DUSB_SERIAL -DLAYOUT_US_ENGLISH
# options needed by many Arduino libraries to configure for Teensy 3.0
#OPTIONS += -D__MK20DX128__ -DARDUIO=104
# options needed by many Arduino libraries to configure for Teensy 3.0
OPTIONS += -D__MK20DX256__ -DARDUIO=105
#************************************************************************
# Location of Teensyduino utilities, Toolchain, and Arduino Libraries.
# To use this makefile without Arduino, copy the resources from these
# locations and edit the pathnames. The rest of Arduino is not needed.
#************************************************************************
# path location for Teensy Loader, teensy_post_compile and teensy_reboot
TOOLSPATH = ../../../../ARM/Arduino/arduino-1.0.5/hardware/tools
#TOOLSPATH = C:/Documents and Settings/Administrator/My Documents/ARM/Arduino/arduino-1.0.5/hardware/tools
# path location for the arm-none-eabi compiler
#COMPILERPATH = ../../../ARM/Arduino/arduino-1.0.5/hardware/tools/arm-none-eabi/bin
COMPILERPATH = C:/Documents and Settings/Administrator/My Documents/ARM/Arduino/arduino-1.0.5/hardware/tools/arm-none-eabi/bin
INCPATH = C:/Documents and Settings/Administrator/My Documents/ARM/Arduino/arduino-1.0.5/hardware/teensy/cores/teensy3
#************************************************************************
# Settings below this point usually do not need to be edited
#************************************************************************
# CPPFLAGS = compiler options for C and C++
CPPFLAGS = -Wall -g -Os -mcpu=cortex-m4 -mthumb -nostdlib -MMD $(OPTIONS) -I.
# compiler options for C++ only
CXXFLAGS = -std=gnu++0x -felide-constructors -fno-exceptions -fno-rtti
# compiler options for C only
CFLAGS =
# linker options
# LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tmk20dx128.ld # Teensy 3.0
LDFLAGS = -Os -Wl,--gc-sections -mcpu=cortex-m4 -mthumb -Tmk20dx256.ld # Teensy 3.1
# additional libraries to link
LIBS = -lm
# names for the compiler programs
#CC = $(abspath $(COMPILERPATH))/arm-none-eabi-gcc
#CXX = $(abspath $(COMPILERPATH))/arm-none-eabi-g++
#OBJCOPY = $(abspath $(COMPILERPATH))/arm-none-eabi-objcopy
#SIZE = $(abspath $(COMPILERPATH))/arm-none-eabi-size
CC = $(COMPILERPATH)/arm-none-eabi-gcc
CXX = $(COMPILERPATH)/arm-none-eabi-g++
OBJCOPY = $(COMPILERPATH)/arm-none-eabi-objcopy
SIZE = $(COMPILERPATH)/arm-none-eabi-size
# automatically create lists of the sources and objects
# TODO: this does not handle Arduino libraries yet...
C_FILES := $(wildcard *.c)
CPP_FILES := $(wildcard *.cpp)
OBJS := $(C_FILES:.c=.o) $(CPP_FILES:.cpp=.o)
# the actual makefile rules (all .o files built by GNU make's default implicit rules)
all: $(TARGET).hex
# Teensy 3.0
# $(TARGET).elf: $(OBJS) mk20dx128.ld
# Teensy 3.1
$(TARGET).elf: $(OBJS) mk20dx256.ld
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
%.hex: %.elf
$(SIZE) $<
$(OBJCOPY) -O ihex -R .eeprom $< $@
# $(TOOLSPATH)/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(TOOLSPATH) -$(TOOLSPATH)/teensy_reboot
# $(abspath $(TOOLSPATH))/teensy_post_compile -file=$(basename $@) -path=$(shell pwd) -tools=$(abspath $(TOOLSPATH))
# -$(abspath $(TOOLSPATH))/teensy_reboot
# compiler generated dependency info
-include $(OBJS:.o=.d)
clean:
rm -f *.o *.d $(TARGET).elf $(TARGET).hex