Skip to content

Commit 3158c7e

Browse files
Merge remote-tracking branch 'origin/release_2.5-1.4' into merge_2.5_to_2.6_20-03-25
2 parents e74907f + 4c36fe9 commit 3158c7e

17 files changed

+165
-119
lines changed

.github/workflows/examples-efr32.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
if: github.actor != 'restyled-io[bot]'
4242

4343
container:
44-
image: ghcr.io/project-chip/chip-build-efr32:95
44+
image: ghcr.io/project-chip/chip-build-efr32:115
4545
volumes:
4646
- "/tmp/bloat_reports:/tmp/bloat_reports"
4747
steps:

.github/workflows/silabs-common-build.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616

1717
container:
18-
image: ghcr.io/project-chip/chip-build-efr32:95
18+
image: ghcr.io/project-chip/chip-build-efr32:115
1919

2020
strategy:
2121
matrix:

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,17 @@
213213
[submodule "third_party/silabs/simplicity_sdk"]
214214
path = third_party/silabs/simplicity_sdk
215215
url = https://github.com/SiliconLabs/simplicity_sdk.git
216-
branch = v2024.6.2
216+
branch = v2024.12.1-0
217217
platforms = silabs
218218
[submodule "third_party/silabs/wiseconnect-wifi-bt-sdk"]
219219
path = third_party/silabs/wiseconnect-wifi-bt-sdk
220220
url = https://github.com/SiliconLabs/wiseconnect-wifi-bt-sdk.git
221-
branch = 2.10.3
221+
branch = 2.11.2
222222
platforms = silabs
223223
[submodule "third_party/silabs/wifi_sdk"]
224224
path = third_party/silabs/wifi_sdk
225225
url = https://github.com/SiliconLabs/wiseconnect.git
226-
branch = v3.3.3
226+
branch = v3.4.1
227227
platforms = silabs
228228
[submodule "editline"]
229229
path = third_party/editline/repo
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*****************************************************************************
2+
* @file sl-matter-attribute-storage.cpp
3+
* @brief Link zigbee datamodel attribute changes to Matter attribute storage.
4+
*******************************************************************************
5+
* # License
6+
* <b>Copyright 2024 Silicon Laboratories Inc.
7+
*www.silabs.com</b>
8+
*******************************************************************************
9+
*
10+
* The licensor of this software is Silicon
11+
*Laboratories Inc. Your use of this software is
12+
*governed by the terms of Silicon Labs Master
13+
*Software License Agreement (MSLA) available at
14+
* www.silabs.com/about-us/legal/master-software-license-agreement.
15+
*This software is distributed to you in Source Code
16+
*format and is governed by the sections of the MSLA
17+
*applicable to Source Code.
18+
*
19+
******************************************************************************/
20+
21+
#include <app/util/attribute-metadata.h>
22+
#include <app/util/attribute-table.h>
23+
#include <lib/support/TypeTraits.h>
24+
#include <lib/support/logging/CHIPLogging.h>
25+
#include <protocols/interaction_model/StatusCode.h>
26+
#include <sl-matter-attribute-storage.h>
27+
#include <sl_component_catalog.h>
28+
29+
namespace {
30+
// This is called from simplicity_sdk/protocol/zigbee/app/framework/util/attribute-storage.c on ZB attribute write
31+
// when GENERATED_MULTI_PROTOCOL_ATTRIBUTE_MAPPING and SL_CATALOG_MULTIPROTOCOL_ZIGBEE_MATTER_COMMON_PRESENT are defined.
32+
extern "C" sl_status_t sli_matter_af_write_attribute(uint16_t endpointId, uint32_t clusterId, uint32_t attributeId,
33+
uint8_t * attributeValue, uint8_t type)
34+
{
35+
// All type shall be directly applicable. We expect compilation error if type changes.
36+
chip::EndpointId matterEndpointId = endpointId;
37+
chip::ClusterId matterClusterId = clusterId;
38+
chip::AttributeId matterAttributeId = attributeId;
39+
EmberAfAttributeType matterDataType = type;
40+
41+
chip::Protocols::InteractionModel::Status imStatus =
42+
emberAfWriteAttribute(matterEndpointId, matterClusterId, matterAttributeId, attributeValue, matterDataType);
43+
44+
// For sl internal use so we return a known status type to our stack
45+
sl_status_t slStatus = SL_STATUS_OK;
46+
if (imStatus != chip::Protocols::InteractionModel::Status::Success)
47+
{
48+
ChipLogError(Zcl, "Failed to write Matter attribute from multiprotocol update. Err:0x%02x", chip::to_underlying(imStatus));
49+
slStatus = SL_STATUS_FAIL;
50+
}
51+
52+
return slStatus;
53+
}
54+
} // namespace
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*******************************************************************************
2+
* @file sl-matter-attribute-storage.h
3+
* @brief Link zigbee datamodel attribute changes to Matter attribute storage.
4+
*******************************************************************************
5+
* # License
6+
* <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
7+
*******************************************************************************
8+
*
9+
* The licensor of this software is Silicon Laboratories Inc. Your use of this
10+
* software is governed by the terms of Silicon Labs Master Software License
11+
* Agreement (MSLA) available at
12+
* www.silabs.com/about-us/legal/master-software-license-agreement. This
13+
* software is distributed to you in Source Code format and is governed by the
14+
* sections of the MSLA applicable to Source Code.
15+
*
16+
******************************************************************************/
17+
18+
#ifndef SL_MATTER_ATTRIBUTE_STORAGE
19+
#define SL_MATTER_ATTRIBUTE_STORAGE
20+
21+
#include <sl_status.h>
22+
#include <stdint.h>
23+
24+
#ifdef __cplusplus
25+
extern "C" {
26+
#endif
27+
28+
/**
29+
* @brief Writes an attribute value to the Matter attribute storage.
30+
*
31+
* *** This is a Silabs internal api. ***
32+
*
33+
* It exposes the Matter API that writes to the Matter attribute storage to our zigbee datamodel stack,
34+
* implemented in C, for multiprotocol usecases, without exposing matter datamodel elements
35+
*
36+
* This function expect that either the used Zigbee cluster/attributes maps 1 to 1 to the matter counter part
37+
* or that the caller translated the Zigbee attribute parameters to Matter attribute parameters.
38+
*
39+
* The function ultimaly uses those fields in the Matter API to perform the attribute write operation.
40+
*
41+
* @param endpointId Linked ZB/Matter endpoint identifier.
42+
* @param clusterId Linked ZB/Matter cluster identifier.
43+
* @param attributeId Linked ZB/Matter attribute identifier.
44+
* @param attributeValue Pointer to the attribute value to be written.
45+
* @param type The data type of the attribute. Shall match Matters' EmberAfAttributeType
46+
* @return sl_status_t Status of the write operation, SL_STATUS_OK if successful, otherwise SL_STATUS_FAIL.
47+
*/
48+
sl_status_t sli_matter_af_write_attribute(uint16_t endpointId, uint32_t clusterId, uint32_t attributeId, uint8_t * attributeValue,
49+
uint8_t type);
50+
51+
#ifdef __cplusplus
52+
}
53+
#endif
54+
55+
#endif // SL_MATTER_ATTRIBUTE_STORAGE

