2016-07-23 01:18:17 +08:00
|
|
|
#
|
2016-11-05 00:13:49 +08: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-23 01:18:17 +08:00
|
|
|
#
|
2017-03-13 04:41:19 +08:00
|
|
|
# To build a "minimal" configuration, use "make-minimal" wrapper.
|
2016-07-23 01:18:17 +08:00
|
|
|
|
|
|
|
BOARD ?= qemu_x86
|
|
|
|
OUTDIR_PREFIX = $(BOARD)
|
|
|
|
|
2016-11-05 00:09:39 +08: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-18 02:15:58 +08:00
|
|
|
FROZEN_DIR = scripts
|
|
|
|
|
2019-12-20 06:00:00 +08:00
|
|
|
MICROPY_VFS_FAT ?= 1
|
2019-12-31 07:46:17 +08:00
|
|
|
MICROPY_VFS_LFS1 ?= 0
|
|
|
|
MICROPY_VFS_LFS2 ?= 1
|
2019-12-20 06:00:00 +08:00
|
|
|
|
2017-08-03 05:16:38 +08:00
|
|
|
# Default target
|
|
|
|
all:
|
|
|
|
|
2017-11-18 02:23:45 +08:00
|
|
|
include ../../py/mkenv.mk
|
|
|
|
include $(TOP)/py/py.mk
|
|
|
|
|
2016-09-23 05:42:18 +08:00
|
|
|
# Zephyr (generated) config files - must be defined before include below
|
2016-09-20 00:47:46 +08:00
|
|
|
Z_EXPORTS = outdir/$(OUTDIR_PREFIX)/Makefile.export
|
2017-07-09 02:36:16 +08:00
|
|
|
ifneq ($(MAKECMDGOALS), clean)
|
2016-09-20 00:47:46 +08:00
|
|
|
include $(Z_EXPORTS)
|
2017-07-09 02:36:16 +08:00
|
|
|
endif
|
2016-07-23 01:18:17 +08:00
|
|
|
|
|
|
|
INC += -I.
|
2017-08-11 10:22:19 +08:00
|
|
|
INC += -I$(TOP)
|
2016-07-23 01:18:17 +08:00
|
|
|
INC += -I$(BUILD)
|
2016-09-20 00:47:46 +08:00
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip
|
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip/contiki
|
|
|
|
INC += -I$(ZEPHYR_BASE)/net/ip/contiki/os
|
2016-07-23 01:18:17 +08:00
|
|
|
|
|
|
|
SRC_C = main.c \
|
2016-09-25 04:20:59 +08:00
|
|
|
help.c \
|
2019-12-20 05:52:33 +08:00
|
|
|
moduos.c \
|
2017-03-31 05:06:31 +08:00
|
|
|
modusocket.c \
|
2016-10-23 01:15:26 +08:00
|
|
|
modutime.c \
|
2017-03-08 15:53:10 +08:00
|
|
|
modzephyr.c \
|
2018-01-16 22:29:54 +08:00
|
|
|
modzsensor.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-29 05:22:42 +08:00
|
|
|
modmachine.c \
|
2019-03-18 21:54:08 +08:00
|
|
|
machine_i2c.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-29 05:22:42 +08:00
|
|
|
machine_pin.c \
|
2016-07-23 01:18:17 +08:00
|
|
|
uart_core.c \
|
2019-12-20 05:31:50 +08:00
|
|
|
zephyr_storage.c \
|
2019-12-20 06:00:00 +08:00
|
|
|
lib/timeutils/timeutils.c \
|
2020-06-14 14:22:56 +08:00
|
|
|
lib/utils/mpirq.c \
|
2016-07-23 01:18:17 +08:00
|
|
|
lib/utils/stdout_helpers.c \
|
|
|
|
lib/utils/printf.c \
|
|
|
|
lib/utils/pyexec.c \
|
2016-09-30 01:24:56 +08:00
|
|
|
lib/utils/interrupt_char.c \
|
2016-07-23 01:18:17 +08:00
|
|
|
lib/mp-readline/readline.c \
|
|
|
|
$(SRC_MOD)
|
|
|
|
|
2016-10-13 00:15:32 +08:00
|
|
|
# List of sources for qstr extraction
|
|
|
|
SRC_QSTR += $(SRC_C)
|
|
|
|
|
2016-07-23 01:18:17 +08:00
|
|
|
OBJ = $(PY_O) $(addprefix $(BUILD)/, $(SRC_C:.c=.o))
|
|
|
|
|
2017-11-18 02:23:45 +08:00
|
|
|
CFLAGS = $(Z_CFLAGS) \
|
2019-12-20 06:00:00 +08:00
|
|
|
-std=gnu99 -fomit-frame-pointer -DNDEBUG -DMICROPY_HEAP_SIZE=$(MICROPY_HEAP_SIZE) $(CFLAGS_MOD) $(CFLAGS_EXTRA) $(INC)
|
2016-07-23 01:18:17 +08:00
|
|
|
|
2017-08-11 10:22:19 +08:00
|
|
|
include $(TOP)/py/mkrules.mk
|
2016-07-23 01:18:17 +08:00
|
|
|
|
2019-02-25 17:21:31 +08:00
|
|
|
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug debugserver \
|
|
|
|
ram_report rom_report
|
2016-09-20 00:47:46 +08: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):
|
2017-11-18 02:23:45 +08:00
|
|
|
$(MAKE) -C outdir/$(BOARD) $@
|
2016-07-23 01:18:17 +08:00
|
|
|
|
2017-03-30 05:08:27 +08:00
|
|
|
$(LIBMICROPYTHON): | $(Z_EXPORTS)
|
|
|
|
build/genhdr/qstr.i.last: | $(Z_EXPORTS)
|
2016-07-23 01:18:17 +08:00
|
|
|
|
2017-03-30 05:08:27 +08:00
|
|
|
# If we recreate libmicropython, also cause zephyr.bin relink
|
|
|
|
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
|
2016-07-23 01:18:17 +08:00
|
|
|
|
2017-07-09 02:36:16 +08:00
|
|
|
# MicroPython's global clean cleans everything, fast
|
2020-05-03 03:56:27 +08:00
|
|
|
CLEAN_EXTRA = outdir libmicropython.a
|
2016-09-20 00:47:46 +08:00
|
|
|
|
2017-07-09 02:36:16 +08:00
|
|
|
# Clean Zephyr things in Zephyr way
|
2016-09-20 00:47:46 +08:00
|
|
|
z_clean:
|
|
|
|
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
|
2017-01-28 04:42:11 +08:00
|
|
|
|
2017-04-05 05:37:35 +08:00
|
|
|
test:
|
2017-09-11 03:25:43 +08:00
|
|
|
cd $(TOP)/tests && ./run-tests --target minimal --device "execpty:make -C ../ports/zephyr run BOARD=$(BOARD) QEMU_PTY=1"
|
2017-11-18 02:23:45 +08:00
|
|
|
|
|
|
|
cmake: outdir/$(BOARD)/Makefile
|
|
|
|
|
2020-05-03 03:56:27 +08:00
|
|
|
ifneq ($(CONF_FILE),)
|
|
|
|
CMAKE_MOD += -DCONF_FILE=$(CONF_FILE)
|
|
|
|
endif
|
|
|
|
|
|
|
|
outdir/$(BOARD)/Makefile:
|
|
|
|
mkdir -p outdir/$(BOARD) && cmake -DBOARD=$(BOARD) $(CMAKE_MOD) -Boutdir/$(BOARD) -H.
|
2017-11-18 02:23:45 +08:00
|
|
|
|
|
|
|
$(Z_EXPORTS): outdir/$(BOARD)/Makefile
|
|
|
|
make --no-print-directory -C outdir/$(BOARD) outputexports CMAKE_COMMAND=: >$@
|
2019-12-30 21:29:31 +08:00
|
|
|
make -C outdir/$(BOARD) syscall_list_h_target kobj_types_h_target
|