Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-dup-cat-20746
Browse files Browse the repository at this point in the history
  • Loading branch information
tcarmelveilleux committed Jul 16, 2022
2 parents 9f8bbf1 + cd4ab7c commit c4b35a1
Show file tree
Hide file tree
Showing 132 changed files with 11,905 additions and 3,539 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: "Validate Gradle Wrapper"
on: [push, pull_request]

jobs:
validation:
name: "Validation"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gradle/wrapper-validation-action@v1
Original file line number Diff line number Diff line change
Expand Up @@ -2083,12 +2083,14 @@ server cluster DoorLock = 257 {
kRFIDCredentials = 0x2;
kFingerCredentials = 0x4;
kLogging = 0x8;
kAccessSchedules = 0x10;
kWeekDaySchedules = 0x10;
kDoorPositionSensor = 0x20;
kFaceCredentials = 0x40;
kCredentialsOTA = 0x80;
kUsersManagement = 0x100;
kNotifications = 0x200;
kYearDaySchedules = 0x400;
kHolidaySchedules = 0x800;
}

struct DlCredential {
Expand Down Expand Up @@ -4303,7 +4305,7 @@ endpoint 1 {
ram attribute wrongCodeEntryLimit default = 3;
ram attribute userCodeTemporaryDisableTime default = 10;
ram attribute requirePINforRemoteOperation;
ram attribute featureMap default = 0x113;
ram attribute featureMap default = 0xD13;
ram attribute clusterRevision default = 6;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"featureLevel": 72,
"featureLevel": 75,
"creator": "zap",
"keyValuePairs": [
{
Expand All @@ -19,14 +19,14 @@
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/app-templates.json",
"version": "chip-v1",
"type": "gen-templates-json"
"type": "gen-templates-json",
"version": "chip-v1"
},
{
"pathRelativity": "relativeToZap",
"path": "../../../src/app/zap-templates/zcl/zcl-with-test-extensions.json",
"version": "ZCL Test Data",
"type": "zcl-properties"
"type": "zcl-properties",
"version": "ZCL Test Data"
}
],
"endpointTypes": [
Expand Down Expand Up @@ -13331,7 +13331,7 @@
"storageOption": "RAM",
"singleton": 0,
"bounded": 0,
"defaultValue": "0x113",
"defaultValue": "0xD13",
"reportable": 1,
"minInterval": 1,
"maxInterval": 65534,
Expand Down Expand Up @@ -24662,5 +24662,6 @@
"endpointVersion": 1,
"deviceIdentifier": 61442
}
]
],
"log": []
}
1 change: 1 addition & 0 deletions examples/all-clusters-app/nrfconnect/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_ASSERT_NO_FILE_INFO=y
CONFIG_ASSERT_VERBOSE=n
CONFIG_PRINTK=n
CONFIG_THREAD_NAME=n
Original file line number Diff line number Diff line change
Expand Up @@ -1925,12 +1925,14 @@ server cluster DoorLock = 257 {
kRFIDCredentials = 0x2;
kFingerCredentials = 0x4;
kLogging = 0x8;
kAccessSchedules = 0x10;
kWeekDaySchedules = 0x10;
kDoorPositionSensor = 0x20;
kFaceCredentials = 0x40;
kCredentialsOTA = 0x80;
kUsersManagement = 0x100;
kNotifications = 0x200;
kYearDaySchedules = 0x400;
kHolidaySchedules = 0x800;
}

