Skip to content

Commit

Permalink
[µTVM] Zephyr: Fix missing board-specific config file in build dir (a…
Browse files Browse the repository at this point in the history
…pache#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 <gustavo.romero@linaro.org>
  • Loading branch information
gromero authored and Trevor Morris committed Jun 17, 2021
1 parent df84e19 commit 5618c1a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/tvm/micro/contrib/zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,17 @@ def library(self, output, sources, options=None):
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")
Expand Down

0 comments on commit 5618c1a

Please sign in to comment.