Skip to content

Commit 06e5011

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. Signed-off-by: Andy Ross <[email protected]>
1 parent 3e60e08 commit 06e5011

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

scripts/xtensa-build-zephyr.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,14 @@ 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:
794798
xtensa_tools_root_dir = pathlib.Path(xtensa_tools_root_dir)
795799
if not xtensa_tools_root_dir.is_dir():
796800
raise RuntimeError(f"Platform {platform} uses Xtensa toolchain."
@@ -811,7 +815,7 @@ def build_platforms():
811815
xtensa_tools_root_dir / "install" / "tools"
812816
)
813817
# Toolchain sub-directory
814-
TOOLCHAIN_VER = platform_dict["XTENSA_TOOLS_VERSION"]
818+
TOOLCHAIN_VER = xtensa_tools_version
815819
platf_build_environ["TOOLCHAIN_VER"] = TOOLCHAIN_VER
816820

817821
# This XTENSA_SYSTEM variable was copied as is from XTOS

0 commit comments

Comments
 (0)