struct DlCredential {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_ASSERT_NO_FILE_INFO=y
CONFIG_ASSERT_VERBOSE=n
CONFIG_PRINTK=n
CONFIG_THREAD_NAME=n
147 changes: 140 additions & 7 deletions examples/chef/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ Chef uses the shell app a starting point, but processes the data model defined
on ZAP files during build time. This procedure is handled by its unified build
script: `chef.py`.

As it incorporates the processing of ZAP files as part of the build process, it
does not use `zzz_generated`, but rather places the auto-generated zap artifacts
under its `out` temporary folder.
When processing ZAP files as part of the build process, Chef places the
auto-generated zap artifacts under its `out` temporary folder. Chef uses
artifacts from `zzz_generated` for CI/CD.

All device types available (.zap files) are found inside the `devices` folder.

Expand Down Expand Up @@ -83,9 +83,142 @@ All device types available (.zap files) are found inside the `devices` folder.

All CI jobs for chef can be found in `.github/workflows/chef.yaml`.

These jobs use a platform-specific image with base `chip-build`.
These jobs use a platform-specific image with base `chip-build`. Such images
contain the toolchain for the respective platform under `/opt`.

CI jobs call chef with the options `--ci -t <PLATFORM>`. The `--ci` option will
execute builds for all devices specified in `cicd_config["ci_allow_list"]`
defined in `chef.py` (so long as these devices are also in `/devices`) on the
CI jobs call chef with the options `--ci -t $PLATFORM`. The `--ci` option will
execute builds for all devices specified in `ci_allow_list` defined in
`cicd_config.json` (so long as these devices are also in `/devices`) on the
specified platform.

CI jobs also call the function `bundle_$PLATFORM` at the end of each example
build. This function should copy or move build output files from the build
output location into `_CD_STAGING_DIR`. Typically, the set of files touched is
the minimal set of files needed to flash a device. See the function
`bundle_esp32` for reference.

### Adding a platform

First, implement a `bundle_$PLATFORM` function.

Next, ensure that the examples in `ci_allow_list` build in a container using the
relevant platform image. You can simulate the workflow locally by mounting your
CHIP repo into a container and executing the CI command:

```shell
docker run -it --mount source=$(pwd),target=/workspace,type=bind connectedhomeip/chip-build-$PLATFORM:$VERSION
```

In the container:

```shell
chown -R $(whoami) /workspace
cd /workspace
source ./scripts/bootstrap.sh
source ./scripts/activate.sh
./examples/chef/chef.py --ci -t $PLATFORM
```

Once you are confident the CI examples build and bundle in a container, add a
new job to the chef workflow.

Replace all instances of `$PLATFORM` with the new platform. Replace `$VERSION`
with the image version used in the rest of the workflows, or update the image
version for all images in the workflow as needed.

```yaml
chef_$PLATFORM:
name: Chef - $PLATFORM CI Examples
runs-on: ubuntu-latest
if: github.actor != 'restyled-io[bot]'

container:
image: connectedhomeip/chip-build-$PLATFORM:$VERSION
options: --user root

steps:
- uses: Wandalen/[email protected]
name: Checkout
with:
action: actions/checkout@v3
with: |
token: ${{ github.token }}
attempt_limit: 3
attempt_delay: 2000
- name: Checkout submodules
run: scripts/checkout_submodules.py --shallow --platform $PLATFORM
- name: Bootstrap
timeout-minutes: 10
run: scripts/build/gn_bootstrap.sh
- name: CI Examples $PLATFORM
shell: bash
run: |
./scripts/run_in_build_env.sh "./examples/chef/chef.py --ci -t $PLATFORM"
```
## CD
Once CI is enabled for a platform, the platform may also be integrated into
`integrations/cloudbuild/`, where chef builds are defined in `chef.yaml`. See
the `README` in this path for more information.

Note that the image used in `chef.yaml` is `chip-build-vscode`. See
`docker/images/chip-build-vscode/Dockerfile` for the source of this image. This
image is a combination of the individual toolchain images. Therefore, before a
platform is integrated into chef CD, the toolchain should be copied into
`chip-build-vscode` and `chef.yaml` should be updated to use the new image
version.

Finally, add the new platform to `cd_platforms` in `cicd_config.json`. The
configuration should follow the following schema:

```json
"$PLATFORM": {
"output_archive_prefix_1": ["option_1", "option_2"],
"output_archive_prefix_2": [],
}
```

Take note of the configuration for `linux`:

```json
"linux": {
"linux_x86": ["--cpu_type", "x64"],
"linux_arm64_ipv6only": ["--cpu_type", "arm64", "--ipv6only"]
},
```

This will produce output archives prefixed `linux_x86` and
`linux_arm_64_ipv6only` and will append the respective options to each build
command for these targets.

To test your configuration locally, you may employ a similar strategy as in CI:

```shell
docker run -it --mount source=$(pwd),target=/workspace,type=bind connectedhomeip/chip-build-vscode:$VERSION
```

In the container:

```shell
chown -R $(whoami) /workspace
cd /workspace
source ./scripts/bootstrap.sh
source ./scripts/activate.sh
./examples/chef/chef.py --build_all --keep_going
```

You may also use the Google Cloud Build local builder as detailed in the
`README` of `integrations/cloudbuild/`.

## Adding new devices

To add new devices for chef:

- Execute `python sample_app_util.py zap <zap_file> --rename-file` to rename
the example and place the new file in `examples/chef/devices`.
- See the `README` in `examples/chef/sample_app_util/` for more info.
- Execute `scripts/tools/zap_regen_all.py`, commit `zzz_generated` and
`examples/chef/devices`.
- This is gated by the workflow in `.github/workflows/zap_templates.yaml`.
- All devices added to the repository are built in CD.
13 changes: 7 additions & 6 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,19 @@ def bundle(platform: str, device_name: str) -> None:
platform: The platform to bundle.
device_name: The example to bundle.
"""
bundler_name = f"bundle_{platform}"
matter_file = f"{device_name}.matter"
zap_file = os.path.join(_DEVICE_FOLDER, f"{device_name}.zap")
flush_print(f"Bundling {platform}", with_border=True)
flush_print(f"Cleaning {_CD_STAGING_DIR}")
shutil.rmtree(_CD_STAGING_DIR, ignore_errors=True)
os.mkdir(_CD_STAGING_DIR)
if platform == "linux":
bundle_linux(device_name)
elif platform == "nrfconnect":
bundle_nrfconnect(device_name)
elif platform == "esp32":
bundle_esp32(device_name)
flush_print(f"Checking for {bundler_name}")
chef_module = sys.modules[__name__]
if hasattr(chef_module, bundler_name):
flush_print(f"Found {bundler_name}")
bundler = getattr(chef_module, bundler_name)
bundler(device_name)
else:
flush_print(f"No bundle function for {platform}!")
exit(1)
Expand Down
11 changes: 2 additions & 9 deletions examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,9 @@ void CHIPCommand::MaybeTearDownStack()
// since the CHIP thread and event queue have been stopped, preventing any thread
// races.
//
ShutdownCommissioner(kIdentityNull);
ShutdownCommissioner(kIdentityAlpha);
ShutdownCommissioner(kIdentityBeta);
ShutdownCommissioner(kIdentityGamma);

std::string name = GetIdentity();
chip::FabricId fabricId = strtoull(name.c_str(), nullptr, 0);
if (fabricId >= kIdentityOtherFabricId)
for (auto it = mCommissioners.begin(); it != mCommissioners.end(); it++)
{
ShutdownCommissioner(name);
ShutdownCommissioner(it->first);
}

StopTracing();
Expand Down
6 changes: 3 additions & 3 deletions examples/light-switch-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare_args() {
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
chip_enable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -222,8 +222,8 @@ efr32_executable("light_switch_app") {
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

if (chip_disable_wifi_ipv4) {
defines += [ "WIFI_IPV4_DISABLED" ]
if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

# WiFi Settings
Expand Down
1 change: 1 addition & 0 deletions examples/light-switch-app/nrfconnect/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_ASSERT_NO_FILE_INFO=y
CONFIG_ASSERT_VERBOSE=n
CONFIG_PRINTK=n
CONFIG_THREAD_NAME=n
6 changes: 3 additions & 3 deletions examples/lighting-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare_args() {
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
chip_enable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -217,8 +217,8 @@ efr32_executable("lighting_app") {
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

if (chip_disable_wifi_ipv4) {
defines += [ "WIFI_IPV4_DISABLED" ]
if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

# WiFi Settings
Expand Down
1 change: 1 addition & 0 deletions examples/lighting-app/nrfconnect/prj_release.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ CONFIG_SERIAL=n
CONFIG_LOG=n
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_ASSERT_VERBOSE=n
CONFIG_ASSERT_NO_FILE_INFO=y
CONFIG_PRINTK=n
CONFIG_THREAD_NAME=n
6 changes: 3 additions & 3 deletions examples/lock-app/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ declare_args() {
disable_lcd = false

# Argument to Disable IPv4 for wifi(rs911)
chip_disable_wifi_ipv4 = false
chip_enable_wifi_ipv4 = false
}

declare_args() {
Expand Down Expand Up @@ -219,8 +219,8 @@ efr32_executable("lock_app") {
sources += [ "${examples_plat_dir}/OTAConfig.cpp" ]
}

if (chip_disable_wifi_ipv4) {
defines += [ "WIFI_IPV4_DISABLED" ]
if (chip_enable_wifi_ipv4) {
defines += [ "CHIP_DEVICE_CONFIG_ENABLE_IPV4" ]
}

# WiFi Settings
Expand Down
Loading

0 comments on commit c4b35a1

Please sign in to comment.