From 40e541063faf15bd8965f2d65d5a5be08fdef851 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 12 Mar 2017 23:41:19 +0300 Subject: [PATCH] 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. --- zephyr/Makefile | 17 ++--------------- zephyr/README.md | 12 ++++++------ zephyr/make-minimal | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 21 deletions(-) create mode 100755 zephyr/make-minimal diff --git a/zephyr/Makefile b/zephyr/Makefile index 7d4d6674ef..7a0d052989 100644 --- a/zephyr/Makefile +++ b/zephyr/Makefile @@ -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=""' 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 diff --git a/zephyr/README.md b/zephyr/README.md index 6e9e5d8492..4fbf3d4019 100644 --- a/zephyr/README.md +++ b/zephyr/README.md @@ -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= minimal + ./make-minimal 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-minimal + ./make-minimal BOARD= qemu diff --git a/zephyr/make-minimal b/zephyr/make-minimal new file mode 100755 index 0000000000..1fc143e4d6 --- /dev/null +++ b/zephyr/make-minimal @@ -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=""' \ + FROZEN_DIR= \ + QEMU_NET=0 \ + "$@"