Skip to content

Commit

Permalink
xtensa-build-zephyr.py: cosmetic: rename "overlays" variable
Browse files Browse the repository at this point in the history
The Zephyr documentation uses the term "overlay" for Device Tree, not
for Kconfig.

This commit does not change the wrongly named --overlay option not to
break anything but it stops that wrong name from leaking all over the
code. Also tweak the --help text.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
  • Loading branch information
marc-hb committed Sep 4, 2024
1 parent ff57b79 commit b625441
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions app/configs/fuzz_features.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
# generations. Something like config fragments including each other? Not something as
# complicated as Yocto fragments but something more flexible than
# https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf
# Or maybe use "snippets"?
# https://docs.zephyrproject.org/latest/build/snippets/writing.html
#
# Discuss in https://github.com/thesofproject/sof/issues/9386

Expand Down
21 changes: 12 additions & 9 deletions scripts/xtensa-build-zephyr.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,13 @@ def parse_args():

# https://docs.zephyrproject.org/latest/build/kconfig/setting.html#initial-conf
# https://docs.zephyrproject.org/latest/develop/application/index.html#important-build-system-variables
# TODO, support "snippets"?
# https://docs.zephyrproject.org/latest/build/snippets/writing.html
parser.add_argument("-o", "--overlay", type=pathlib.Path, required=False, action='append',
default=[], help=
"""All '-o arg1 -o arg2 ...' arguments are combined into a single -DEXTRA_CONF_FILE='arg1;arg2;...'
list. Files latter in the list seem to have precedence. Direct -C=-DCONFIG_xxx=.. options seem to
list. This tweaks the build CONFIGuration like Device Tree "overlays" do.
Files latter in the list seem to have precedence. Direct -C=-DCONFIG_xxx=.. options seem to
have precedence over -DEXTRA_CONF_FILE=... Rely on precedence as little as possible.""")

parser.add_argument("-p", "--pristine", required=False, action="store_true",
Expand Down Expand Up @@ -827,21 +830,21 @@ def build_platforms():
if args.cmake_args:
build_cmd += args.cmake_args

overlays = [str(item.resolve(True)) for item in args.overlay]
extra_conf_files = [str(item.resolve(True)) for item in args.overlay]
# The '-d' option is a shortcut for '-o path_to_debug_overlay', we are good
# if both are provided, because it's no harm to merge the same overlay twice.
if args.debug:
overlays.append(str(pathlib.Path(SOF_TOP, "app", "debug_overlay.conf")))
extra_conf_files.append(str(pathlib.Path(SOF_TOP, "app", "debug_overlay.conf")))

# The xt-cland Cadence toolchain currently cannot link shared
# libraries for Xtensa. Therefore when it's used we switch to
# building relocatable ELF objects.
if platf_build_environ.get("ZEPHYR_TOOLCHAIN_VARIANT") == 'xt-clang':
overlays.append(str(pathlib.Path(SOF_TOP, "app", "llext_relocatable.conf")))
extra_conf_files.append(str(pathlib.Path(SOF_TOP, "app", "llext_relocatable.conf")))

if overlays:
overlays = ";".join(overlays)
build_cmd.append(f"-DEXTRA_CONF_FILE={overlays}")
if extra_conf_files:
extra_conf_files = ";".join(extra_conf_files)
build_cmd.append(f"-DEXTRA_CONF_FILE={extra_conf_files}")

abs_build_dir = pathlib.Path(west_top, platform_build_dir_name)

Expand All @@ -850,9 +853,9 @@ def build_platforms():
pathlib.Path(abs_build_dir, "build.ninja").is_file()
or pathlib.Path(abs_build_dir, "Makefile").is_file()
):
if args.cmake_args or overlays:
if args.cmake_args or extra_conf_files:
warnings.warn("""CMake args slow down incremental builds.
Passing CMake parameters and overlays on the command line slows down incremental builds
Passing CMake parameters and -o conf files on the command line slows down incremental builds
see https://docs.zephyrproject.org/latest/guides/west/build-flash-debug.html#one-time-cmake-arguments
Try "west config build.cmake-args -- ..." instead.""")

Expand Down

0 comments on commit b625441

Please sign in to comment.