From 1253766414950578e82868151c271194c7f7c6d8 Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Mon, 9 May 2022 08:57:03 +0200 Subject: [PATCH] [Tizen] Use docker images with Tizen Studio CLI (#17321) --- .github/workflows/examples-tizen.yaml | 2 +- build/config/tizen/config.gni | 18 ++++++++++++++++++ build/toolchain/tizen/tizen_toolchain.gni | 13 ++++++++----- scripts/build/builders/tizen.py | 17 +++++++++++++---- scripts/build/test.py | 3 ++- .../build/testdata/build_all_except_host.txt | 16 ++++++++-------- 6 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 build/config/tizen/config.gni diff --git a/.github/workflows/examples-tizen.yaml b/.github/workflows/examples-tizen.yaml index c813a176ff916b..663596a1dd27a7 100644 --- a/.github/workflows/examples-tizen.yaml +++ b/.github/workflows/examples-tizen.yaml @@ -32,7 +32,7 @@ jobs: if: github.actor != 'restyled-io[bot]' container: - image: connectedhomeip/chip-build-tizen:0.5.64 + image: connectedhomeip/chip-build-tizen:0.5.71 options: --user root volumes: - "/tmp/bloat_reports:/tmp/bloat_reports" diff --git a/build/config/tizen/config.gni b/build/config/tizen/config.gni new file mode 100644 index 00000000000000..eb3be358bbf6a7 --- /dev/null +++ b/build/config/tizen/config.gni @@ -0,0 +1,18 @@ +# Copyright (c) 2020 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +declare_args() { + # Location of the Tizen SDK. + tizen_sdk_root = "" +} diff --git a/build/toolchain/tizen/tizen_toolchain.gni b/build/toolchain/tizen/tizen_toolchain.gni index 9f88753925a4dc..46833cea06942f 100644 --- a/build/toolchain/tizen/tizen_toolchain.gni +++ b/build/toolchain/tizen/tizen_toolchain.gni @@ -14,7 +14,7 @@ import("//build_overrides/build.gni") -import("${build_root}/config/sysroot.gni") +import("${build_root}/config/tizen/config.gni") import("${build_root}/toolchain/gcc_toolchain.gni") template("tizen_toolchain") { @@ -22,15 +22,18 @@ template("tizen_toolchain") { _tizen_toolchain_args = { current_os = "tizen" - is_clang = true + is_clang = false forward_variables_from(_invoker_toolchain_args, "*") } + _tizen_toolchain_prefix = + "${tizen_sdk_root}/tools/arm-linux-gnueabi-gcc-9.2/bin/arm-linux-gnueabi-" + gcc_toolchain(target_name) { toolchain_args = _tizen_toolchain_args - ar = "$sysroot/bin/arm-linux-gnueabi-ar" - cc = "$sysroot/bin/arm-linux-gnueabi-gcc" - cxx = "$sysroot/bin/arm-linux-gnueabi-g++" + ar = _tizen_toolchain_prefix + "ar" + cc = _tizen_toolchain_prefix + "gcc" + cxx = _tizen_toolchain_prefix + "g++" } } diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index 53c852bcb05a4b..b3d3a7c88a06b1 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -60,6 +60,17 @@ def __init__(self, root=os.path.join(root, 'examples', app.ExampleName(), 'linux'), runner=runner) + # Make sure that required ENV variables are defined + for env in ('TIZEN_SDK_ROOT', 'TIZEN_SDK_SYSROOT'): + if env not in os.environ: + raise Exception( + "Environment %s missing, cannot build Tizen target" % env) + + self.tizen_sdk_root = os.environ['TIZEN_SDK_ROOT'] + self.tizen_sdk_sysroot = os.environ['TIZEN_SDK_SYSROOT'] + self.tizen_sdk_cli = os.path.join( + self.tizen_sdk_root, "tools/ide/bin/tizen") + self.app = app self.board = board self.extra_gn_options = [] @@ -74,13 +85,11 @@ def __init__(self, raise Exception("TSAN sanitizer not supported by Tizen toolchain") def GnBuildArgs(self): - if 'TIZEN_HOME' not in os.environ: - raise Exception( - "Environment TIZEN_HOME missing, cannot build Tizen target") return self.extra_gn_options + [ 'target_os="tizen"', 'target_cpu="%s"' % self.board.TargetCpuName(), - 'sysroot="%s"' % os.environ['TIZEN_HOME'], + 'tizen_sdk_root="%s"' % self.tizen_sdk_root, + 'sysroot="%s"' % self.tizen_sdk_sysroot, ] def build_outputs(self): diff --git a/scripts/build/test.py b/scripts/build/test.py index 992a5ce800f4ae..5559847adf50d9 100644 --- a/scripts/build/test.py +++ b/scripts/build/test.py @@ -40,7 +40,8 @@ def build_actual_output(root: str, out: str, args: List[str]) -> List[str]: 'PW_PROJECT_ROOT': root, 'ANDROID_NDK_HOME': 'TEST_ANDROID_NDK_HOME', 'ANDROID_HOME': 'TEST_ANDROID_HOME', - 'TIZEN_HOME': 'TEST_TIZEN_HOME', + 'TIZEN_SDK_ROOT': 'TEST_TIZEN_SDK_ROOT', + 'TIZEN_SDK_SYSROOT': 'TEST_TIZEN_SDK_SYSROOT', 'TELINK_ZEPHYR_SDK_DIR': 'TELINK_ZEPHYR_SDK_DIR', 'SYSROOT_AARCH64': 'SYSROOT_AARCH64', 'NXP_K32W061_SDK_ROOT': 'TEST_NXP_K32W061_SDK_ROOT', diff --git a/scripts/build/testdata/build_all_except_host.txt b/scripts/build/testdata/build_all_except_host.txt index b8d5f8588bf915..1a7820ebc89b7f 100644 --- a/scripts/build/testdata/build_all_except_host.txt +++ b/scripts/build/testdata/build_all_except_host.txt @@ -950,28 +950,28 @@ source "$ZEPHYR_BASE/zephyr-env.sh"; west build --cmake-only -d {out}/telink-tlsr9518adk80d-light -b tlsr9518adk80d {root}/examples/lighting-app/telink' # Generating tizen-arm-light -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light # Generating tizen-arm-light-asan -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=is_asan=true target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-asan # Generating tizen-arm-light-no-ble -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-ble +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-ble # Generating tizen-arm-light-no-ble-asan -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false is_asan=true target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-ble-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-ble-asan # Generating tizen-arm-light-no-ble-no-wifi -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false chip_enable_wifi=false target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-ble-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-ble-no-wifi # Generating tizen-arm-light-no-ble-no-wifi-asan -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-ble-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_config_network_layer_ble=false chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-ble-no-wifi-asan # Generating tizen-arm-light-no-wifi -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_enable_wifi=false target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-wifi +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_enable_wifi=false target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-wifi # Generating tizen-arm-light-no-wifi-asan -gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" sysroot="TEST_TIZEN_HOME"' {out}/tizen-arm-light-no-wifi-asan +gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=chip_enable_wifi=false is_asan=true target_os="tizen" target_cpu="arm" tizen_sdk_root="TEST_TIZEN_SDK_ROOT" sysroot="TEST_TIZEN_SDK_SYSROOT"' {out}/tizen-arm-light-no-wifi-asan # Building ameba-amebad-all-clusters ninja -C {out}/ameba-amebad-all-clusters