From 8a8b54a4fa906284395e06e423e31e8476f5c332 Mon Sep 17 00:00:00 2001 From: Andrey Borisovich Date: Wed, 1 Feb 2023 22:34:01 +0100 Subject: [PATCH 1/3] xtensa-build-zephyr.py: upgraded Xtensa toolchain for MTL Intel Meteorlake release toolchain is Xtensa RI-2022.10 version. New toolchain does not support xt-xcc driver anymore so we are forced to switch to new xt-clang driver. To distinguish between default driver for the platform built, (Xtensa GCC or Clang) added new field to script platform list containing a toolchain name "xcc" or "xcc-clang" expected by Zephyr project. Signed-off-by: Andrey Borisovich --- scripts/xtensa-build-zephyr.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index 959a1a49dfc6..a3a4a3b94351 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -76,25 +76,29 @@ "name": "apl", "PLAT_CONFIG": "intel_adsp_cavs15", "XTENSA_CORE": "X4H3I16w2D48w3a_2017_8", - "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}" + "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc" }, { "name": "cnl", "PLAT_CONFIG": "intel_adsp_cavs18", "XTENSA_CORE": "X6H3CNL_2017_8", - "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}" + "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc" }, { "name": "icl", "PLAT_CONFIG": "intel_adsp_cavs20", "XTENSA_CORE": "X6H3CNL_2017_8", - "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}" + "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc" }, { "name": "jsl", "PLAT_CONFIG": "intel_adsp_cavs20_jsl", "XTENSA_CORE": "X6H3CNL_2017_8", - "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}" + "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc" }, { "name": "tgl", @@ -103,6 +107,7 @@ "IPC4_RIMAGE_DESC": "tgl-cavs.toml", "XTENSA_CORE": "cavs2x_LX6HiFi3_2017_8", "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc", "RIMAGE_KEY": pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") }, { @@ -112,13 +117,15 @@ "IPC4_RIMAGE_DESC": "tgl-h-cavs.toml", "XTENSA_CORE": "cavs2x_LX6HiFi3_2017_8", "XTENSA_TOOLS_VERSION": f"RG-2017.8{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xcc", "RIMAGE_KEY": pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") }, { "name": "mtl", "PLAT_CONFIG": "intel_adsp_ace15_mtpm", - "XTENSA_CORE": "ace10_LX7HiFi4_RI_2020_5", - "XTENSA_TOOLS_VERSION": f"RI-2020.5{xtensa_tools_version_postfix}", + "XTENSA_CORE": "ace10_LX7HiFi4_2022_10", + "XTENSA_TOOLS_VERSION": f"RI-2022.10{xtensa_tools_version_postfix}", + "DEFAULT_TOOLCHAIN_VARIANT": "xt-clang", "RIMAGE_KEY": pathlib.Path(SOF_TOP, "keys", "otc_private_key_3k.pem") }, # NXP platforms @@ -542,7 +549,8 @@ def build_platforms(): "or is not a directory") # set variables expected by zephyr/cmake/toolchain/xcc/generic.cmake - os.environ["ZEPHYR_TOOLCHAIN_VARIANT"] = "xcc" + os.environ["ZEPHYR_TOOLCHAIN_VARIANT"] = os.environ.get("ZEPHYR_TOOLCHAIN_VARIANT", + platform_dict["DEFAULT_TOOLCHAIN_VARIANT"]) XTENSA_TOOLCHAIN_PATH = str(pathlib.Path(xtensa_tools_root_dir, "install", "tools").absolute()) os.environ["XTENSA_TOOLCHAIN_PATH"] = XTENSA_TOOLCHAIN_PATH From 5057503be18803716942a7f0e97adfb16152341e Mon Sep 17 00:00:00 2001 From: Andrey Borisovich Date: Thu, 23 Feb 2023 03:49:06 +0100 Subject: [PATCH 2/3] Set SOF C++ language standard to C++17 for Zephyr builds Recent changes to Zephyr header files written in C++ use templates and features provided by the C++14 standard. Meteorlake board that is built with Zephyr has some C++ code that uses those headers. We upgrade straight to C++17 since it is newest standard currently supported by xt-clang toolchain. This change does not affect any other boards since the do not have any C++ code as the time of writing. Signed-off-by: Andrey Borisovich --- zephyr/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index 1cb6308bd1d1..20af32be6a40 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -101,6 +101,10 @@ endif() # SOF module init zephyr_library_named(modules_sof) + +# Zephyr C++ code requires 14 or newer standard +set_property(TARGET modules_sof PROPERTY CXX_STANDARD 17) + zephyr_include_directories( include ) From 780c2ab4aaf1ce42c64444dd27ca90df4fcb4fc2 Mon Sep 17 00:00:00 2001 From: Andrey Borisovich Date: Thu, 23 Feb 2023 03:55:27 +0100 Subject: [PATCH 3/3] west.yml: upgrade Zephyr to e3ae110a05d Includes: - rename of xcc-clang compiler to xt-clang - updates in C++ headers in zephyr/sys/util.h that require C++14 standard now. Signed-off-by: Andrey Borisovich --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index f43c3690da4d..4ced65820b7d 100644 --- a/west.yml +++ b/west.yml @@ -43,7 +43,7 @@ manifest: - name: zephyr repo-path: zephyr - revision: 9af2789cad17924298d705b99a1bca5f35ea88e2 + revision: e3ae110a05d3427647a03fcbeff4478c195c5a48 remote: zephyrproject # Import some projects listed in zephyr/west.yml@revision #