2016-07-22 18:18:17 +01: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 18:18:17 +01:00
|
|
|
#
|
2017-03-12 20:41:19 +00:00
|
|
|
# To build a "minimal" configuration, use "make-minimal" wrapper.
|
2016-07-22 18:18:17 +01:00
|
|
|
|
|
|
|
BOARD ?= qemu_x86
|
2017-07-08 19:36:16 +01:00
|
|
|
CONF_FILE = prj_$(BOARD)_merged.conf
|
2016-07-22 18:18:17 +01:00
|
|
|
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 19:15:58 +01:00
|
|
|
FROZEN_DIR = scripts
|
|
|
|
|
2017-08-02 22:16:38 +01:00
|
|
|
# Default target
|
|
|
|
all:
|
|
|
|
|
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_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
|
2017-07-08 19:36:16 +01:00
|
|
|
ifneq ($(MAKECMDGOALS), clean)
|
2016-09-19 17:47:46 +01:00
|
|
|
include $(Z_EXPORTS)
|
2017-07-08 19:36:16 +01:00
|
|
|
endif
|
2016-07-22 18:18:17 +01:00
|
|
|
|
|
|
|
include ../py/mkenv.mk
|
2017-08-11 03:22:19 +01:00
|
|
|
include $(TOP)/py/py.mk
|
2016-07-22 18:18:17 +01:00
|
|
|
|
|
|
|
INC += -I.
|
2017-08-11 03:22:19 +01:00
|
|
|
INC += -I$(TOP)
|
2016-07-22 18:18:17 +01:00
|
|
|
INC += -I$(BUILD)
|
2016-09-19 17:47:46 +01: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 18:18:17 +01:00
|
|
|
|
|
|
|
SRC_C = main.c \
|
2016-09-24 21:20:59 +01:00
|
|
|
help.c \
|
2017-03-30 22:06:31 +01:00
|
|
|
modusocket.c \
|
2016-10-22 18:15:26 +01:00
|
|
|
modutime.c \
|
2017-03-08 07:53:10 +00:00
|
|
|
modzephyr.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 22:22:42 +01:00
|
|
|
modmachine.c \
|
|
|
|
machine_pin.c \
|
2016-07-22 18:18:17 +01:00
|
|
|
uart_core.c \
|
|
|
|
lib/utils/stdout_helpers.c \
|
|
|
|
lib/utils/printf.c \
|
|
|
|
lib/utils/pyexec.c \
|
2016-09-29 18:24:56 +01:00
|
|
|
lib/utils/interrupt_char.c \
|
2016-07-22 18:18:17 +01:00
|
|
|
lib/mp-readline/readline.c \
|
|
|
|
$(SRC_MOD)
|
|
|
|
|
2016-10-12 17:15:32 +01:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C)
|
|
|
|
|
2016-07-22 18:18:17 +01:00
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2016-09-19 17:47:46 +01: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 18:18:17 +01:00
|
|
|
|
2017-08-11 03:22:19 +01:00
|
|
|
include $(TOP)/py/mkrules.mk
|
2016-07-22 18:18:17 +01:00
|
|
|
|
2017-07-08 19:36:16 +01:00
|
|
|
# We use single target here ($(Z_EXPORTS)) for simplicity, but actually
|
|
|
|
# number of things get generated here: 'initconfig' generates C header for
|
|
|
|
# Kconfig configuration, 'outputexports' generates make environment with CC,
|
|
|
|
# etc., and 'lib' generates other headers which may be included by zephyr.h,
|
|
|
|
# e.g. DTS-related.
|
2017-01-27 20:42:11 +00:00
|
|
|
$(Z_EXPORTS): $(CONF_FILE)
|
2017-03-30 13:15:39 +01:00
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports lib
|
2016-09-19 17:47:46 +01:00
|
|
|
|
2017-05-01 23:12:02 +01:00
|
|
|
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver
|
2016-09-19 17:47:46 +01: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):
|
2016-11-04 16:42:43 +00:00
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) $@
|
2016-07-22 18:18:17 +01:00
|
|
|
|
2017-03-29 22:08:27 +01:00
|
|
|
$(LIBMICROPYTHON): | $(Z_EXPORTS)
|
|
|
|
build/genhdr/qstr.i.last: | $(Z_EXPORTS)
|
2016-07-22 18:18:17 +01:00
|
|
|
|
2017-03-29 22:08:27 +01:00
|
|
|
# If we recreate libmicropython, also cause zephyr.bin relink
|
|
|
|
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
|
2016-07-22 18:18:17 +01:00
|
|
|
|
2017-07-08 19:36:16 +01:00
|
|
|
# MicroPython's global clean cleans everything, fast
|
|
|
|
CLEAN_EXTRA = outdir
|
2016-09-19 17:47:46 +01:00
|
|
|
|
2017-07-08 19:36:16 +01:00
|
|
|
# Clean Zephyr things in Zephyr way
|
2016-09-19 17:47:46 +01:00
|
|
|
z_clean:
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
|
2017-01-27 20:42:11 +00:00
|
|
|
|
2017-07-09 09:50:21 +01:00
|
|
|
# This rule is for prj_$(BOARD)_merged.conf, not $(CONF_FILE), which
|
|
|
|
# can be overriden
|
|
|
|
prj_$(BOARD)_merged.conf: prj_base.conf prj_$(BOARD).conf
|
2017-03-12 19:28:45 +00:00
|
|
|
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
|
2017-04-04 22:37:35 +01:00
|
|
|
|
|
|
|
test:
|
2017-08-11 03:22:19 +01:00
|
|
|
cd $(TOP)/tests && ./run-tests --target minimal --device "execpty:make -C ../zephyr run BOARD=$(BOARD) QEMU_PTY=1"
|