examples/platform/silabs/matter-platform.slcp

+2
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ configuration:
113113
- {name: SL_BT_RTOS_LINK_LAYER_TASK_STACK_SIZE, value: 1024}
114114
- {name: SL_BT_RTOS_HOST_STACK_TASK_STACK_SIZE, value: 2048}
115115
- {name: SL_BT_RTOS_EVENT_HANDLER_STACK_SIZE, value: 1536}
116+
- {name: SL_MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS, value: 1}
117+
- {name: SL_OPENTHREAD_ENABLE_SERIAL_TASK, value: 0}
116118

117119
template_contribution:
118120
- name: mbedtls_ssl_content_len_in_requirement

examples/platform/silabs/provision/ProvisionStorageFlash.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
#include <platform/silabs/multi-ota/OtaTlvEncryptionKey.h>
3030
#endif // OTA_ENCRYPTION_ENABLE
3131

32+
#if !SL_MATTER_GN_BUILD
33+
#include <sl_matter_provision_config.h>
34+
#endif
35+
3236
using namespace chip::Credentials;
3337

3438
#if SLI_SI91X_MCU_INTERFACE

src/platform/silabs/wifi/BUILD.gn

+1-3
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ source_set("wifi-platform") {
139139
"${silabs_platform_dir}/wifi/SiWx/WifiInterface.cpp",
140140
"${silabs_platform_dir}/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.cpp",
141141
"${silabs_platform_dir}/wifi/wiseconnect-abstraction/WiseconnectInterfaceAbstraction.h",
142-
143-
# Wi-Fi Config - Using the file sdk support until the wiseconnect file is fixed
144-
"${matter_support_root}/sdk-copies/components/service/network_manager/src/sl_net_for_lwip.c",
142+
"${wifi_sdk_root}/components/service/network_manager/src/sl_net_for_lwip.c",
145143
]
146144

