2014-01-24 09:05:30 +00:00
|
|
|
include ../py/mkenv.mk
|
2014-01-08 17:09:47 +00:00
|
|
|
|
2014-01-15 06:23:56 +00:00
|
|
|
# qstr definitions (must come before including py.mk)
|
|
|
|
QSTR_DEFS = qstrdefsport.h
|
|
|
|
|
2014-01-08 17:09:47 +00:00
|
|
|
# include py core make definitions
|
|
|
|
include ../py/py.mk
|
|
|
|
|
2014-01-06 08:20:11 +00:00
|
|
|
ifeq ($(ARDUINO),)
|
|
|
|
$(error Please define ARDUINO (where TeensyDuino is installed))
|
|
|
|
endif
|
|
|
|
TOOLS_PATH = $(ARDUINO)/hardware/tools
|
|
|
|
COMPILER_PATH = $(TOOLS_PATH)/arm-none-eabi/bin
|
|
|
|
CORE_PATH = $(ARDUINO)/hardware/teensy/cores/teensy3
|
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
CROSS_COMPILE = $(COMPILER_PATH)/arm-none-eabi-
|
2014-01-06 08:20:11 +00:00
|
|
|
|
2014-01-08 17:09:47 +00:00
|
|
|
CFLAGS_TEENSY = -DF_CPU=96000000 -DUSB_SERIAL -D__MK20DX256__
|
2014-01-06 08:20:11 +00:00
|
|
|
CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion $(CFLAGS_TEENSY)
|
2014-04-16 21:10:33 +00:00
|
|
|
|
|
|
|
INC = -I.
|
|
|
|
INC += -I$(PY_SRC)
|
|
|
|
INC += -I$(BUILD)/includes
|
|
|
|
INC += -I$(CORE_PATH)
|
|
|
|
|
|
|
|
CFLAGS = $(INC) -Wall -ansi -std=gnu99 $(CFLAGS_CORTEX_M4)
|
2014-01-06 08:20:11 +00:00
|
|
|
LDFLAGS = -nostdlib -T mk20dx256.ld
|
|
|
|
LIBS = -L $(COMPILER_PATH)/../lib/gcc/arm-none-eabi/4.7.2/thumb2 -lgcc
|
|
|
|
|
2014-01-13 13:25:10 +00:00
|
|
|
#Debugging/Optimization
|
|
|
|
ifdef DEBUG
|
|
|
|
CFLAGS += -Og -ggdb
|
|
|
|
else
|
|
|
|
CFLAGS += -Os #-DNDEBUG
|
|
|
|
endif
|
|
|
|
|
2014-01-06 08:20:11 +00:00
|
|
|
SRC_C = \
|
|
|
|
main.c \
|
2014-01-07 17:49:42 +00:00
|
|
|
lcd.c \
|
2014-01-06 08:20:11 +00:00
|
|
|
led.c \
|
2014-01-07 17:49:42 +00:00
|
|
|
lexerfatfs.c \
|
2014-01-08 09:00:22 +00:00
|
|
|
lexermemzip.c \
|
|
|
|
memzip.c \
|
2014-01-15 06:23:56 +00:00
|
|
|
servo.c \
|
|
|
|
usart.c \
|
2014-01-07 17:49:42 +00:00
|
|
|
usb.c \
|
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
STM_SRC_C = $(addprefix stm/,\
|
2014-01-06 08:20:11 +00:00
|
|
|
malloc0.c \
|
|
|
|
printf.c \
|
|
|
|
string0.c \
|
2014-01-24 09:05:30 +00:00
|
|
|
)
|
2014-01-06 08:20:11 +00:00
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
STM_SRC_S = $(addprefix stm/,\
|
2014-01-06 08:20:11 +00:00
|
|
|
gchelper.s \
|
2014-01-24 09:05:30 +00:00
|
|
|
)
|
2014-01-06 08:20:11 +00:00
|
|
|
|
|
|
|
SRC_TEENSY = \
|
|
|
|
mk20dx128.c \
|
|
|
|
pins_teensy.c \
|
|
|
|
analog.c \
|
|
|
|
usb_desc.c \
|
|
|
|
usb_dev.c \
|
|
|
|
usb_mem.c \
|
|
|
|
usb_serial.c \
|
|
|
|
yield.c \
|
|
|
|
|
2014-01-15 06:23:56 +00:00
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o) $(STM_SRC_C:.c=.o) $(STM_SRC_S:.s=.o) $(SRC_TEENSY:.c=.o))
|
2014-01-06 08:20:11 +00:00
|
|
|
#LIB = -lreadline
|
|
|
|
# the following is needed for BSD
|
|
|
|
#LIB += -ltermcap
|
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
all: hex
|
2014-01-08 09:00:22 +00:00
|
|
|
hex: $(BUILD)/micropython-mz.hex
|
2014-01-06 08:20:11 +00:00
|
|
|
|
2014-01-08 09:00:22 +00:00
|
|
|
post_compile: $(BUILD)/micropython-mz.hex
|
2014-01-08 18:15:39 +00:00
|
|
|
$(ECHO) "Preparing $@ for upload"
|
|
|
|
$(Q)$(TOOLS_PATH)/teensy_post_compile -file="$(basename $(<F))" -path="$(<D)" -tools="$(TOOLS_PATH)"
|
2014-01-06 08:20:11 +00:00
|
|
|
|
|
|
|
reboot:
|
2014-01-08 18:15:39 +00:00
|
|
|
$(ECHO) "REBOOT"
|
|
|
|
-$(Q)$(TOOLS_PATH)/teensy_reboot
|
2014-01-06 08:20:11 +00:00
|
|
|
|
|
|
|
upload: post_compile reboot
|
|
|
|
|
2014-01-08 09:00:22 +00:00
|
|
|
$(BUILD)/micropython.elf: $(OBJ)
|
2014-01-08 18:15:39 +00:00
|
|
|
$(ECHO) "LINK $<"
|
|
|
|
$(Q)$(CC) $(LDFLAGS) -o "$@" -Wl,-Map,$(@:.elf=.map) $(OBJ) $(LIBS)
|
|
|
|
$(Q)$(SIZE) $@
|
2014-01-06 08:20:11 +00:00
|
|
|
|
2014-01-08 09:00:22 +00:00
|
|
|
ifeq ($(MEMZIP_DIR),)
|
|
|
|
MEMZIP_DIR = memzip_files
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(BUILD)/micropython-mz.hex: $(BUILD)/micropython.hex $(shell find ${MEMZIP_DIR} -type f)
|
|
|
|
@$(ECHO) "Creating $@"
|
|
|
|
$(Q)./add-memzip.sh $< $@ ${MEMZIP_DIR}
|
|
|
|
|
2014-01-08 17:09:47 +00:00
|
|
|
$(BUILD)/%.hex: $(BUILD)/%.elf
|
2014-01-08 18:15:39 +00:00
|
|
|
$(ECHO) "HEX $<"
|
|
|
|
$(Q)$(OBJCOPY) -O ihex -R .eeprom "$<" "$@"
|
2014-01-06 08:20:11 +00:00
|
|
|
|
|
|
|
$(BUILD)/%.o: $(CORE_PATH)/%.c
|
2014-01-24 09:05:30 +00:00
|
|
|
$(call compile_c)
|
2014-01-06 08:20:11 +00:00
|
|
|
|
2014-01-24 09:05:30 +00:00
|
|
|
include ../py/mkrules.mk
|