Skip to content

Commit 1e0bfa9

Browse files
Merge branch 'master' into idm-4.2-troubleshoot
2 parents 5433f31 + 174f2a0 commit 1e0bfa9

28 files changed

+871
-31
lines changed

examples/light-switch-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/light-switch-app/infineon/cyw30739 out/cyw30739-light-switch \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/lighting-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/lighting-app/infineon/cyw30739 out/cyw30739-light \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/lock-app/infineon/cyw30739/README.md

+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ An example showing the use of Matter on the Infineon CYW30739 platform.
1818
- [Commissionable Data](#commissionable-data)
1919
- [Device Information](#device-information)
2020
- [DAC / DAC Key / PAI Certificate / Certificate Declaration](#dac--dac-key--pai-certificate--certificate-declaration)
21+
- [Use Provisioned Optiga Trust M](#use-provisioned-optiga-trust-m)
2122
- [Flashing the Application](#flashing-the-application)
2223
- [Enter Recovery Mode](#enter-recovery-mode)
2324
- [Run Flash Script](#run-flash-script)
@@ -163,6 +164,29 @@ keys, and CD by the following arguments:
163164
'matter_cd="/path/to/cd.der"'
164165
```
165166

167+
### Use Provisioned Optiga Trust M
168+
169+
For boards supported by Optiga Trust M, CYW30739 will provision factory data to
170+
the Optiga Trust M by default for easy development.
171+
172+
The Optiga Trust M on a production board should come with provisioned factory
173+
data. To ensure its optimal use, please configure the Optiga using the following
174+
arguments:
175+
176+
- `use_provisioned_optiga`, `optiga_dac_object_id`,
177+
`optiga_dac_key_object_id`, `optiga_pai_cert_object_id`
178+
179+
```bash
180+
$ cd ~/connectedhomeip
181+
$ scripts/examples/gn_build_example.sh examples/lock-app/infineon/cyw30739 out/cyw30739-lock \
182+
'optiga_dac_object_id="0xe0e0"' \
183+
'optiga_dac_key_object_id="0xe0f0"' \
184+
'optiga_pai_cert_object_id="0xe0e8"'
185+
```
186+
187+
The developer must set the object IDs to corresponding values matching the
188+
configurations used in the Optiga provisioning procedure.
189+
166190
## Flashing the Application
167191

168192
### Enter Recovery Mode

examples/platform/infineon/cyw30739/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ import("${cyw30739_sdk_build_root}/cyw30739_sdk.gni")
2020

2121
static_library("platform") {
2222
sources = [
23+
"EventManagementTestEventTriggerHandler.h",
2324
"LEDWidget.h",
2425
"OTAConfig.h",
26+
"SoftwareDiagnostics.h",
2527
"main.cpp",
2628
]
2729

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "EventManagementTestEventTriggerHandler.h"
20+
21+
#include "SoftwareDiagnostics.h"
22+
23+
namespace chip {
24+
namespace DeviceLayer {
25+
namespace Infineon {
26+
namespace CYW30739 {
27+
28+
CHIP_ERROR EventManagementTestEventTriggerHandler::HandleEventTrigger(uint64_t eventTrigger)
29+
{
30+
switch (eventTrigger)
31+
{
32+
case kFillUpEventLoggingBuffer:
33+
return HandleFillUpEventLoggingBufferEventTriger();
34+
default:
35+
return CHIP_ERROR_INVALID_ARGUMENT;
36+
}
37+
}
38+
39+
void EventManagementTestEventTriggerHandler::TriggerSoftwareFaultEvent(const char * faultRecordString)
40+
{
41+
OnSoftwareFaultEventHandler(faultRecordString);
42+
}
43+
44+
} // namespace CYW30739
45+
} // namespace Infineon
46+
} // namespace DeviceLayer
47+
} // namespace chip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#include <app/GenericEventManagementTestEventTriggerHandler.h>
22+
23+
namespace chip {
24+
namespace DeviceLayer {
25+
namespace Infineon {
26+
namespace CYW30739 {
27+
28+
class EventManagementTestEventTriggerHandler : public app::GenericEventManagementTestEventTriggerHandler
29+
{
30+
public:
31+
static constexpr uint64_t kFillUpEventLoggingBuffer = 0xffff'ffff'1388'0000;
32+
33+
CHIP_ERROR HandleEventTrigger(uint64_t eventTrigger) override;
34+
35+
private:
36+
virtual void TriggerSoftwareFaultEvent(const char * faultRecordString) override;
37+
};
38+
39+
} // namespace CYW30739
40+
} // namespace Infineon
41+
} // namespace DeviceLayer
42+
} // namespace chip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#include "SoftwareDiagnostics.h"
20+
21+
#include <app/clusters/software-diagnostics-server/software-diagnostics-server.h>
22+
#include <app/util/config.h>
23+
#include <platform/CHIPDeviceLayer.h>
24+
25+
namespace chip {
26+
namespace DeviceLayer {
27+
namespace Infineon {
28+
namespace CYW30739 {
29+
30+
using namespace chip::app::Clusters;
31+
32+
void OnSoftwareFaultEventHandler(const char * faultRecordString)
33+
{
34+
#ifdef MATTER_DM_PLUGIN_SOFTWARE_DIAGNOSTICS_SERVER
35+
SoftwareDiagnostics::Events::SoftwareFault::Type softwareFault;
36+
37+
/* Unable to access thread ID in the application layer. */
38+
softwareFault.id = 0;
39+
40+
if (DeviceLayer::PlatformMgrImpl().IsCurrentTask())
41+
{
42+
softwareFault.name.SetValue("Matter"_span);
43+
}
44+
else if (DeviceLayer::ThreadStackMgrImpl().IsCurrentTask())
45+
{
46+
softwareFault.name.SetValue("Thread"_span);
47+
}
48+
else
49+
{
50+
softwareFault.name.SetValue("App"_span);
51+
}
52+
53+
softwareFault.faultRecording.SetValue(ByteSpan(Uint8::from_const_char(faultRecordString), strlen(faultRecordString)));
54+
55+
SoftwareDiagnosticsServer::Instance().OnSoftwareFaultDetect(softwareFault);
56+
#endif // MATTER_DM_PLUGIN_SOFTWARE_DIAGNOSTICS_SERVER
57+
}
58+
59+
} // namespace CYW30739
60+
} // namespace Infineon
61+
} // namespace DeviceLayer
62+
} // namespace chip
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
*
3+
* Copyright (c) 2024 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
namespace chip {
20+
namespace DeviceLayer {
21+
namespace Infineon {
22+
namespace CYW30739 {
23+
24+
void OnSoftwareFaultEventHandler(const char * faultRecordString);
25+
26+
} // namespace CYW30739
27+
} // namespace Infineon
28+
} // namespace DeviceLayer
29+
} // namespace chip

examples/platform/infineon/cyw30739/cyw30739_example.gni

+2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ template("cyw30739_example") {
2424

2525
static_library(target_name) {
2626
sources = [
27+
"${cyw30739_example_dir}/EventManagementTestEventTriggerHandler.cpp",
2728
"${cyw30739_example_dir}/LEDWidget.cpp",
2829
"${cyw30739_example_dir}/OTAConfig.cpp",
30+
"${cyw30739_example_dir}/SoftwareDiagnostics.cpp",
2931
"${cyw30739_example_dir}/matter_config.cpp",
3032
]
3133

examples/platform/infineon/cyw30739/matter_config.cpp

+25-5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "matter_config.h"
2121
#include "AppTask.h"
22+
#include "EventManagementTestEventTriggerHandler.h"
2223
#ifdef BOARD_ENABLE_DISPLAY
2324
#include "GUI.h"
2425
#endif
@@ -44,14 +45,21 @@
4445
#include <lib/support/CHIPPlatformMemory.h>
4546
#include <mbedtls/platform.h>
4647
#include <platform/DeviceInstanceInfoProvider.h>
47-
#include <platform/Infineon/CYW30739/FactoryDataProvider.h>
4848
#include <platform/KeyValueStoreManager.h>
4949
#include <protocols/secure_channel/PASESession.h>
50-
#ifdef BOARD_ENABLE_OPTIGA
51-
#include "wiced_optiga.h"
52-
#endif
5350
#include <wiced_rtos.h>
5451

52+
#ifdef BOARD_USE_OPTIGA
53+
#include "wiced_optiga.h"
54+
#ifdef USE_PROVISIONED_OPTIGA
55+
#include <platform/Infineon/CYW30739/OptigaFactoryDataProvider.h>
56+
#else /* !USE_PROVISIONED_OPTIGA */
57+
#include <platform/Infineon/CYW30739/UnprovisionedOptigaFactoryDataProvider.h>
58+
#endif /* USE_PROVISIONED_OPTIGA */
59+
#else /* !BOARD_USE_OPTIGA */
60+
#include <platform/Infineon/CYW30739/FactoryDataProvider.h>
61+
#endif /* BOARD_USE_OPTIGA */
62+
5563
using namespace ::chip;
5664
using namespace ::chip::Inet;
5765
using namespace ::chip::Credentials;
@@ -60,7 +68,15 @@ using namespace ::chip::Shell;
6068
using namespace ::chip::app;
6169

6270
static DeviceInfoProviderImpl sExampleDeviceInfoProvider;
71+
#ifdef BOARD_USE_OPTIGA
72+
#ifdef USE_PROVISIONED_OPTIGA
73+
static OptigaFactoryDataProvider sFactoryDataProvider;
74+
#else /* !USE_PROVISIONED_OPTIGA */
75+
static UnprovisionedOptigaFactoryDataProvider sFactoryDataProvider;
76+
#endif /* USE_PROVISIONED_OPTIGA */
77+
#else /* !BOARD_USE_OPTIGA */
6378
static FactoryDataProvider sFactoryDataProvider;
79+
#endif /* BOARD_USE_OPTIGA */
6480

6581
// NOTE! This key is for test/certification only and should not be available in production devices!
6682
uint8_t sTestEventTriggerEnableKey[chip::TestEventTriggerDelegate::kEnableKeyLength] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55,
@@ -135,7 +151,7 @@ void CYW30739MatterConfig::InitBoard(void)
135151
#ifdef BOARD_ENABLE_DISPLAY
136152
GUI_Init();
137153
#endif
138-
#ifdef BOARD_ENABLE_OPTIGA
154+
#ifdef BOARD_USE_OPTIGA
139155
wiced_optiga_init();
140156
#endif
141157
}
@@ -186,13 +202,17 @@ void CYW30739MatterConfig::InitApp(void)
186202
LogAppInit();
187203
ConfigurationMgr().LogDeviceConfig();
188204

205+
sFactoryDataProvider.Init();
206+
189207
// Print QR Code URL
190208
PrintOnboardingCodes(chip::RendezvousInformationFlag(chip::RendezvousInformationFlag::kBLE));
191209
/* Start CHIP datamodel server */
192210
static chip::SimpleTestEventTriggerDelegate sTestEventTriggerDelegate{};
193211
static chip::OTATestEventTriggerHandler sOtaTestEventTriggerHandler{};
212+
static Infineon::CYW30739::EventManagementTestEventTriggerHandler sEventManagementTestEventTriggerHandler{};
194213
VerifyOrDie(sTestEventTriggerDelegate.Init(chip::ByteSpan(sTestEventTriggerEnableKey)) == CHIP_NO_ERROR);
195214
VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sOtaTestEventTriggerHandler) == CHIP_NO_ERROR);
215+
VerifyOrDie(sTestEventTriggerDelegate.AddHandler(&sEventManagementTestEventTriggerHandler) == CHIP_NO_ERROR);
196216
// Create initParams with SDK example defaults here
197217
static chip::CommonCaseDeviceServerInitParams initParams;
198218
(void) initParams.InitializeStaticResourcesBeforeServerInit();

0 commit comments

Comments
 (0)