Skip to content

Commit 25434e9

Browse files
MaureenHelmdpgeorge
authored andcommitted
zephyr: Use zephyr build system to merge configurations.
The zephyr build system supports merging application-level board configurations, so there is no need to reproduce this functionality in MicroPython. If CONF_FILE is not explicitly set, then the zephyr build system looks for prj.conf in the application directory. Therefore we rename the MicroPython prj_base.conf to prj.conf. Furthermore, if the zephyr build system finds boards/$(BOARD).conf in the application directory, it merges that configuration with prj.conf. Therefore we rename all the MicroPython board .conf files and move them into a boards/ directory. The minimal configuration, prj_minimal.conf, is left in the application directory because it is used as an explicitly set CONF_FILE in make-minimal.
1 parent 138a28d commit 25434e9

12 files changed

+7
-40
lines changed

ports/zephyr/Makefile

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# To build a "minimal" configuration, use "make-minimal" wrapper.
99

1010
BOARD ?= qemu_x86
11-
CONF_FILE = prj_$(BOARD)_merged.conf
1211
OUTDIR_PREFIX = $(BOARD)
1312

1413
# Default heap size is 16KB, which is on conservative side, to let
@@ -92,26 +91,23 @@ build/genhdr/qstr.i.last: | $(Z_EXPORTS)
9291
LIBMICROPYTHON_EXTRA_CMD = -$(RM) -f outdir/$(OUTDIR_PREFIX)/zephyr.lnk
9392

9493
# MicroPython's global clean cleans everything, fast
95-
CLEAN_EXTRA = outdir libmicropython.a prj_*_merged.conf
94+
CLEAN_EXTRA = outdir libmicropython.a
9695

9796
# Clean Zephyr things in Zephyr way
9897
z_clean:
9998
$(MAKE) -f Makefile.zephyr BOARD=$(BOARD) clean
10099

101-
# This rule is for prj_$(BOARD)_merged.conf, not $(CONF_FILE), which
102-
# can be overriden.
103-
# prj_$(BOARD).conf is optional, that's why it's resolved with $(wildcard)
104-
# function.
105-
prj_$(BOARD)_merged.conf: prj_base.conf $(wildcard prj_$(BOARD).conf)
106-
$(PYTHON) makeprj.py prj_base.conf prj_$(BOARD).conf $@
107-
108100
test:
109101
cd $(TOP)/tests && ./run-tests --target minimal --device "execpty:make -C ../ports/zephyr run BOARD=$(BOARD) QEMU_PTY=1"
110102

111103
cmake: outdir/$(BOARD)/Makefile
112104

113-
outdir/$(BOARD)/Makefile: $(CONF_FILE)
114-
mkdir -p outdir/$(BOARD) && cmake -DBOARD=$(BOARD) -DCONF_FILE=$(CONF_FILE) -Boutdir/$(BOARD) -H.
105+
ifneq ($(CONF_FILE),)
106+
CMAKE_MOD += -DCONF_FILE=$(CONF_FILE)
107+
endif
108+
109+
outdir/$(BOARD)/Makefile:
110+
mkdir -p outdir/$(BOARD) && cmake -DBOARD=$(BOARD) $(CMAKE_MOD) -Boutdir/$(BOARD) -H.
115111

116112
$(Z_EXPORTS): outdir/$(BOARD)/Makefile
117113
make --no-print-directory -C outdir/$(BOARD) outputexports CMAKE_COMMAND=: >$@
File renamed without changes.
File renamed without changes.

ports/zephyr/makeprj.py

Lines changed: 0 additions & 29 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)