This is an automated email from the ASF dual-hosted git repository.
masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git
The following commit(s) were added to refs/heads/main by this push:
new c29301e [µTVM] Zephyr: Fix missing board-specific config file in
build dir (#8230)
c29301e is described below
commit c29301ea654d307ccf17dde7d19f1cbe15f54586
Author: Gustavo Romero <[email protected]>
AuthorDate: Fri Jun 11 03:06:47 2021 -0300
[µTVM] Zephyr: Fix missing board-specific config file in build dir (#8230)
Currently board-specific config files (boards/*.conf) are not
copied from Zephyr project dir to the destination build dir, so
as a consequence the per board configs are not used when building
the runtime libraries, like libcommon. Hence, for instance, it's
currently not possible to set CONFIG_FPU per board since it only
takes effect when it's set in the generic 'prj.con' config file.
This commit fixes it by copying to the build dir (to each lib
dir) the proper .conf for the selected target board. For example,
if target 'qemu_x86' is selected 'qemu_x86.conf' is copied to
the boards/ dir inside the lib dirs, so Zephyr build system can
find it and combine it with configs found in the generic 'prj.conf'.
Signed-off-by: Gustavo Romero <[email protected]>
---
python/tvm/micro/contrib/zephyr.py | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/python/tvm/micro/contrib/zephyr.py
b/python/tvm/micro/contrib/zephyr.py
index b7d7496..fedd470 100644
--- a/python/tvm/micro/contrib/zephyr.py
+++ b/python/tvm/micro/contrib/zephyr.py
@@ -172,6 +172,17 @@ class ZephyrCompiler(tvm.micro.Compiler):
project_dir_conf = os.path.join(self._project_dir, "prj.conf")
if os.path.exists(project_dir_conf):
shutil.copy(project_dir_conf, lib_prj_conf)
+
+ # Copy board-specific Zephyr config file from the project_dir to
+ # the build lib dir so board-specific configs can be found and
used by
+ # Zephyr's build system in conjunction with the generic prj.conf
configs.
+ board_conf = os.path.join("boards", self._board + ".conf")
+ project_dir_board_conf = os.path.join(self._project_dir,
board_conf)
+ if os.path.exists(project_dir_board_conf):
+ os.mkdir(os.path.join(output, "boards"))
+ lib_dir_board_conf = os.path.join(output, board_conf)
+ shutil.copy(project_dir_board_conf, lib_dir_board_conf)
+
else:
with open(lib_prj_conf, "w") as prj_conf_f:
prj_conf_f.write("CONFIG_CPLUSPLUS=y\n")