147145
public_deps += [ "${lwip_root}:lwip" ]

src/platform/silabs/wifi/SiWx/WifiInterface.cpp

+25-92
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,11 @@ bool ps_requirement_added = false;
100100
#endif // CHIP_CONFIG_ENABLE_ICD_SERVER
101101

102102
bool hasNotifiedWifiConnectivity = false;
103-
bool hasNotifiedIPV6 = false;
104-
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
105-
bool hasNotifiedIPV4 = false;
106-
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
107103

108104
wfx_wifi_scan_ext_t temp_reset;
109105

110106
osSemaphoreId_t sScanCompleteSemaphore;
111107
osSemaphoreId_t sScanInProgressSemaphore;
112-
osTimerId_t sDHCPTimer;
113108
osMessageQueueId_t sWifiEventQueue = nullptr;
114109

115110
sl_net_wifi_lwip_context_t wifi_client_context;
@@ -134,7 +129,8 @@ const sl_wifi_device_configuration_t config = {
134129
#ifdef SLI_SI91X_MCU_INTERFACE
135130
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_WPS_DISABLE),
136131
#else
137-
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION),
132+
(SL_SI91X_FEAT_SECURITY_OPEN | SL_SI91X_FEAT_AGGREGATION | SL_SI91X_FEAT_ULP_GPIO_BASED_HANDSHAKE |
133+
SL_SI91X_FEAT_DEV_TO_HOST_ULP_GPIO_1),
138134
#endif
139135
.tcp_ip_feature_bit_map = (SL_SI91X_TCP_IP_FEAT_DHCPV4_CLIENT | SL_SI91X_TCP_IP_FEAT_DNS_CLIENT |
140136
SL_SI91X_TCP_IP_FEAT_SSL | SL_SI91X_TCP_IP_FEAT_BYPASS
@@ -207,27 +203,6 @@ constexpr uint8_t kWfxQueueSize = 10;
207203
// TODO: Figure out why we actually need this, we are already handling failure and retries somewhere else.
208204
constexpr uint16_t kWifiScanTimeoutTicks = 10000;
209205

210-
void DHCPTimerEventHandler(void * arg)
211-
{
212-
WifiEvent event = WifiEvent::kStationDhcpPoll;
213-
sl_matter_wifi_post_event(event);
214-
}
215-
216-
void CancelDHCPTimer(void)
217-
{
218-
VerifyOrReturn(osTimerIsRunning(sDHCPTimer), ChipLogDetail(DeviceLayer, "CancelDHCPTimer: timer not running"));
219-
VerifyOrReturn(osTimerStop(sDHCPTimer) == osOK, ChipLogError(DeviceLayer, "CancelDHCPTimer: failed to stop timer"));
220-
}
221-
222-
void StartDHCPTimer(uint32_t timeout)
223-
{
224-
// Cancel timer if already started
225-
CancelDHCPTimer();
226-
227-
VerifyOrReturn(osTimerStart(sDHCPTimer, pdMS_TO_TICKS(timeout)) == osOK,
228-
ChipLogError(DeviceLayer, "StartDHCPTimer: failed to start timer"));
229-
}
230-
231206
sl_status_t sl_wifi_siwx917_init(void)
232207
{
233208
sl_status_t status = SL_STATUS_OK;
@@ -356,7 +331,10 @@ sl_status_t SetWifiConfigurations()
356331
VerifyOrReturnError(status == SL_STATUS_OK, status,
357332
ChipLogError(DeviceLayer, "sl_wifi_set_listen_interval failed: 0x%lx", status));
358333

359-
sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 5 };
334+
// This is be triggered on the disconnect use case, providing the amount of TA tries
335+
// Setting the TA retry to 1 and giving the control to the M4 for improved power efficiency
336+
// When max_retry_attempts is set to 0, TA will retry indefinitely.
337+
sl_wifi_advanced_client_configuration_t client_config = { .max_retry_attempts = 1 };
360338
status = sl_wifi_set_advanced_client_configuration(SL_WIFI_CLIENT_INTERFACE, &client_config);
361339
VerifyOrReturnError(status == SL_STATUS_OK, status,
362340
ChipLogError(DeviceLayer, "sl_wifi_set_advanced_client_configuration failed: 0x%lx", status));
@@ -513,11 +491,6 @@ sl_status_t sl_matter_wifi_platform_init(void)
513491
sWifiEventQueue = osMessageQueueNew(kWfxQueueSize, sizeof(WifiEvent), nullptr);
514492
VerifyOrReturnError(sWifiEventQueue != nullptr, SL_STATUS_ALLOCATION_FAILED);
515493

516-
// Create timer for DHCP polling
517-
// TODO: Use LWIP timer instead of creating a new one here
518-
sDHCPTimer = osTimerNew(DHCPTimerEventHandler, osTimerPeriodic, nullptr, nullptr);
519-
VerifyOrReturnError(sDHCPTimer != nullptr, SL_STATUS_ALLOCATION_FAILED);
520-
521494
return status;
522495
}
523496

