From 06e5011460e9efeab2fd3c55a0d83f3373aa1192 Mon Sep 17 00:00:00 2001 From: Andy Ross Date: Wed, 6 Nov 2024 12:35:34 -0800 Subject: [PATCH] scripts/xtensa-build-zephyr.py: Allow for alternate toolchain versions Currently the build scripts force a single "blessed" Cadence toolchain for each platform, which prohibits the use of upgraded/fixed/standardized tooling by downstreams. Let XTENSA_TOOLS_VERSION be set in the environment and use the PlatformConfig value as a fallback if unspecified. Signed-off-by: Andy Ross --- scripts/xtensa-build-zephyr.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 465c87d6e896..da213f5a8734 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -787,10 +787,14 @@ def build_platforms(): _dict = dataclasses.asdict(platform_configs[platform]) platform_dict = { k:v for (k,v) in _dict.items() if _dict[k] is not None } + xtensa_tools_version = os.getenv("XTENSA_TOOLS_VERSION") + if not xtensa_tools_version: + xtesna_tools_version = platform_dict["XTENSA_TOOLS_VERSION"] xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT") + # when XTENSA_TOOLS_ROOT environmental variable is set, # use user installed Xtensa tools not Zephyr SDK - if "XTENSA_TOOLS_VERSION" in platform_dict and xtensa_tools_root_dir: + if xtensa_tools_version and xtensa_tools_root_dir: xtensa_tools_root_dir = pathlib.Path(xtensa_tools_root_dir) if not xtensa_tools_root_dir.is_dir(): raise RuntimeError(f"Platform {platform} uses Xtensa toolchain." @@ -811,7 +815,7 @@ def build_platforms(): xtensa_tools_root_dir / "install" / "tools" ) # Toolchain sub-directory - TOOLCHAIN_VER = platform_dict["XTENSA_TOOLS_VERSION"] + TOOLCHAIN_VER = xtensa_tools_version platf_build_environ["TOOLCHAIN_VER"] = TOOLCHAIN_VER # This XTENSA_SYSTEM variable was copied as is from XTOS