Skip to content

Commit f2a9cfe

Browse files
committed
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. Also log the resulting choice (and also XTENSA_TOOLS_ROOT, which is likewise external input to the script) for build tracking, so any deployment downstreams can reconstruct what was done. Signed-off-by: Andy Ross <andyross@google.com>
1 parent 41430f7 commit f2a9cfe

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/xtensa-build-zephyr.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -809,10 +809,20 @@ def build_platforms():
809809
_dict = dataclasses.asdict(platform_configs[platform])
810810
platform_dict = { k:v for (k,v) in _dict.items() if _dict[k] is not None }
811811

812+
xtensa_tools_version = os.getenv("XTENSA_TOOLS_VERSION")
813+
if not xtensa_tools_version:
814+
xtesna_tools_version = platform_dict["XTENSA_TOOLS_VERSION"]
812815
xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT")
816+
813817
# when XTENSA_TOOLS_ROOT environmental variable is set,
814818
# use user installed Xtensa tools not Zephyr SDK
815-
if "XTENSA_TOOLS_VERSION" in platform_dict and xtensa_tools_root_dir:
819+
if xtensa_tools_version and xtensa_tools_root_dir:
820+
# These are external input, so log for posterity (and
821+
# build dependency tracking)
822+
print("Building using Cadence Xtensa Tools")
823+
print(f" XTENSA_TOOLS_VERSION = {xtensa_tools_version}")
824+
print(f" XTENSA_TOOLS_ROOT = {xtensa_tools_root_dir}")
825+
816826
xtensa_tools_root_dir = pathlib.Path(xtensa_tools_root_dir)
817827
if not xtensa_tools_root_dir.is_dir():
818828
raise RuntimeError(f"Platform {platform} uses Xtensa toolchain."
@@ -833,7 +843,7 @@ def build_platforms():
833843
xtensa_tools_root_dir / "install" / "tools"
834844
)
835845
# Toolchain sub-directory
836-
TOOLCHAIN_VER = platform_dict["XTENSA_TOOLS_VERSION"]
846+
TOOLCHAIN_VER = xtensa_tools_version
837847
platf_build_environ["TOOLCHAIN_VER"] = TOOLCHAIN_VER
838848

839849
# This XTENSA_SYSTEM variable was copied as is from XTOS

0 commit comments

Comments
 (0)