diff --git a/.github/workflows/examples-nxp.yaml b/.github/workflows/examples-nxp.yaml index d3ea4af06df3dc..747813d6aa1037 100644 --- a/.github/workflows/examples-nxp.yaml +++ b/.github/workflows/examples-nxp.yaml @@ -96,7 +96,71 @@ jobs: if: ${{ !env.ACT }} with: platform-name: K32W + rw61x: + name: RW61X + env: + BUILD_TYPE: gn_rw61x + + runs-on: ubuntu-latest + if: github.actor != 'restyled-io[bot]' + + container: + image: ghcr.io/project-chip/chip-build-rw61x:66 + volumes: + - "/tmp/bloat_reports:/tmp/bloat_reports" + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Checkout submodules & Bootstrap + uses: ./.github/actions/checkout-submodules-and-bootstrap + with: + platform: nxp + extra-submodule-parameters: --recursive + + - name: Set up environment for size reports + uses: ./.github/actions/setup-size-reports + if: ${{ !env.ACT }} + with: + gh-context: ${{ toJson(github) }} + + - name: Build RW61X all clusters example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rw61x-freertos-all-clusters-wifi \ + --target nxp-rw61x-freertos-all-clusters-thread \ + --target nxp-rw61x-freertos-all-clusters-thread-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + + - name: Build RW61X thermostat example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rw61x-freertos-thermostat-wifi \ + --target nxp-rw61x-freertos-thermostat-thread \ + --target nxp-rw61x-freertos-thermostat-thread-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + + - name: Build RW61X laundry-washer example app + run: | + scripts/run_in_build_env.sh "\ + ./scripts/build/build_examples.py \ + --target nxp-rw61x-freertos-laundry-washer-wifi \ + --target nxp-rw61x-freertos-laundry-washer-thread \ + --target nxp-rw61x-freertos-laundry-washer-thread-wifi \ + build \ + --copy-artifacts-to out/artifacts \ + " + - name: Uploading Size Reports + uses: ./.github/actions/upload-size-reports + if: ${{ !env.ACT }} + with: + platform-name: RW61X zephyr: name: ZEPHYR_RW61X diff --git a/.github/workflows/examples-rw61x.yaml b/.github/workflows/examples-rw61x.yaml deleted file mode 100644 index 8766a9b1958e10..00000000000000 --- a/.github/workflows/examples-rw61x.yaml +++ /dev/null @@ -1,96 +0,0 @@ -# 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. - -name: Build example - RW61X - -on: - push: - branches-ignore: - - 'dependabot/**' - pull_request: - merge_group: - -concurrency: - group: ${{ github.ref }}-${{ github.workflow }}-${{ (github.event_name == 'pull_request' && github.event.number) || (github.event_name == 'workflow_dispatch' && github.run_number) || github.sha }} - cancel-in-progress: true - -env: - CHIP_NO_LOG_TIMESTAMPS: true - -jobs: - rw61x: - name: RW61X - - env: - BUILD_TYPE: gn_rw61x - - runs-on: ubuntu-latest - if: github.actor != 'restyled-io[bot]' - - container: - image: ghcr.io/project-chip/chip-build-rw61x:66 - volumes: - - "/tmp/bloat_reports:/tmp/bloat_reports" - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Checkout submodules & Bootstrap - uses: ./.github/actions/checkout-submodules-and-bootstrap - with: - platform: nxp - extra-submodule-parameters: --recursive - - - name: Set up environment for size reports - uses: ./.github/actions/setup-size-reports - if: ${{ !env.ACT }} - with: - gh-context: ${{ toJson(github) }} - - - name: Build RW61X all clusters example app - run: | - scripts/run_in_build_env.sh "\ - ./scripts/build/build_examples.py \ - --target rw61x-all-clusters-app-wifi \ - --target rw61x-all-clusters-app-thread \ - --target rw61x-all-clusters-app-thread-wifi \ - build \ - --copy-artifacts-to out/artifacts \ - " - - - name: Build RW61X thermostat example app - run: | - scripts/run_in_build_env.sh "\ - ./scripts/build/build_examples.py \ - --target rw61x-thermostat-wifi \ - --target rw61x-thermostat-thread \ - --target rw61x-thermostat-thread-wifi \ - build \ - --copy-artifacts-to out/artifacts \ - " - - - name: Build RW61X laundry-washer example app - run: | - scripts/run_in_build_env.sh "\ - ./scripts/build/build_examples.py \ - --target rw61x-laundry-washer-wifi \ - --target rw61x-laundry-washer-thread \ - --target rw61x-laundry-washer-thread-wifi \ - build \ - --copy-artifacts-to out/artifacts \ - " - - name: Uploading Size Reports - uses: ./.github/actions/upload-size-reports - if: ${{ !env.ACT }} - with: - platform-name: RW61X diff --git a/scripts/build/BUILD.gn b/scripts/build/BUILD.gn index dd3ed2de3e7efa..36b8209285576e 100644 --- a/scripts/build/BUILD.gn +++ b/scripts/build/BUILD.gn @@ -59,7 +59,6 @@ pw_python_package("build_examples") { "builders/nxp.py", "builders/openiotsdk.py", "builders/qpg.py", - "builders/rw61x.py", "builders/telink.py", "builders/tizen.py", "runner/__init__.py", diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 2c5f84ca30ad37..433d98911f2f1f 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -31,7 +31,6 @@ from builders.nxp import NxpApp, NxpBoard, NxpBuilder, NxpOsUsed from builders.openiotsdk import OpenIotSdkApp, OpenIotSdkBuilder, OpenIotSdkCryptoBackend from builders.qpg import QpgApp, QpgBoard, QpgBuilder -from builders.rw61x import RW61XApp, RW61XBuilder from builders.stm32 import stm32App, stm32Board, stm32Builder from builders.telink import TelinkApp, TelinkBoard, TelinkBuilder from builders.ti import TIApp, TIBoard, TIBuilder @@ -506,7 +505,7 @@ def BuildNxpTarget(): # OS target.AppendFixedTargets([ TargetPart('zephyr', os_env=NxpOsUsed.ZEPHYR).OnlyIfRe('rw61x'), - TargetPart('freertos', os_env=NxpOsUsed.FREERTOS).ExceptIfRe('rw61x'), + TargetPart('freertos', os_env=NxpOsUsed.FREERTOS), ]) # apps @@ -526,6 +525,10 @@ def BuildNxpTarget(): target.AppendModifier(name="dac-conversion", convert_dac_pk=True).OnlyIfRe('factory').ExceptIfRe('(k32w0|rw61x)') target.AppendModifier(name="rotating-id", enable_rotating_id=True).ExceptIfRe('rw61x') target.AppendModifier(name="sw-v2", has_sw_version_2=True) + target.AppendModifier(name="ota", enable_ota=True).ExceptIfRe('zephyr') + target.AppendModifier(name="wifi", enable_wifi=True).OnlyIfRe('rw61x') + target.AppendModifier(name="thread", enable_thread=True).ExceptIfRe('zephyr') + target.AppendModifier(name="matter-shell", enable_shell=True).ExceptIfRe('k32w0|k32w1') return target @@ -720,25 +723,6 @@ def BuildMW320Target(): return target -def BuildRW61XTarget(): - target = BuildTarget('rw61x', RW61XBuilder) - - # apps - target.AppendFixedTargets([ - TargetPart('all-clusters-app', app=RW61XApp.ALL_CLUSTERS, release=True), - TargetPart('thermostat', app=RW61XApp.THERMOSTAT, release=True), - TargetPart('laundry-washer', app=RW61XApp.LAUNDRY_WASHER, release=True), - ]) - - target.AppendModifier(name="ota", enable_ota=True) - target.AppendModifier(name="wifi", enable_wifi=True) - target.AppendModifier(name="thread", enable_thread=True) - target.AppendModifier(name="factory-data", enable_factory_data=True) - target.AppendModifier(name="matter-shell", enable_shell=True) - - return target - - def BuildGenioTarget(): target = BuildTarget('genio', GenioBuilder) target.AppendFixedTargets([TargetPart('lighting-app', app=GenioApp.LIGHT)]) @@ -820,7 +804,6 @@ def BuildOpenIotSdkTargets(): BuildHostTestRunnerTarget(), BuildIMXTarget(), BuildInfineonTarget(), - BuildRW61XTarget(), BuildNxpTarget(), BuildMbedTarget(), BuildMW320Target(), diff --git a/scripts/build/builders/nxp.py b/scripts/build/builders/nxp.py index 74f40eaa0a36aa..b72015f0afc677 100644 --- a/scripts/build/builders/nxp.py +++ b/scripts/build/builders/nxp.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import importlib.util import logging import os from enum import Enum, auto @@ -38,23 +39,29 @@ class NxpBoard(Enum): K32W1 = auto() RW61X = auto() - def Name(self): + def Name(self, os_env): if self == NxpBoard.K32W0: return 'k32w0x' elif self == NxpBoard.K32W1: return 'k32w1' elif self == NxpBoard.RW61X: - return 'rd_rw612_bga' + if os_env == NxpOsUsed.ZEPHYR: + return 'rd_rw612_bga' + else: + return 'rw61x' else: raise Exception('Unknown board type: %r' % self) - def FolderName(self): + def FolderName(self, os_env): if self == NxpBoard.K32W0: return 'k32w/k32w0' elif self == NxpBoard.K32W1: return 'k32w/k32w1' elif self == NxpBoard.RW61X: - return 'zephyr' + if os_env == NxpOsUsed.ZEPHYR: + return 'zephyr' + else: + return 'rt/rw61x' else: raise Exception('Unknown board type: %r' % self) @@ -94,8 +101,8 @@ def NameSuffix(self): else: raise Exception('Unknown app type: %r' % self) - def BuildRoot(self, root, board): - return os.path.join(root, 'examples', self.ExampleName(), 'nxp', board.FolderName()) + def BuildRoot(self, root, board, os_env): + return os.path.join(root, 'examples', self.ExampleName(), 'nxp', board.FolderName(os_env)) class NxpBuilder(GnBuilder): @@ -113,9 +120,16 @@ def __init__(self, use_fro32k: bool = False, enable_lit: bool = False, enable_rotating_id: bool = False, - has_sw_version_2: bool = False): + has_sw_version_2: bool = False, + disable_ble: bool = False, + enable_thread: bool = False, + enable_wifi: bool = False, + disable_ipv4: bool = False, + enable_shell: bool = False, + enable_ota: bool = False, + is_sdk_package: bool = True): super(NxpBuilder, self).__init__( - root=app.BuildRoot(root, board), + root=app.BuildRoot(root, board, os_env), runner=runner) self.code_root = root self.app = app @@ -129,6 +143,13 @@ def __init__(self, self.enable_lit = enable_lit self.enable_rotating_id = enable_rotating_id self.has_sw_version_2 = has_sw_version_2 + self.disable_ipv4 = disable_ipv4 + self.disable_ble = disable_ble + self.enable_thread = enable_thread + self.enable_wifi = enable_wifi + self.enable_ota = enable_ota + self.enable_shell = enable_shell + self.is_sdk_package = is_sdk_package def GnBuildArgs(self): args = [] @@ -159,6 +180,30 @@ def GnBuildArgs(self): if self.has_sw_version_2: args.append('nxp_software_version=2') + if self.enable_ota: + # OTA is enabled by default on kw32 + if self.board == NxpBoard.RW61X: + args.append('chip_enable_ota_requestor=true no_mcuboot=false') + + if self.enable_wifi: + args.append('chip_enable_wifi=true') + + if self.disable_ble: + args.append('chip_enable_ble=false') + + if self.enable_shell: + args.append('chip_enable_matter_cli=true') + + if self.enable_thread: + # thread is enabled by default on kw32 + if self.board == NxpBoard.RW61X: + args.append('chip_enable_openthread=true chip_inet_config_enable_ipv4=false') + if self.enable_wifi: + args.append('openthread_root=\\"//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread-br\\"') + + if self.is_sdk_package: + args.append('is_sdk_package=true') + return args def WestBuildArgs(self): @@ -186,16 +231,50 @@ def generate(self): cmd += ''' west build -p --cmake-only -b {board_name} -d {out_folder} {example_folder} {build_args} '''.format( - board_name=self.board.Name(), + board_name=self.board.Name(self.os_env), out_folder=self.output_dir, - example_folder=self.app.BuildRoot(self.code_root, self.board), + example_folder=self.app.BuildRoot(self.code_root, self.board, self.os_env), build_args=build_args).strip() self._Execute(['bash', '-c', cmd], title='Generating ' + self.identifier) else: - super(NxpBuilder, self).generate() + cmd = '' + # will be used with next sdk version to get sdk path + if 'NXP_UPDATE_SDK_SCRIPT_DOCKER' in os.environ: + # Dynamic import of a python file to get platforms sdk path + spec = importlib.util.spec_from_file_location("None", os.environ['NXP_UPDATE_SDK_SCRIPT_DOCKER']) + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + + for p in module.ALL_PLATFORM_SDK: + if p.sdk_name == 'k32w0': + cmd += 'export NXP_K32W0_SDK_ROOT="' + str(p.sdk_storage_location_abspath) + '" \n ' + elif p.sdk_name == 'common': + cmd += 'export NXP_SDK_ROOT="' + str(p.sdk_storage_location_abspath) + '" \n ' + cmd += 'gn gen --check --fail-on-unused-args --export-compile-commands --root=%s' % self.root + + extra_args = [] + + if self.options.pw_command_launcher: + extra_args.append('pw_command_launcher="%s"' % self.options.pw_command_launcher) + + if self.options.enable_link_map_file: + extra_args.append('chip_generate_link_map_file=true') + + if self.options.pregen_dir: + extra_args.append('chip_code_pre_generated_directory="%s"' % self.options.pregen_dir) + + extra_args.extend(self.GnBuildArgs() or []) + if extra_args: + cmd += ' --args="%s' % ' '.join(extra_args) + '" ' + + cmd += self.output_dir + + title = 'Generating ' + self.identifier + + self._Execute(['bash', '-c', cmd], title=title) def build_outputs(self): - name = 'chip-%s-%s' % (self.board.Name(), self.app.NameSuffix()) + name = 'chip-%s-%s' % (self.board.Name(self.os_env), self.app.NameSuffix()) if self.os_env == NxpOsUsed.ZEPHYR: yield BuilderOutput( os.path.join(self.output_dir, 'zephyr', 'zephyr.elf'), diff --git a/scripts/build/builders/rw61x.py b/scripts/build/builders/rw61x.py deleted file mode 100644 index 47a6d27b51aaba..00000000000000 --- a/scripts/build/builders/rw61x.py +++ /dev/null @@ -1,129 +0,0 @@ -# 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. - -import os -from enum import Enum, auto - -from .builder import BuilderOutput -from .gn import GnBuilder - - -class RW61XApp(Enum): - ALL_CLUSTERS = auto() - THERMOSTAT = auto() - LAUNDRY_WASHER = auto() - - def ExampleName(self): - if self == RW61XApp.ALL_CLUSTERS: - return 'all-clusters-app' - elif self == RW61XApp.THERMOSTAT: - return 'thermostat' - elif self == RW61XApp.LAUNDRY_WASHER: - return 'laundry-washer-app' - else: - raise Exception('Unknown app type: %r' % self) - - def NameSuffix(self): - if self == RW61XApp.ALL_CLUSTERS: - return '-'.join(['chip', 'rw61x', 'all-cluster-example']) - if self == RW61XApp.THERMOSTAT: - return '-'.join(['chip', 'rw61x', 'thermostat-example']) - if self == RW61XApp.LAUNDRY_WASHER: - return '-'.join(['chip', 'rw61x', 'laundry-washer-example']) - else: - raise Exception('Unknown app type: %r' % self) - - def BuildRoot(self, root): - return os.path.join(root, 'examples', self.ExampleName(), 'nxp', 'rt/rw61x') - - -class RW61XBuilder(GnBuilder): - - def __init__(self, - root, - runner, - app: RW61XApp = RW61XApp.ALL_CLUSTERS, - release: bool = False, - disable_ble: bool = False, - enable_thread: bool = False, - enable_wifi: bool = False, - disable_ipv4: bool = False, - enable_shell: bool = False, - enable_ota: bool = False, - enable_factory_data: bool = False, - is_sdk_package: bool = True, - a2_board_revision: bool = False): - super(RW61XBuilder, self).__init__( - root=app.BuildRoot(root), - runner=runner) - self.app = app - self.release = release - self.disable_ipv4 = disable_ipv4 - self.disable_ble = disable_ble - self.enable_thread = enable_thread - self.enable_wifi = enable_wifi - self.enable_ota = enable_ota - self.enable_factory_data = enable_factory_data - self.enable_shell = enable_shell - self.is_sdk_package = is_sdk_package - self.a2_board_revision = a2_board_revision - - def GnBuildArgs(self): - args = [] - - if self.release: - args.append('is_debug=false') - - if self.enable_ota: - args.append('chip_enable_ota_requestor=true no_mcuboot=false') - - if self.disable_ipv4: - args.append('chip_inet_config_enable_ipv4=false') - - if self.disable_ble: - args.append('chip_enable_ble=false') - - if self.enable_wifi: - args.append('chip_enable_wifi=true') - - if self.enable_thread: - args.append('chip_enable_openthread=true chip_inet_config_enable_ipv4=false') - if self.enable_wifi: - args.append('openthread_root=\"//third_party/connectedhomeip/third_party/openthread/ot-nxp/openthread-br\"') - - if self.enable_factory_data: - args.append('chip_with_factory_data=1') - - if self.a2_board_revision: - args.append('board_version=\"A2\"') - - if self.enable_shell: - args.append('chip_enable_matter_cli=true') - - if self.is_sdk_package: - args.append('is_sdk_package=true') - - return args - - def generate(self): - super(RW61XBuilder, self).generate() - - def build_outputs(self): - yield BuilderOutput( - os.path.join(self.output_dir, self.app.NameSuffix()), - f'{self.app.NameSuffix()}.elf') - if self.options.enable_link_map_file: - yield BuilderOutput( - os.path.join(self.output_dir, f'{self.app.NameSuffix()}.map'), - f'{self.app.NameSuffix()}.map') diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index d391093a153fcf..5242b85c038a22 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -13,8 +13,7 @@ linux-{x64,arm64}-{rpc-console,all-clusters,all-clusters-minimal,chip-tool,therm linux-x64-efr32-test-runner[-clang] imx-{chip-tool,lighting-app,thermostat,all-clusters-app,all-clusters-minimal-app,ota-provider-app}[-release] infineon-psoc6-{lock,light,all-clusters,all-clusters-minimal}[-ota][-updateimage][-trustm] -rw61x-{all-clusters-app,thermostat,laundry-washer}[-ota][-wifi][-thread][-factory-data][-matter-shell] -nxp-{k32w0,k32w1,rw61x}-{zephyr,freertos}-{lighting,contact-sensor,all-clusters,laundry-washer,thermostat}[-factory][-low-power][-lit][-fro32k][-smu2][-dac-conversion][-rotating-id][-sw-v2] +nxp-{k32w0,k32w1,rw61x}-{zephyr,freertos}-{lighting,contact-sensor,all-clusters,laundry-washer,thermostat}[-factory][-low-power][-lit][-fro32k][-smu2][-dac-conversion][-rotating-id][-sw-v2][-ota][-wifi][-thread][-matter-shell] mbed-cy8cproto_062_4343w-{lock,light,all-clusters,all-clusters-minimal,pigweed,ota-requestor,shell}[-release][-develop][-debug] mw320-all-clusters-app nrf-{nrf5340dk,nrf52840dk,nrf52840dongle}-{all-clusters,all-clusters-minimal,lock,light,light-switch,shell,pump,pump-controller,window-covering}[-rpc]