Skip to content

Commit 40e5410

Browse files
committed
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.
1 parent 736a8a8 commit 40e5410

3 files changed

Lines changed: 24 additions & 21 deletions

File tree

zephyr/Makefile

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,10 @@
55
# recursively Makefile.zephyr to build complete application binary
66
# using Zephyr build system.
77
#
8+
# To build a "minimal" configuration, use "make-minimal" wrapper.
89

910
BOARD ?= qemu_x86
10-
ifeq ($(MAKECMDGOALS), minimal)
11-
# For minimal, CONF_FILE must be overriden early due to $(Z_EXPORTS) target
12-
CONF_FILE = prj_minimal.conf
13-
else
1411
CONF_FILE = prj.conf
15-
endif
16-
# Zephyr 1.5.0
17-
#OUTDIR_PREFIX =
18-
# Zephyr 1.6.0
1912
OUTDIR_PREFIX = $(BOARD)
2013

2114
# Default heap size is 16KB, which is on conservative side, to let
@@ -66,7 +59,7 @@ include ../py/mkrules.mk
6659
$(Z_EXPORTS): $(CONF_FILE)
6760
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE) initconfig outputexports
6861

69-
GENERIC_TARGETS = all zephyr qemu qemugdb flash debug
62+
GENERIC_TARGETS = all zephyr run qemu qemugdb flash debug
7063
KCONFIG_TARGETS = \
7164
initconfig config nconfig menuconfig xconfig gconfig \
7265
oldconfig silentoldconfig defconfig savedefconfig \
@@ -88,12 +81,6 @@ $(Z_SYSGEN_H):
8881
rm -f $(LIBMICROPYTHON)
8982
-$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=$(CONF_FILE)
9083

91-
minimal:
92-
$(MAKE) BOARD=$(BOARD) CONF_FILE=prj_minimal.conf CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' FROZEN_DIR=
93-
94-
qemu-minimal:
95-
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) CONF_FILE=prj_minimal.conf QEMU_NET=0 run
96-
9784
# Clean Zephyr things too
9885
clean: z_clean
9986

zephyr/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,17 @@ below 128KB, as long as Zephyr project is committed to maintain stable
9898
minimal size of their kernel (which they appear to be). Note that at such
9999
size, there is no support for any Zephyr features beyond REPL over UART,
100100
and only very minimal set of builtin Python modules. Thus, this build
101-
is more suitable for code size control and quick demonstrations even on
101+
is more suitable for code size control and quick demonstrations on
102102
smaller systems. It's also suitable for careful enabling of features one
103-
by one to achieve needed functionality and code size. This is in contrast
104-
to the "default" build, which may get more and more features enabled by
105-
default over time.
103+
by one to achieve needed functionality and code size. This is in a
104+
contrast to the "default" build, which may get more and more features
105+
enabled over time.
106106

107107
To make a minimal build:
108108

109-
make BOARD=<board> minimal
109+
./make-minimal BOARD=<board>
110110

111111
To run a minimal build in QEMU without requiring TAP networking setup
112112
run the following after you built image with the previous command:
113113

114-
make BOARD=<qemu_x86|qemu_cortex_m3> qemu-minimal
114+
./make-minimal BOARD=<qemu_x86|qemu_cortex_m3> qemu

zephyr/make-minimal

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
#
3+
# This is a wrapper for make to build a "minimal" Zephyr port.
4+
# It should be run just like make (i.e. extra vars can be passed on the
5+
# command line, etc.), e.g.:
6+
#
7+
# ./make-minimal BOARD=qemu_cortex_m3
8+
# ./make-minimal BOARD=qemu_cortex_m3 run
9+
#
10+
11+
make \
12+
CONF_FILE=prj_minimal.conf \
13+
CFLAGS_EXTRA='-DMP_CONFIGFILE="<mpconfigport_minimal.h>"' \
14+
FROZEN_DIR= \
15+
QEMU_NET=0 \
16+
"$@"

0 commit comments

Comments
 (0)