2016-07-22 17:18:17 +00:00
|
|
|
#
|
2016-11-04 16:13:49 +00:00
|
|
|
# This is the main Makefile, which uses MicroPython build system,
|
|
|
|
# but Zephyr arch-specific toolchain and target-specific flags.
|
|
|
|
# This Makefile builds MicroPython as a library, and then calls
|
|
|
|
# recursively Makefile.zephyr to build complete application binary
|
|
|
|
# using Zephyr build system.
|
2016-07-22 17:18:17 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
BOARD ?= qemu_x86
|
2017-01-27 18:28:03 +00:00
|
|
|
ifeq ($(MAKECMDGOALS), minimal)
|
|
|
|
# For minimal, CONF_FILE must be overriden early due to $(Z_EXPORTS) target
|
|
|
|
CONF_FILE = prj_minimal.conf
|
|
|
|
else
|
2016-11-04 16:42:43 +00:00
|
|
|
CONF_FILE = prj.conf
|
2017-01-27 18:28:03 +00:00
|
|
|
endif
|
2016-07-22 17:18:17 +00:00
|
|
|
# Zephyr 1.5.0
|
|
|
|
#OUTDIR_PREFIX =
|
|
|
|
# Zephyr 1.6.0
|
|
|
|
OUTDIR_PREFIX = $(BOARD)
|
|
|
|
|
2016-11-04 16:09:39 +00:00
|
|
|
# Default heap size is 16KB, which is on conservative side, to let
|
|
|
|
# it build for smaller boards, but it won't be enough for larger
|
|
|
|
# applications, and will need to be increased.
|
|
|
|
MICROPY_HEAP_SIZE = 16384
|
2016-09-17 18:15:58 +00:00
|
|
|
FROZEN_DIR = scripts
|
|
|
|
|
2016-09-22 21:42:18 +00:00
|
|
|
# Zephyr (generated) config files - must be defined before include below
|
2016-09-19 16:47:46 +00:00
|
|
|
Z_SYSGEN_H = outdir/$(OUTDIR_PREFIX)/misc/generated/sysgen/sysgen.h
|
|
|
|
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
|
|
|
|
include $(Z_EXPORTS)
|
2016-07-22 17:18:17 +00:00
|
|
|
|
|
|
|
include ../py/mkenv.mk
|
|
|
|
include ../py/py.mk
|
|
|
|
|
|
|
|
INC += -I.
|
|
|
|
INC += -I..
|
|
|
|
INC += -I$(BUILD)
|
2016-09-19 16:47:46 +00:00
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip
|
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip/contiki
|
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip/contiki/os
|
2016-07-22 17:18:17 +00:00
|
|
|
|
|
|
|
SRC_C = main.c \
|
2016-09-24 20:20:59 +00:00
|
|
|
help.c \
|
2016-10-22 17:15:26 +00:00
|
|
|
modutime.c \
|
zephyr: Initial implementation of machine.Pin.
The integration with Zephyr is fairly clean but as MicroPython Hardware API
requires pin ID to be a single value, but Zephyr operates GPIO in terms of
ports and pins, not just pins, a "hierarchical" ID is required, using tuple
of (port, pin). Port is a string, effectively a device name of a GPIO port,
per Zephyr conventions these are "GPIO_0", "GPIO_1", etc.; pin is integer
number of pin with the port (supposed to be in range 0-31).
Example of pin initialization:
pin = Pin(("GPIO_1", 21), Pin.OUT)
(an LED on FRDM-K64F's Port B, Pin 21).
There is support for in/out pins and pull up/pull down but currently
there is no interrupt support.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2016-09-28 21:22:42 +00:00
|
|
|
modmachine.c \
|
|
|
|
machine_pin.c \
|
2016-07-22 17:18:17 +00:00
|
|
|
uart_core.c \
|
|
|
|
lib/utils/stdout_helpers.c \
|
|
|
|
lib/utils/printf.c \
|
|
|
|
lib/utils/pyexec.c \
|
2016-09-29 17:24:56 +00:00
|
|
|
lib/utils/interrupt_char.c \
|
2016-07-22 17:18:17 +00:00
|
|
|
lib/mp-readline/readline.c \
|
|
|
|
$(SRC_MOD)
|
|
|
|
|
2016-10-12 16:15:32 +00:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C)
|
|
|
|
|
2016-07-22 17:18:17 +00:00
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2016-09-19 16:47:46 +00:00
|
|
|
CFLAGS = $(KBUILD_CFLAGS) $(NOSTDINC_FLAGS) $(ZEPHYRINCLUDE) \
|
2016-11-04 21:23:10 +00:00
|
|
|
-std=gnu99 -fomit-frame-pointer -DNDEBUG -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE) $(CFLAGS_EXTRA) $(INC)
|
2016-07-22 17:18:17 +00:00
|
|
|
|
|
|
|
include ../py/mkrules.mk
|
|
|
|
|
2017-01-27 20:42:11 +00:00
|
|
|
$(Z_EXPORTS): $(CONF_FILE)
|
2016-11-04 16:42:43 +00:00
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports
|
2016-09-19 16:47:46 +00:00
|
|
|
|
2016-09-19 18:04:53 +00:00
|
|
|
GENERIC_TARGETS = all zephyr qemu qemugdb flash debug
|
2016-09-19 16:47:46 +00:00
|
|
|
KCONFIG_TARGETS = \
|
|
|
|
initconfig config nconfig menuconfig xconfig gconfig \
|
|
|
|
oldconfig silentoldconfig defconfig savedefconfig \
|
|
|
|
allnoconfig allyesconfig alldefconfig randconfig \
|
|
|
|
listnewconfig olddefconfig
|
|
|
|
CLEAN_TARGETS = pristine mrproper
|
|
|
|
|
|
|
|
$(GENERIC_TARGETS): $(LIBMICROPYTHON)
|
|
|
|
$(CLEAN_TARGETS): clean
|
|
|
|
|
|
|
|
$(GENERIC_TARGETS) $(KCONFIG_TARGETS) $(CLEAN_TARGETS):
|
|
|
|
$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
|
2016-11-04 16:42:43 +00:00
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) $@
|
2016-07-22 17:18:17 +00:00
|
|
|
|
2016-09-19 16:47:46 +00:00
|
|
|
$(LIBMICROPYTHON): $(Z_SYSGEN_H)
|
|
|
|
build/genhdr/qstr.i.last: $(Z_SYSGEN_H)
|
2016-07-22 17:18:17 +00:00
|
|
|
|
2016-09-19 16:47:46 +00:00
|
|
|
$(Z_SYSGEN_H):
|
2016-07-22 17:18:17 +00:00
|
|
|
rm -f $(LIBMICROPYTHON)
|
2016-11-04 16:42:43 +00:00
|
|
|
-$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE)
|
2016-07-22 17:18:17 +00:00
|
|
|
|
2016-11-04 21:22:37 +00:00
|
|
|
minimal:
|
2017-01-21 13:13:32 +00:00
|
|
|
$(MAKE) BOARD=$(BOARD) CONF_FILE=prj_minimal.conf CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' FROZEN_DIR=
|
2016-11-04 21:22:37 +00:00
|
|
|
|
2016-07-22 17:18:17 +00:00
|
|
|
# Clean Zephyr things too
|
2016-09-19 16:47:46 +00:00
|
|
|
clean: z_clean
|
|
|
|
|
|
|
|
z_clean:
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
|
2017-01-27 20:42:11 +00:00
|
|
|
|
|
|
|
.PHONY: prj.conf
|
|
|
|
prj.conf: prj_base.conf
|
|
|
|
cat $< >$@
|
|
|
|
if [ -f prj_$(BOARD).conf ]; then cat prj_$(BOARD).conf >>$@; fi
|