@@ -661,53 +634,29 @@ sl_status_t bg_scan_callback_handler(sl_wifi_event_t event, sl_wifi_scan_result_
661634

662635
/// NotifyConnectivity
663636
/// @brief Notify the application about the connectivity status if it has not been notified yet.
664-
/// Helper function for HandleDHCPPolling.
665637
void NotifyConnectivity(void)
666638
{
667639
VerifyOrReturn(!hasNotifiedWifiConnectivity);
668640
wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac);
669641
hasNotifiedWifiConnectivity = true;
670642
}
671643

672-
void HandleDHCPPolling(void)
644+
/// NotifySuccessfulConnection
645+
/// @brief Processing function responsible for notifying the upper layers of a succesful connection attempt.
646+
void NotifySuccessfulConnection(void)
673647
{
674-
WifiEvent event;
675-
676-
// TODO: Notify the application that the interface is not set up or Chipdie here because we are in an unkonwn state
677648
struct netif * sta_netif = &wifi_client_context.netif;
678649
VerifyOrReturn(sta_netif != nullptr, ChipLogError(DeviceLayer, "HandleDHCPPolling: failed to get STA netif"));
679-
680650
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
681-
uint8_t dhcp_state = dhcpclient_poll(sta_netif);
682-
if (dhcp_state == DHCP_ADDRESS_ASSIGNED && !hasNotifiedIPV4)
683-
{
684-
wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr);
685-
hasNotifiedIPV4 = true;
686-
event = WifiEvent::kStationDhcpDone;
687-
sl_matter_wifi_post_event(event);
688-
NotifyConnectivity();
689-
}
690-
else if (dhcp_state == DHCP_OFF)
691-
{
692-
wfx_ip_changed_notify(IP_STATUS_FAIL);
693-
hasNotifiedIPV4 = false;
694-
}
651+
wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr);
695652
#endif /* CHIP_DEVICE_CONFIG_ENABLE_IPV4 */
696-
/* Checks if the assigned IPv6 address is preferred by evaluating
697-
* the first block of IPv6 address ( block 0)
698-
*/
699-
if ((ip6_addr_ispreferred(netif_ip6_addr_state(sta_netif, 0))) && !hasNotifiedIPV6)
700-
{
701-
char addrStr[chip::Inet::IPAddress::kMaxStringLength] = { 0 };
702-
VerifyOrReturn(ip6addr_ntoa_r(netif_ip6_addr(sta_netif, 0), addrStr, sizeof(addrStr)) != nullptr);
703-
ChipLogProgress(DeviceLayer, "SLAAC OK: linklocal addr: %s", addrStr);
704-
wfx_ipv6_notify(GET_IPV6_SUCCESS);
705-
hasNotifiedIPV6 = true;
706-
event = WifiEvent::kStationDhcpDone;
707-
sl_matter_wifi_post_event(event);
708-
NotifyConnectivity();
709-
}
653+
char addrStr[chip::Inet::IPAddress::kMaxStringLength] = { 0 };
654+
VerifyOrReturn(ip6addr_ntoa_r(netif_ip6_addr(sta_netif, 0), addrStr, sizeof(addrStr)) != nullptr);
655+
ChipLogProgress(DeviceLayer, "SLAAC OK: linklocal addr: %s", addrStr);
656+
wfx_ipv6_notify(GET_IPV6_SUCCESS);
657+
NotifyConnectivity();
710658
}
659+
711660
void sl_matter_wifi_post_event(WifiEvent event)
712661
{
713662
sl_status_t status = osMessageQueuePut(sWifiEventQueue, &event, 0, 0);
@@ -719,19 +668,14 @@ void sl_matter_wifi_post_event(WifiEvent event)
719668
// Chipdie, etc.
720669
}
721670
}
722-
/// ResetDHCPNotificationFlags
671+
/// ResetConnectivityNotificationFlags
723672
/// @brief Reset the flags that are used to notify the application about DHCP connectivity
724-
/// and emits a WifiEvent::kStationDoDhcp event to trigger DHCP polling checks. Helper function for ProcessEvent.
725-
void ResetDHCPNotificationFlags(void)
673+
/// and emits a WifiEvent::kConnectionComplete event to trigger DHCP polling checks. Helper function for ProcessEvent.
674+
void ResetConnectivityNotificationFlags(void)
726675
{
727-
728-
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
729-
hasNotifiedIPV4 = false;
730-
#endif // CHIP_DEVICE_CONFIG_ENABLE_IPV4
731-
hasNotifiedIPV6 = false;
732676
hasNotifiedWifiConnectivity = false;
733677

734-
WifiEvent event = WifiEvent::kStationDoDhcp;
678+
WifiEvent event = WifiEvent::kConnectionComplete;
735679
sl_matter_wifi_post_event(event);
736680
}
737681

