From 5362b60f3ee8ab285ce35349adca4169113f9401 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Mon, 13 Mar 2023 14:53:44 +0200 Subject: [PATCH] [Telink] Handle building Lighting app with Factory Data feature by CI --- .github/workflows/examples-telink.yaml | 14 ++++++++++++ .../chip-module/generate_factory_data.cmake | 6 ++--- .../lighting-app/telink/factory_data.overlay | 22 +++++++++++++++++++ scripts/build/build/targets.py | 1 + scripts/build/builders/telink.py | 7 +++++- .../build/testdata/all_targets_linux_x64.txt | 2 +- 6 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 examples/lighting-app/telink/factory_data.overlay diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index f26f0a3c7313da..9f8581330cc42a 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -130,6 +130,20 @@ jobs: - name: clean out build output run: rm -rf ./out + - name: Build example Telink Lighting App with Factory Data + run: | + ./scripts/build/gn_gen.sh + ./scripts/run_in_build_env.sh "ninja -C out chip-cert chip-tool spake2p" + ./scripts/run_in_build_env.sh \ + ./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-factory-data' build" + .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ + telink tlsr9518adk80d lighting-app-factory-data \ + out/telink-tlsr9518adk80d-light-factory-data/zephyr/zephyr.elf \ + /tmp/bloat_reports/ + + - name: clean out build output + run: rm -rf ./out + - name: Build example Telink Light Switch App run: | ./scripts/run_in_build_env.sh \ diff --git a/config/telink/chip-module/generate_factory_data.cmake b/config/telink/chip-module/generate_factory_data.cmake index 780e1d42a05df9..9ba1903266c2dc 100644 --- a/config/telink/chip-module/generate_factory_data.cmake +++ b/config/telink/chip-module/generate_factory_data.cmake @@ -69,7 +69,7 @@ else() endif() # find chip cert tool -find_program(chip_cert_exe NAMES chip-cert REQUIRED) +find_program(chip_cert_exe NAMES chip-cert PATHS ${CHIP_ROOT}/out REQUIRED) string(APPEND script_args "--chip-cert-path ${chip_cert_exe}\n") # for development purpose user can use default certs instead of generating or providing them @@ -99,7 +99,7 @@ else() endif() # find chip tool requied for generating QRCode -find_program(chip_tool_exe NAMES chip-tool REQUIRED) +find_program(chip_tool_exe NAMES chip-tool PATHS ${CHIP_ROOT}/out REQUIRED) string(APPEND script_args "--chip-tool-path ${chip_tool_exe}\n") # add Password-Authenticated Key Exchange parameters @@ -108,7 +108,7 @@ string(APPEND script_args "--discriminator ${CONFIG_CHIP_DEVICE_DISCRIMINATOR}\n string(APPEND script_args "--passcode ${CONFIG_CHIP_DEVICE_SPAKE2_PASSCODE}\n") # request spake2p to generate a new spake2_verifier -find_program(spake_exe NAMES spake2p REQUIRED) +find_program(spake_exe NAMES spake2p PATHS ${CHIP_ROOT}/out REQUIRED) string(APPEND script_args "--spake2-path ${spake_exe}\n") if(CONFIG_CHIP_DEVICE_ENABLE_KEY) diff --git a/examples/lighting-app/telink/factory_data.overlay b/examples/lighting-app/telink/factory_data.overlay new file mode 100644 index 00000000000000..4f7289d9bd15ca --- /dev/null +++ b/examples/lighting-app/telink/factory_data.overlay @@ -0,0 +1,22 @@ +# +# Copyright (c) 2023 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. +# + +# This file should be used as a configuration overlay to enable Factory Data. + +# Enable factory data support. +CONFIG_CHIP_FACTORY_DATA=y +CONFIG_CHIP_FACTORY_DATA_BUILD=y +CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index fa19d84dcca5b9..fefec0aa9ec353 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -558,6 +558,7 @@ def BuildTelinkTarget(): ]) target.AppendModifier('rpc', enable_rpcs=True) + target.AppendModifier('factory-data', enable_factory_data=True) return target diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index afaff3cefa0650..9dc580016fbf7e 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -108,11 +108,13 @@ def __init__(self, runner, app: TelinkApp = TelinkApp, board: TelinkBoard = TelinkBoard.TLSR9518ADK80D, - enable_rpcs: bool = False): + enable_rpcs: bool = False, + enable_factory_data: bool = False): super(TelinkBuilder, self).__init__(root, runner) self.app = app self.board = board self.enable_rpcs = enable_rpcs + self.enable_factory_data = enable_factory_data def get_cmd_prefixes(self): if not self._runner.dry_run: @@ -136,6 +138,9 @@ def generate(self): if self.enable_rpcs: flags.append("-DOVERLAY_CONFIG=rpc.overlay") + if self.enable_factory_data: + flags.append("-DOVERLAY_CONFIG=factory_data.overlay") + if self.options.pregen_dir: flags.append(f"-DCHIP_CODEGEN_PREGEN_DIR={shlex.quote(self.options.pregen_dir)}") diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 01376508a38f83..61ded36b551dfc 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -19,5 +19,5 @@ nrf-{nrf5340dk,nrf52840dk,nrf52840dongle}-{all-clusters,all-clusters-minimal,loc nrf-native-posix-64-tests qpg-qpg6105-{lock,light,shell,persistent-storage} tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-wifi][-asan][-ubsan] -telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-rpc] +telink-tlsr9518adk80d-{all-clusters,all-clusters-minimal,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,temperature-measurement,thermostat,window-covering}[-rpc][-factory-data] openiotsdk-{shell,lock}