Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add k32w support into build_examples and use it for CI #13062

Merged
merged 19 commits into from
Dec 16, 2021
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ RUN chown -R $USERNAME:$USERNAME /opt/android/sdk

# AmebaD requires access to change build_info.h
RUN chown -R $USERNAME:$USERNAME /opt/ameba/ambd_sdk_with_chip_non_NDA/

# NXP uses a patch_sdk script to change SDK files
RUN chown -R $USERNAME:$USERNAME /opt/sdk/sdks/
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
"BUILD_VERSION": "0.5.33"
"BUILD_VERSION": "0.5.40"
}
},
"remoteUser": "vscode",
Expand Down
33 changes: 15 additions & 18 deletions .github/workflows/examples-k32w.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,31 @@ jobs:
path: |
.environment/gn_out/.ninja_log
.environment/pigweed-venv/*.log
- name: Build example K32W Lock App
- name: Build examples
timeout-minutes: 5
run: |
scripts/examples/k32w_example.sh \
examples/lock-app/nxp/k32w/k32w0 out/lock_app_debug
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w061+debug lock-app \
out/lock_app_debug/chip-k32w061-lock-example \
/tmp/bloat_reports/
- name: Build example K32W Shell App
scripts/run_in_build_env.sh "\
./scripts/build/build_examples.py \
--target k32w-light-release \
--target k32w-lock-low-power \
--target k32w-shell \
build \
--copy-artifacts-to out/artifacts \
"
- name: Get light size stats
timeout-minutes: 5
run: |
scripts/examples/k32w_example.sh \
examples/shell/nxp/k32w/k32w0 out/shell_app_debug no_low_power
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w061+debug shell \
out/shell_app_debug/chip-k32w061-shell-example \
k32w k32w061+release light \
out/artifacts/k32w-light-release/chip-k32w061-light-example \
/tmp/bloat_reports/
- name: Build example K32W Lighting App with Secure Element
- name: Get lock size stats
timeout-minutes: 5
run: |
scripts/examples/k32w_se_example.sh \
examples/lighting-app/nxp/k32w/k32w0 out/lighting_app_se_release
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
k32w k32w061+se05x+release lighting-app \
out/lighting_app_se_release/chip-k32w061-light-example \
k32w k32w061 lock \
out/artifacts/k32w-lock-low-power/chip-k32w061-lock-example \
/tmp/bloat_reports/

- name: Uploading Size Reports
uses: actions/upload-artifact@v2
if: ${{ !env.ACT }}
Expand Down
4 changes: 2 additions & 2 deletions integrations/cloudbuild/build-all.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -12,7 +12,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand Down
12 changes: 6 additions & 6 deletions integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
steps:
- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -12,7 +12,7 @@ steps:
path: /pwenv
timeout: 900s

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
id: ESP32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -28,7 +28,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
id: NRFConnect
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -45,7 +45,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
id: EFR32
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -62,7 +62,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
id: Linux
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand All @@ -79,7 +79,7 @@ steps:
- name: pwenv
path: /pwenv

- name: "connectedhomeip/chip-build-vscode:0.5.33"
- name: "connectedhomeip/chip-build-vscode:0.5.40"
id: Android
env:
- PW_ENVIRONMENT_ROOT=/pwenv
Expand Down
3 changes: 3 additions & 0 deletions scripts/build/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ pw_python_package("build_examples") {
"build_examples.py",
"builders/__init__.py",
"builders/ameba.py",
"builders/android.py",
"builders/builder.py",
"builders/efr32.py",
"builders/esp32.py",
"builders/gn.py",
"builders/host.py",
"builders/infineon.py",
"builders/k32w.py",
"builders/mbed.py",
"builders/nrf.py",
"builders/qpg.py",
"builders/telink.py",
Expand Down
23 changes: 19 additions & 4 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@
from typing import Any, List
from itertools import combinations

from builders.ameba import AmebaApp, AmebaBoard, AmebaBuilder
from builders.android import AndroidBoard, AndroidApp, AndroidBuilder
from builders.efr32 import Efr32Builder, Efr32App, Efr32Board
from builders.esp32 import Esp32Builder, Esp32Board, Esp32App
from builders.host import HostBuilder, HostApp, HostBoard
from builders.infineon import InfineonBuilder, InfineonApp, InfineonBoard
from builders.k32w import K32WApp, K32WBuilder
from builders.mbed import MbedApp, MbedBoard, MbedProfile, MbedBuilder
from builders.nrf import NrfApp, NrfBoard, NrfConnectBuilder
from builders.qpg import QpgBuilder
from builders.infineon import InfineonBuilder, InfineonApp, InfineonBoard
from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder
from builders.tizen import TizenApp, TizenBoard, TizenBuilder
from builders.ameba import AmebaApp, AmebaBoard, AmebaBuilder
from builders.mbed import MbedApp, MbedBoard, MbedProfile, MbedBuilder


class Target:
Expand Down Expand Up @@ -335,6 +336,19 @@ def AmebaTargets():
yield ameba_target.Extend('amebad-light', board=AmebaBoard.AMEBAD, app=AmebaApp.LIGHT)


def K32WTargets():
target = Target('k32w', K32WBuilder)

yield target.Extend('light', app=K32WApp.LIGHT)
yield target.Extend('light-release', app=K32WApp.LIGHT, release=True)

yield target.Extend('shell', app=K32WApp.SHELL)

yield target.Extend('lock', app=K32WApp.LOCK)
yield target.Extend('lock-low-power', app=K32WApp.LOCK, low_power=True)
yield target.Extend('lock-low-power-release', app=K32WApp.LOCK, low_power=True, release=True).GlobBlacklist("Only on demand build")


ALL = []

target_generators = [
Expand All @@ -345,7 +359,8 @@ def AmebaTargets():
AndroidTargets(),
MbedTargets(),
InfineonTargets(),
AmebaTargets()
AmebaTargets(),
K32WTargets(),
]

for generator in target_generators:
Expand Down
93 changes: 93 additions & 0 deletions scripts/build/builders/k32w.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Copyright (c) 2021 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.

import os
from enum import Enum, auto

from .gn import GnBuilder


class K32WApp(Enum):
LIGHT = auto()
LOCK = auto()
SHELL = auto()

def ExampleName(self):
if self == K32WApp.LIGHT:
return 'lighting-app'
elif self == K32WApp.LOCK:
return 'lock-app'
elif self == K32WApp.SHELL:
return 'shell'
else:
raise Exception('Unknown app type: %r' % self)

def AppNamePrefix(self):
if self == K32WApp.LIGHT:
return 'chip-k32w061-light-example'
elif self == K32WApp.LOCK:
return 'chip-k32w061-lock-example'
elif self == K32WApp.SHELL:
return 'chip-k32w061-shell-example'
else:
raise Exception('Unknown app type: %r' % self)

def BuildRoot(self, root):
return os.path.join(root, 'examples', self.ExampleName(), 'nxp', 'k32w', 'k32w0')


class K32WBuilder(GnBuilder):

def __init__(self,
root,
runner,
app: K32WApp = K32WApp.LIGHT,
release: bool = False,
low_power: bool = False):
super(K32WBuilder, self).__init__(
root=app.BuildRoot(root),
runner=runner)
self.code_root = root
self.app = app
self.low_power = low_power
self.release = release

def GnBuildArgs(self):
args = [
'k32w0_sdk_root="%s"' % os.environ['NXP_K32W061_SDK_ROOT'],
]

if self.low_power:
args.append('chip_with_low_power=1')
else:
args.append('chip_with_low_power=0')

if self.release:
args.append('is_debug=false')

return args

def generate(self):
self._Execute([os.path.join(self.code_root, 'third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh'])

super(K32WBuilder, self).generate()


def build_outputs(self):
items={}
for extension in ["", ".map", ".hex"]:
name='%s%s' % (self.app.AppNamePrefix(), extension)
items[name]=os.path.join(self.output_dir, name)

return items
1 change: 1 addition & 0 deletions scripts/build/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def build_actual_output(root: str, out: str, args: List[str]) -> List[str]:
'TIZEN_HOME': 'TEST_TIZEN_HOME',
'TELINK_ZEPHYR_SDK_DIR': 'TELINK_ZEPHYR_SDK_DIR',
'SYSROOT_AARCH64': 'SYSROOT_AARCH64',
'NXP_K32W061_SDK_ROOT': 'TEST_NXP_K32W061_SDK_ROOT',
})

retval = subprocess.run([
Expand Down
6 changes: 6 additions & 0 deletions scripts/build/testdata/all_targets_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ esp32-m5stack-all-clusters-rpc-ipv6only
infineon-p6-all-clusters
infineon-p6-light
infineon-p6-lock
k32w-light
k32w-light-release
k32w-lock
k32w-lock-low-power
k32w-lock-low-power-release (NOGLOB: Only on demand build)
k32w-shell
mbed-CY8CPROTO_062_4343W-all-clusters-debug (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html)
mbed-CY8CPROTO_062_4343W-all-clusters-develop (NOGLOB: Compile only for debugging purpose - https://os.mbed.com/docs/mbed-os/latest/program-setup/build-profiles-and-rules.html)
mbed-CY8CPROTO_062_4343W-all-clusters-release
Expand Down
48 changes: 48 additions & 0 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,36 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa
# Generating infineon-p6-lock
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/p6 '--args=p6_board="CY8CKIT-062S2-43012"' {out}/infineon-p6-lock

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-light
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=0' {out}/k32w-light

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-light-release
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=0 is_debug=false' {out}/k32w-light-release

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-lock
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=0' {out}/k32w-lock

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-lock-low-power
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=1' {out}/k32w-lock-low-power

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-lock-low-power-release
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=1 is_debug=false' {out}/k32w-lock-low-power-release

{root}/third_party/nxp/k32w0_sdk/sdk_fixes/patch_k32w_sdk.sh

# Generating k32w-shell
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/shell/nxp/k32w/k32w0 '--args=k32w0_sdk_root="TEST_NXP_K32W061_SDK_ROOT" chip_with_low_power=0' {out}/k32w-shell

# Generating config mbed-CY8CPROTO_062_4343W-all-clusters-debug
mbed-tools configure -t GCC_ARM -m CY8CPROTO_062_4343W -p {root}/examples/all-clusters-app/mbed -o {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug --mbed-os-path {root}/third_party/mbed-os/repo

Expand Down Expand Up @@ -986,6 +1016,24 @@ ninja -C {out}/infineon-p6-light
# Building infineon-p6-lock
ninja -C {out}/infineon-p6-lock

# Building k32w-light
ninja -C {out}/k32w-light

# Building k32w-light-release
ninja -C {out}/k32w-light-release

# Building k32w-lock
ninja -C {out}/k32w-lock

# Building k32w-lock-low-power
ninja -C {out}/k32w-lock-low-power

# Building k32w-lock-low-power-release
ninja -C {out}/k32w-lock-low-power-release

# Building k32w-shell
ninja -C {out}/k32w-shell

# Remove old artifacts mbed-CY8CPROTO_062_4343W-all-clusters-debug
bash -c 'rm -rf {out}/mbed-CY8CPROTO_062_4343W-all-clusters-debug/chip-*'

Expand Down
5 changes: 5 additions & 0 deletions scripts/build/testdata/glob_star_targets_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ esp32-m5stack-all-clusters-rpc-ipv6only
infineon-p6-all-clusters
infineon-p6-light
infineon-p6-lock
k32w-light
k32w-light-release
k32w-lock
k32w-lock-low-power
k32w-shell
mbed-CY8CPROTO_062_4343W-all-clusters-release
mbed-CY8CPROTO_062_4343W-light-release
mbed-CY8CPROTO_062_4343W-lock-release
Expand Down
Loading