Skip to content

Commit

Permalink
Merge branch 'master' into handle-keep-active-command-in-fabric-bridg…
Browse files Browse the repository at this point in the history
…e-app
  • Loading branch information
tehampson committed Aug 7, 2024
2 parents 8f9d6be + d47c423 commit c4fdd9b
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 58 deletions.
10 changes: 6 additions & 4 deletions examples/all-clusters-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ will then join the network.

## Building

- [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
- Download and install
[Modustoolbox Software v3.2](https://www.infineon.com/modustoolbox)

Refer to `integrations/docker/images/chip-build-infineon/Dockerfile` or
`scripts/examples/gn_psoc6_example.sh` for downloading the Software and
Refer to `integrations/docker/images/stage-2/chip-build-infineon/Dockerfile`
or `scripts/examples/gn_psoc6_example.sh` for downloading the Software and
related tools.

- Install some additional tools (likely already present for Matter
Expand Down Expand Up @@ -62,11 +63,12 @@ will then join the network.
- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
`MODE SELECT` button. `KITPROG3 STATUS` LED is ON confirms board is in
proper mode.
proper mode. (Modustoolbox Software needs to be installed)
- On the command line:
$ cd ~/connectedhomeip
$ export CY_TOOLS_PATHS=<Modustoolbox install location>/tools_3.2
$ python3 out/infineon-psoc6-all-clusters/chip-psoc6-clusters-example.flash.py
## Commissioning and cluster control
Expand Down
10 changes: 6 additions & 4 deletions examples/all-clusters-minimal-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ will then join the network.

## Building

- [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
- Download and install
[Modustoolbox Software v3.2](https://www.infineon.com/modustoolbox)

Refer to `integrations/docker/images/chip-build-infineon/Dockerfile` or
`scripts/examples/gn_psoc6_example.sh` for downloading the Software and
Refer to `integrations/docker/images/stage-2/chip-build-infineon/Dockerfile`
or `scripts/examples/gn_psoc6_example.sh` for downloading the Software and
related tools.

- Install some additional tools (likely already present for Matter
Expand Down Expand Up @@ -62,11 +63,12 @@ will then join the network.
- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
`MODE SELECT` button. `KITPROG3 STATUS` LED is ON confirms board is in
proper mode.
proper mode. (Modustoolbox Software needs to be installed)
- On the command line:
$ cd ~/connectedhomeip
$ export CY_TOOLS_PATHS=<Modustoolbox install location>/tools_3.2
$ python3 out/infineon-psoc6-all-clusters-minimal/chip-psoc6-clusters-minimal-example.flash.py
## Commissioning and cluster control
Expand Down
14 changes: 13 additions & 1 deletion examples/fabric-bridge-app/fabric-bridge-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,24 @@ config("config") {
include_dirs = [ "include" ]
}

chip_data_model("fabric-bridge-common") {
chip_data_model("fabric-bridge-common-zap") {
zap_file = "fabric-bridge-app.zap"
is_server = true
cflags = [ "-DDYNAMIC_ENDPOINT_COUNT=16" ]
}

# This includes all the clusters that only exist on the dynamic endpoint.
source_set("fabric-bridge-common") {
public_configs = [ ":config" ]

sources = [
"${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.cpp",
"${chip_root}/src/app/clusters/ecosystem-information-server/ecosystem-information-server.h",
]

public_deps = [ ":fabric-bridge-common-zap" ]
}

source_set("fabric-bridge-lib") {
public_configs = [ ":config" ]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(bridgedDeviceBasicAttrs)
kSoftwareVersionSize, 0),
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Ecosystem Information cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(ecosystemInformationBasicAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::RemovedOn::Id, EPOCH_US, kNodeLabelSize, ATTRIBUTE_MASK_NULLABLE),
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::DeviceDirectory::Id, ARRAY, kDescriptorAttributeArraySize, 0),
DECLARE_DYNAMIC_ATTRIBUTE(EcosystemInformation::Attributes::LocationDirectory::Id, ARRAY, kDescriptorAttributeArraySize, 0),
DECLARE_DYNAMIC_ATTRIBUTE_LIST_END();

// Declare Administrator Commissioning cluster attributes
DECLARE_DYNAMIC_ATTRIBUTE_LIST_BEGIN(AdministratorCommissioningAttrs)
DECLARE_DYNAMIC_ATTRIBUTE(AdministratorCommissioning::Attributes::WindowStatus::Id, ENUM8, 1, 0),
Expand All @@ -137,6 +144,7 @@ DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedNodeClusters)
DECLARE_DYNAMIC_CLUSTER(Descriptor::Id, descriptorAttrs, ZAP_CLUSTER_MASK(SERVER), nullptr, nullptr),
DECLARE_DYNAMIC_CLUSTER(BridgedDeviceBasicInformation::Id, bridgedDeviceBasicAttrs, ZAP_CLUSTER_MASK(SERVER),
bridgedDeviceBasicInformationCommands, nullptr),
DECLARE_DYNAMIC_CLUSTER(EcosystemInformation::Id, ecosystemInformationBasicAttrs, ZAP_CLUSTER_MASK(SERVER), nullptr, nullptr),
DECLARE_DYNAMIC_CLUSTER(AdministratorCommissioning::Id, AdministratorCommissioningAttrs, ZAP_CLUSTER_MASK(SERVER),
administratorCommissioningCommands, nullptr) DECLARE_DYNAMIC_CLUSTER_LIST_END;

Expand Down
5 changes: 5 additions & 0 deletions examples/fabric-bridge-app/linux/RpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "pw_rpc_system_server/rpc_server.h"
#include "pw_rpc_system_server/socket.h"

#include <app/clusters/ecosystem-information-server/ecosystem-information-server.h>
#include <lib/core/CHIPError.h>

#include <string>
Expand Down Expand Up @@ -63,6 +64,10 @@ pw::Status FabricBridge::AddSynchronizedDevice(const chip_rpc_SynchronizedDevice
return pw::Status::Unknown();
}

CHIP_ERROR err = EcosystemInformation::EcosystemInformationServer::Instance().AddEcosystemInformationClusterToEndpoint(
device->GetEndpointId());
VerifyOrDie(err == CHIP_NO_ERROR);

return pw::OkStatus();
}

Expand Down
11 changes: 10 additions & 1 deletion examples/fabric-bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include <app/AttributeAccessInterfaceRegistry.h>
#include <app/CommandHandlerInterfaceRegistry.h>
#include <app/clusters/ecosystem-information-server/ecosystem-information-server.h>

#if defined(PW_RPC_FABRIC_BRIDGE_SERVICE) && PW_RPC_FABRIC_BRIDGE_SERVICE
#include "RpcClient.h"
Expand All @@ -35,8 +36,15 @@
#include <sys/ioctl.h>
#include <thread>

using namespace chip;
// This is declared here and not in a header because zap/embr assumes all clusters
// are defined in a static endpoint in the .zap file. From there, the codegen will
// automatically use PluginApplicationCallbacksHeader.jinja to declare and call
// the respective Init callbacks. However, because EcosystemInformation cluster is only
// ever on a dynamic endpoint, this doesn't get declared and called for us, so we
// need to declare and call it ourselves where the application is initialized.
void MatterEcosystemInformationPluginServerInitCallback();

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;
using namespace chip::app::Clusters::AdministratorCommissioning;
Expand Down Expand Up @@ -235,6 +243,7 @@ void ApplicationInit()
{
ChipLogDetail(NotSpecified, "Fabric-Bridge: ApplicationInit()");

MatterEcosystemInformationPluginServerInitCallback();
CommandHandlerInterfaceRegistry::RegisterCommandHandler(&gAdministratorCommissioningCommandHandler);
CommandHandlerInterfaceRegistry::RegisterCommandHandler(&gBridgedDeviceInformationCommandHandler);
registerAttributeAccessOverride(&gBridgedDeviceBasicInformationAttributes);
Expand Down
12 changes: 7 additions & 5 deletions examples/lighting-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ will then join the network.

## Building

- [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
- Download and install
[Modustoolbox Software v3.2](https://www.infineon.com/modustoolbox)

Refer to `integrations/docker/images/chip-build-infineon/Dockerfile` or
`scripts/examples/gn_psoc6_example.sh` for downloading the Software and
Refer to `integrations/docker/images/stage-2/chip-build-infineon/Dockerfile`
or `scripts/examples/gn_psoc6_example.sh` for downloading the Software and
related tools.

- Install some additional tools (likely already present for Matter
Expand All @@ -43,7 +44,7 @@ will then join the network.
python3-pip

- Supported hardware:
[CY8CKIT-062S2-43012](https://www.cypress.com/CY8CKIT-062S2-43012)
[CY8CKIT-062S2-43012](https://www.infineon.com/CY8CKIT-062S2-43012)

* Build the example application:

Expand All @@ -59,11 +60,12 @@ will then join the network.

- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
`MODE SELECT` button. `KITPROG3 STATUS` LED is ON confirms board is in
proper mode.
proper mode. (Modustoolbox Software needs to be installed)

- On the command line:

$ cd ~/connectedhomeip
$ export CY_TOOLS_PATHS=<Modustoolbox install location>/tools_3.2
$ python3 out/infineon-psoc6-light/chip-psoc6-lighting-example.flash.py

## Commissioning and cluster control
Expand Down
20 changes: 11 additions & 9 deletions examples/lock-app/infineon/psoc6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ will then join the network.

## Building

- [Modustoolbox Software](https://www.cypress.com/products/modustoolbox)
- Download and install
[Modustoolbox Software v3.2](https://www.infineon.com/modustoolbox)

Refer to `integrations/docker/images/chip-build-infineon/Dockerfile` or
`scripts/examples/gn_psoc6_example.sh` for downloading the Software and
Refer to `integrations/docker/images/stage-2/chip-build-infineon/Dockerfile`
or `scripts/examples/gn_psoc6_example.sh` for downloading the Software and
related tools.

- Install some additional tools (likely already present for Matter
Expand All @@ -45,7 +46,7 @@ will then join the network.
python3-pip

- Supported hardware:
[CY8CKIT-062S2-43012](https://www.cypress.com/CY8CKIT-062S2-43012)
[CY8CKIT-062S2-43012](https://www.infineon.com/CY8CKIT-062S2-43012)

* Build the example application:

Expand All @@ -66,11 +67,12 @@ more instructions_

- Put CY8CKIT-062S2-43012 board on KitProg3 CMSIS-DAP Mode by pressing the
`MODE SELECT` button. `KITPROG3 STATUS` LED is ON confirms board is in
proper mode.
proper mode. (Modustoolbox Software needs to be installed)

- On the command line:

$ cd ~/connectedhomeip
$ export CY_TOOLS_PATHS=<Modustoolbox install location>/tools_3.2
$ python3 out/infineon-psoc6-lock/chip-psoc6-lock-example.flash.py

## Commissioning and cluster control
Expand Down Expand Up @@ -116,12 +118,12 @@ commands. These power cycle the BlueTooth hardware and disable BR/EDR mode.

### Cluster control

- After successful commissioning, use the OnOff cluster command to toggle
device between On or Off states.
- After successful commissioning, use the doorlock cluster command to toggle
device between lock or Unlock states.

`$ ./out/debug/chip-tool onoff on 1234 1`
`$ ./out/debug/chip-tool doorlock lock-door 1234 1 --timedInteractionTimeoutMs 100`

`$ ./out/debug/chip-tool onoff off 1234 1`
`$ ./out/debug/chip-tool doorlock unlock-door 1234 1 --timedInteractionTimeoutMs 100`

- Cluster OnOff can also be done using the `USER_BTN1` button on the board.
This button is configured with `APP_LOCK_BUTTON` in `include/AppConfig.h`.
Expand Down
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
68 : [Bouffalo Lab] Update gcc toolchain and flash tool
69 : [Infineon] Update ModusToolbox version to 3.2
28 changes: 15 additions & 13 deletions integrations/docker/images/stage-2/chip-build-infineon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@ RUN set -x \
file \
libglib2.0-0 \
libusb-1.0-0 sudo \
libxcb-xinerama0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxkbcommon-x11-0 \
&& rm -rf /var/lib/apt/lists/ \
&& : # last line

# ------------------------------------------------------------------------------
# Download and extract ModusToolbox 2.3
RUN curl --fail --location --show-error \
https://itoolspriv.infineon.com/itbhs/api/packages/com.ifx.tb.tool.modustoolbox/Versions/2.4.0.5972-public/artifacts/ModusToolbox_2.4.0.5972-linux-install.tar.gz/download?noredirect \
-o /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz \
&& tar -C /opt -zxf /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz \
&& rm /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz
# Download ModusToolbox 3.2
RUN curl --fail --location --silent --show-error https://itoolspriv.infineon.com/itbhs/api/packages/com.ifx.tb.tool.modustoolbox/Versions/3.2.0.16028-public/artifacts/ModusToolbox_3.2.0.16028-linux-install.deb/download?noredirect -o /tmp/ModusToolbox_3.2.0.16028-linux-install.deb

# ------------------------------------------------------------------------------
# Execute post-build scripts
RUN /opt/ModusToolbox/tools_2.4/modus-shell/postinstall
# Install ModusToolbox 3.2
RUN apt install /tmp/ModusToolbox_3.2.0.16028-linux-install.deb

# NOTE: udev rules are NOT installed:
# /opt/ModusToolbox/tools_2.4/fw-loader/udev_rules/install_rules.sh
# because docker containers do not support udev
# ------------------------------------------------------------------------------
# Remove ModusToolbox deb file
RUN rm /tmp/ModusToolbox_3.2.0.16028-linux-install.deb

# ------------------------------------------------------------------------------
# Set environment variable required by ModusToolbox application makefiles
ENV CY_TOOLS_PATHS="/opt/ModusToolbox/tools_2.4"
# Run below command to Initialize the CY_TOOLS_PATHS environment variable defined in the /etc/profile.d/modustoolbox_3.2.sh file
RUN bash --login
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM ghcr.io/project-chip/chip-build-efr32:${VERSION} AS efr32
FROM ghcr.io/project-chip/chip-build-android:${VERSION} AS android
FROM ghcr.io/project-chip/chip-build-esp32-qemu:${VERSION} as esp32
FROM ghcr.io/project-chip/chip-build-telink:${VERSION} AS telink
FROM ghcr.io/project-chip/chip-build-infineon:${VERSION} AS p6
FROM ghcr.io/project-chip/chip-build-infineon:${VERSION} AS psoc6
FROM ghcr.io/project-chip/chip-build-tizen:${VERSION} AS tizen
FROM ghcr.io/project-chip/chip-build-crosscompile:${VERSION} AS crosscompile
FROM ghcr.io/project-chip/chip-build-ameba:${VERSION} AS ameba
Expand Down Expand Up @@ -36,7 +36,7 @@ COPY --from=android /opt/android/sdk /opt/android/sdk
COPY --from=android /opt/android/android-ndk-r23c /opt/android/android-ndk-r23c
COPY --from=android /usr/lib/kotlinc /usr/lib/kotlinc

COPY --from=p6 /opt/ModusToolbox /opt/ModusToolbox
COPY --from=psoc6 /opt/Tools/ModusToolbox /opt/Tools/ModusToolbox

COPY --from=telink /opt/telink/zephyrproject /opt/telink/zephyrproject
COPY --from=telink /opt/telink/zephyr-sdk-0.16.1 /opt/telink/zephyr-sdk-0.16.1
Expand Down Expand Up @@ -111,7 +111,7 @@ ENV PATH $PATH:/usr/lib/kotlinc/bin
ENV AMEBA_PATH=/opt/ameba/ambd_sdk_with_chip_non_NDA
ENV ANDROID_HOME=/opt/android/sdk
ENV ANDROID_NDK_HOME=/opt/android/android-ndk-r23c
ENV CY_TOOLS_PATHS="/opt/ModusToolbox/tools_2.4"
ENV CY_TOOLS_PATHS="/opt/Tools/ModusToolbox/tools_3.2"
ENV SILABS_BOARD=BRD4186C
# Keep GSDK_ROOT name until rename transition to SISDK is completed
ENV GSDK_ROOT=/opt/silabs/simplicity_sdk/
Expand Down
23 changes: 7 additions & 16 deletions scripts/examples/gn_psoc6_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,17 @@
# limitations under the License.
#

# Install required software
if [[ -z "${CY_TOOLS_PATHS}" ]]; then
echo "*****************************************************************************************************"
echo "Install ModusToolbox Software v3.2 from https://www.infineon.com/modustoolbox and set CY_TOOLS_PATHS"
echo "*****************************************************************************************************"
fi

set -e
# Build script for GN PSOC6 examples GitHub workflow.
source "$(dirname "$0")/../../scripts/activate.sh"

# Install required software
if [ -d "/opt/ModusToolbox" ]; then
export CY_TOOLS_PATHS="/opt/ModusToolbox/tools_2.4"
elif [ -d "$HOME/ModusToolbox" ]; then
# Set CY TOOLS PATH
export CY_TOOLS_PATHS="$HOME/ModusToolbox/tools_2.4"
else
# Install Modustoolbox
curl --fail --location --silent --show-error https://itoolspriv.infineon.com/itbhs/api/packages/com.ifx.tb.tool.modustoolbox/Versions/2.4.0.5972-public/artifacts/ModusToolbox_2.4.0.5972-linux-install.tar.gz/download?noredirect -o /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz &&
tar -C "$HOME" -zxf /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz &&
rm /tmp/ModusToolbox_2.4.0.5972-linux-install.tar.gz

# Set CY TOOLS PATH
export CY_TOOLS_PATHS="$HOME/ModusToolbox/tools_2.4"
fi

set -x
env

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,17 @@ EcosystemInformationServer & EcosystemInformationServer::Instance()
return mInstance;
}

CHIP_ERROR EcosystemInformationServer::AddEcosystemInformationClusterToEndpoint(EndpointId aEndpoint)
{
VerifyOrReturnError((aEndpoint != kRootEndpointId && aEndpoint != kInvalidEndpointId), CHIP_ERROR_INVALID_ARGUMENT);
auto it = mDevicesMap.find(aEndpoint);
// We expect that the device has not been previously added.
VerifyOrReturnError((it == mDevicesMap.end()), CHIP_ERROR_INCORRECT_STATE);
// This create an empty DeviceInfo in mDevicesMap.
mDevicesMap[aEndpoint] = DeviceInfo();
return CHIP_NO_ERROR;
}

CHIP_ERROR EcosystemInformationServer::AddDeviceInfo(EndpointId aEndpoint, std::unique_ptr<EcosystemDeviceStruct> aDevice)
{
VerifyOrReturnError(aDevice, CHIP_ERROR_INVALID_ARGUMENT);
Expand Down
Loading

0 comments on commit c4fdd9b

Please sign in to comment.