2016-07-22 18:18:17 +01:00
|
|
|
#
|
|
|
|
# This is main Makefile, which uses MicroPython build system, but
|
|
|
|
# Zephyr arch-specific toolchain (setup by Zephyr's Makefile.toolchain.*).
|
|
|
|
# Unfortunately, it's currently not possible to get target (as in: specific
|
|
|
|
# board to run on) specific compile-time options from Zephyr, so these must
|
|
|
|
# be set (duplicated) in this Makefile. Currently, these configured for
|
|
|
|
# ARM Cortex-M3. This Makefile builds MicroPython as a library, and then
|
|
|
|
# calls recursively Makefile.zephyr to build complete application using
|
|
|
|
# Zephyr build system.
|
|
|
|
#
|
|
|
|
|
|
|
|
BOARD ?= qemu_x86
|
|
|
|
# Zephyr 1.5.0
|
|
|
|
#OUTDIR_PREFIX =
|
|
|
|
# Zephyr 1.6.0
|
|
|
|
OUTDIR_PREFIX = $(BOARD)
|
|
|
|
|
2016-09-22 22:42:18 +01:00
|
|
|
# Zephyr (generated) config files - must be defined before include below
|
2016-09-19 17:47:46 +01:00
|
|
|
Z_DOTCONFIG = outdir/$(OUTDIR_PREFIX)/.config
|
2016-09-22 22:42:18 +01:00
|
|
|
Z_AUTOCONF_H = outdir/$(OUTDIR_PREFIX)/include/generated/autoconf.h
|
2016-09-19 17:47:46 +01:00
|
|
|
DQUOTE = "
|
|
|
|
# "
|
2016-09-22 22:42:18 +01:00
|
|
|
include z_config_proxy.mk
|
2016-09-19 17:47:46 +01:00
|
|
|
|
2016-07-22 18:18:17 +01:00
|
|
|
# Zephyr toolchain config is 2-pass, so included twice
|
|
|
|
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
|
|
|
include $(ZEPHYR_BASE)/scripts/Makefile.toolchain.$(ZEPHYR_GCC_VARIANT)
|
|
|
|
|
2016-09-22 22:42:18 +01:00
|
|
|
CFLAGS_TARGET = $(cflags-y)
|
2016-07-22 18:18:17 +01:00
|
|
|
|
|
|
|
include ../py/mkenv.mk
|
|
|
|
include ../py/py.mk
|
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I..
|
|
|
|
INC += -I$(BUILD)
|
|
|
|
INC += -I$(ZEPHYR_BASE)/include -I$(ZEPHYR_BASE) \
|
|
|
|
-Ioutdir/$(OUTDIR_PREFIX)/misc/generated/sysgen \
|
|
|
|
-I$(dir $(Z_AUTOCONF_H))
|
|
|
|
|
|
|
|
SRC_C = main.c \
|
|
|
|
uart_core.c \
|
|
|
|
lib/utils/stdout_helpers.c \
|
|
|
|
lib/utils/printf.c \
|
|
|
|
lib/utils/pyexec.c \
|
|
|
|
lib/mp-readline/readline.c \
|
|
|
|
$(SRC_MOD)
|
|
|
|
|
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
|
|
|
COPT = -Os -DNDEBUG -fdata-sections -ffunction-sections
|
|
|
|
CFLAGS = -std=gnu99 $(TOOLCHAIN_CFLAGS) $(INC) $(CFLAGS_MOD) $(COPT) $(CFLAGS_TARGET)
|
|
|
|
|
|
|
|
include ../py/mkrules.mk
|
|
|
|
|
2016-09-19 17:47:46 +01:00
|
|
|
$(Z_DOTCONFIG):
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) initconfig
|
|
|
|
|
2016-09-19 19:04:53 +01:00
|
|
|
GENERIC_TARGETS = all zephyr qemu qemugdb flash debug
|
|
|
|
KCONFIG_TARGETS = config nconfig menuconfig xconfig gconfig
|
2016-07-22 18:18:17 +01:00
|
|
|
|
2016-09-19 19:04:53 +01:00
|
|
|
$(GENERIC_TARGETS) $(KCONFIG_TARGETS): $(LIBMICROPYTHON)
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) $@
|
2016-07-22 18:18:17 +01:00
|
|
|
|
|
|
|
$(LIBMICROPYTHON): $(Z_AUTOCONF_H)
|
|
|
|
build/genhdr/qstr.i.last: $(Z_AUTOCONF_H)
|
|
|
|
|
|
|
|
$(Z_AUTOCONF_H):
|
|
|
|
rm -f $(LIBMICROPYTHON)
|
|
|
|
-$(MAKE) -f Makefile.zephyr BOARD=$(BOARD)
|
|
|
|
|
2016-09-22 22:42:18 +01:00
|
|
|
zephyr_arch.mk: $(Z_DOTCONFIG)
|
|
|
|
echo "include $(ZEPHYR_BASE)/arch/$(ARCH)/Makefile" >$@
|
|
|
|
|
|
|
|
z_config_proxy.mk:
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) initconfig
|
|
|
|
echo "include z_config.mk" >$@
|
|
|
|
|
2016-07-22 18:18:17 +01:00
|
|
|
# Clean Zephyr things too
|
2016-09-22 22:42:18 +01:00
|
|
|
CLEAN_EXTRA = outdir z_config_proxy.mk
|