zephyr: Move "minimal" configuration building to a separate wrapper script.

Minimal config can be now build with:

./make-minimal BOARD=...

This is required because of Makefile.exports magic, which in its turn depends
on PROJ_CONF to be set correctly at the beginning of Makefile parsing at all
times. Instead of adding more and more workarounds for that, it's better to
just move minimal support to a separate wrapper.

Also, remove Zephyr 1.5 era cruft from Makefile, and add support for Zephyr's
"run" target which supercedes older "qemu" target in upstream.
crypto-aes
Paul Sokolovsky 6 years ago
parent 736a8a8ac7
commit 40e541063f

@ -5,17 +5,10 @@
# recursively Makefile.zephyr to build complete application binary
# using Zephyr build system.
#
# To build a "minimal" configuration, use "make-minimal" wrapper.
BOARD ?= qemu_x86
ifeq ($(MAKECMDGOALS), minimal)
# For minimal, CONF_FILE must be overriden early due to $(Z_EXPORTS) target
CONF_FILE = prj_minimal.conf
else
CONF_FILE = prj.conf
endif
# Zephyr 1.5.0
#OUTDIR_PREFIX =
# Zephyr 1.6.0
OUTDIR_PREFIX = $(BOARD)
# Default heap size is 16KB, which is on conservative side, to let
@ -66,7 +59,7 @@ include ../py/mkrules.mk
$(Z_EXPORTS): $(CONF_FILE)
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports
GENERIC_TARGETS = all zephyr qemu qemugdb flash debug
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug
KCONFIG_TARGETS = \
initconfig config nconfig menuconfig xconfig gconfig \
oldconfig silentoldconfig defconfig savedefconfig \
@ -88,12 +81,6 @@ $(Z_SYSGEN_H):
rm -f $(LIBMICROPYTHON)
-$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE)
minimal:
$(MAKE) BOARD=$(BOARD) CONF_FILE=prj_minimal.conf CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' FROZEN_DIR=
qemu-minimal:
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=prj_minimal.conf QEMU_NET=0 run
# Clean Zephyr things too
clean: z_clean

@ -98,17 +98,17 @@ below 128KB, as long as Zephyr project is committed to maintain stable
minimal size of their kernel (which they appear to be). Note that at such
size, there is no support for any Zephyr features beyond REPL over UART,
and only very minimal set of builtin Python modules. Thus, this build
is more suitable for code size control and quick demonstrations even on
is more suitable for code size control and quick demonstrations on
smaller systems. It's also suitable for careful enabling of features one
by one to achieve needed functionality and code size. This is in contrast
to the "default" build, which may get more and more features enabled by
default over time.
by one to achieve needed functionality and code size. This is in a
contrast to the "default" build, which may get more and more features
enabled over time.
To make a minimal build:
make BOARD=<board> minimal
./make-minimal BOARD=<board>
To run a minimal build in QEMU without requiring TAP networking setup
run the following after you built image with the previous command:
make BOARD=<qemu_x86|qemu_cortex_m3> qemu-minimal
./make-minimal BOARD=<qemu_x86|qemu_cortex_m3> qemu

@ -0,0 +1,16 @@
#!/bin/sh
#
# This is a wrapper for make to build a "minimal" Zephyr port.
# It should be run just like make (i.e. extra vars can be passed on the
# command line, etc.), e.g.:
#
# ./make-minimal BOARD=qemu_cortex_m3
# ./make-minimal BOARD=qemu_cortex_m3 run
#
make \
CONF_FILE=prj_minimal.conf \
CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' \
FROZEN_DIR= \
QEMU_NET=0 \
"$@"
Loading…
Cancel
Save