@@ -743,7 +687,7 @@ void ProcessEvent(WifiEvent event)
743687
case WifiEvent::kStationConnect:
744688
ChipLogDetail(DeviceLayer, "WifiEvent::kStationConnect");
745689
wfx_rsi.dev_state.Set(WifiState::kStationConnected);
746-
ResetDHCPNotificationFlags();
690+
ResetConnectivityNotificationFlags();
747691
break;
748692

749693
case WifiEvent::kStationDisconnect: {
@@ -756,7 +700,7 @@ void ProcessEvent(WifiEvent event)
756700
.Clear(WifiState::kStationDhcpDone);
757701

758702
/* TODO: Implement disconnect notify */
759-
ResetDHCPNotificationFlags();
703+
ResetConnectivityNotificationFlags();
760704
#if (CHIP_DEVICE_CONFIG_ENABLE_IPV4)
761705
wfx_ip_changed_notify(0); // for IPV4
762706
wfx_ip_changed_notify(IP_STATUS_FAIL);
@@ -833,20 +777,9 @@ void ProcessEvent(WifiEvent event)
833777
JoinWifiNetwork();
834778
break;
835779

836-
case WifiEvent::kStationDoDhcp:
837-
ChipLogDetail(DeviceLayer, "WifiEvent::kStationDoDhcp");
838-
StartDHCPTimer(WFX_RSI_DHCP_POLL_INTERVAL);
839-
break;
840-
841-
case WifiEvent::kStationDhcpDone:
842-
ChipLogDetail(DeviceLayer, "WifiEvent::kStationDhcpDone");
843-
CancelDHCPTimer();
844-
break;
845-
846-
case WifiEvent::kStationDhcpPoll:
847-
ChipLogDetail(DeviceLayer, "WifiEvent::kStationDhcpPoll");
848-
HandleDHCPPolling();
849-
break;
780+
case WifiEvent::kConnectionComplete:
781+
ChipLogDetail(DeviceLayer, "WifiPlatformEvent::kConnectionComplete");
782+
NotifySuccessfulConnection();
850783

851784
default:
852785
break;

0 commit comments

Comments
 (0)