Skip to content

Commit ad155c9

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 3e60e08 commit ad155c9

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

scripts/xtensa-build-zephyr.py

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

790+
xtensa_tools_version = os.getenv("XTENSA_TOOLS_VERSION")
791+
if not xtensa_tools_version:
792+
xtesna_tools_version = platform_dict["XTENSA_TOOLS_VERSION"]
790793
xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT")
794+
791795
# when XTENSA_TOOLS_ROOT environmental variable is set,
792796
# use user installed Xtensa tools not Zephyr SDK
793-
if "XTENSA_TOOLS_VERSION" in platform_dict and xtensa_tools_root_dir:
797+
if xtensa_tools_version and xtensa_tools_root_dir:
798+
# These are external input, so log for posterity (and
799+
# build dependency tracking)
800+
print("Building using Cadence Xtensa Tools")
801+
print(f" XTENSA_TOOLS_VERSION = {xtensa_tools_version}")
802+
print(f" XTENSA_TOOLS_ROOT = {xtensa_tools_root_dir}")
803+
794804
xtensa_tools_root_dir = pathlib.Path(xtensa_tools_root_dir)
795805
if not xtensa_tools_root_dir.is_dir():
796806
raise RuntimeError(f"Platform {platform} uses Xtensa toolchain."
@@ -811,7 +821,7 @@ def build_platforms():
811821
xtensa_tools_root_dir / "install" / "tools"
812822
)
813823
# Toolchain sub-directory
814-
TOOLCHAIN_VER = platform_dict["XTENSA_TOOLS_VERSION"]
824+
TOOLCHAIN_VER = xtensa_tools_version
815825
platf_build_environ["TOOLCHAIN_VER"] = TOOLCHAIN_VER
816826

817827
# This XTENSA_SYSTEM variable was copied as is from XTOS

0 commit comments

Comments
 (0)