Skip to content

Commit

Permalink
[Telink] Handle building Lighting app with Factory Data feature by CI
Browse files Browse the repository at this point in the history
  • Loading branch information
s07641069 committed Mar 13, 2023
1 parent d6dbb1c commit 5362b60
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 5 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
6 changes: 3 additions & 3 deletions config/telink/chip-module/generate_factory_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions examples/lighting-app/telink/factory_data.overlay
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,7 @@ def BuildTelinkTarget():
])

target.AppendModifier('rpc', enable_rpcs=True)
target.AppendModifier('factory-data', enable_factory_data=True)

return target

Expand Down
7 changes: 6 additions & 1 deletion scripts/build/builders/telink.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)}")

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/testdata/all_targets_linux_x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}

0 comments on commit 5362b60

Please sign in to comment.