Skip to content

Commit 0b0e7a7

Browse files
Merge branch 'master' into bugfix/fixing-arm64-build-failure-in-linux-platform
2 parents 5552b86 + 931e280 commit 0b0e7a7

36 files changed

+485
-450
lines changed

config/nxp/lib/pw_rpc/BUILD.gn

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ static_library("pw_rpc") {
2424
"$dir_pw_rpc:server",
2525
"$dir_pw_rpc/nanopb:echo_service",
2626
"${chip_root}/examples/platform/nxp/pw_sys_io:pw_sys_io_nxp",
27-
"${dir_pigweed}/pw_hdlc:pw_rpc",
2827
dir_pw_assert,
2928
dir_pw_hdlc,
3029
dir_pw_log,

config/zephyr/chip-module/Kconfig.defaults

+3-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ config LOG_DEFAULT_LEVEL
4040

4141
endif
4242

43+
# disable synchronous printk to avoid blocking IRQs which
44+
# may affect time sensitive components
4345
config PRINTK_SYNC
4446
bool
45-
default y
47+
default n
4648

4749
config ASSERT
4850
bool

docs/guides/BUILDING.md

+42-1
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,52 @@ The Matter build system has the following features:
2525

2626
## Checking out the Matter code
2727

28-
To check out the Matter repository, run the following command:
28+
To check out the Matter code, there are two options: one is to check out all
29+
platforms together, which is recommended; the other is to check out with support
30+
for specific platforms, which can obviously reduce the project size.
31+
32+
### Checking out All Platforms
33+
34+
To check out the Matter repository with all platforms, run the following
35+
command:
2936

3037
```
3138
git clone --recurse-submodules [email protected]:project-chip/connectedhomeip.git
39+
40+
```
41+
42+
### Specific platforms Checking out
43+
44+
- first step, checking out matter top level repo with command below:
45+
3246
```
47+
git clone --depth=1 [email protected]:project-chip/connectedhomeip.git
48+
49+
```
50+
51+
- Second step, check out third-party platform support repos as follows:
52+
53+
```
54+
python3 scripts/checkout_submodules.py --shallow --platform platform1,platform2...
55+
56+
```
57+
58+
For Linux host example:
59+
60+
```
61+
./scripts/checkout_submodules.py --shallow --platform linux
62+
63+
```
64+
65+
For Darwin host example:
66+
67+
```
68+
./scripts/checkout_submodules.py --shallow --platform darwin
69+
70+
```
71+
72+
Please note that in the above commands, you should replace platform1,platform2
73+
with the specific platform names you wish to check out.
3374

3475
## Updating Matter code
3576

docs/guides/silabs_cli_guide.md

-2
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,6 @@ OTA commands
197197
```bash
198198
matterCli> ota
199199
query Query for a new image. Usage: ota query
200-
apply Apply the current update. Usage: ota apply
201-
notify Notify the new image has been applied. Usage: ota notify <version>
202200
state Gets state of a current image update process. Usage: ota state
203201
progress Gets progress of a current image update process. Usage: ota progress
204202
```

examples/darwin-framework-tool/commands/interactive/InteractiveCommands.mm

+16-1
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@
2323
#include <platform/logging/LogV.h>
2424

2525
#include <editline.h>
26+
#include <stdlib.h>
2627

27-
constexpr char kInteractiveModePrompt[] = "Stop and restart stack: [Ctrl+_] & [Ctrl+^] \nQuit Interactive: 'quit()'\n>>> ";
28+
constexpr char kInteractiveModePrompt[] = "Stop and restart stack: [Ctrl+_] & [Ctrl+^]\n"
29+
"Trigger exit(0): [Ctrl+@]\n"
30+
"Quit Interactive: 'quit()'\n"
31+
">>> ";
2832
constexpr char kInteractiveModeHistoryFilePath[] = "/tmp/darwin_framework_tool_history";
2933
constexpr char kInteractiveModeStopCommand[] = "quit()";
3034
constexpr char kCategoryError[] = "Error";
@@ -296,6 +300,12 @@ el_status_t StopFunction()
296300
return CSstay;
297301
}
298302

303+
el_status_t ExitFunction()
304+
{
305+
exit(0);
306+
return CSstay;
307+
}
308+
299309
CHIP_ERROR InteractiveStartCommand::RunCommand()
300310
{
301311
read_history(kInteractiveModeHistoryFilePath);
@@ -304,8 +314,13 @@ el_status_t StopFunction()
304314
// is dumped to stdout while the user is typing a command.
305315
chip::Logging::SetLogRedirectCallback(LoggingCallback);
306316

317+
// The valid keys to bind are listed at
318+
// https://github.com/troglobit/editline/blob/425584840c09f83bb8fedbf76b599d3a917621ba/src/editline.c#L1941
319+
// but note that some bindings (like Ctrl+Q) might be captured by terminals
320+
// and not make their way to this code.
307321
el_bind_key(CTL('^'), RestartFunction);
308322
el_bind_key(CTL('_'), StopFunction);
323+
el_bind_key(CTL('@'), ExitFunction);
309324

310325
char * command = nullptr;
311326
int status;

examples/platform/nxp/Rpc.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ class NxpButton final : public Button
6666
class NxpDevice final : public Device
6767
{
6868
public:
69-
pw::Status Reboot(const pw_protobuf_Empty & request, pw_protobuf_Empty & response) override
69+
pw::Status Reboot(const chip_rpc_RebootRequest & request, pw_protobuf_Empty & response) override
7070
{
7171
mRebootTimer = xTimerCreate("Reboot", kRebootTimerPeriodTicks, false, nullptr, RebootHandler);
7272
xTimerStart(mRebootTimer, pdMS_TO_TICKS(0));

examples/platform/nxp/pw_sys_io/BUILD.gn

+2-5
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,12 @@ config("default_config") {
2727
}
2828

2929
pw_source_set("pw_sys_io_nxp") {
30-
sources = [
31-
"${chip_root}/src/lib/shell/streamer_nxp.cpp",
32-
"sys_io_nxp.cc",
33-
]
30+
sources = [ "sys_io_nxp.cc" ]
3431

3532
deps = [
3633
"$dir_pw_sys_io:default_putget_bytes",
3734
"$dir_pw_sys_io:facade",
38-
"${nxp_sdk_build_root}/${nxp_sdk_name}:nxp_sdk",
35+
"${chip_root}/src/lib/shell:shell",
3936
]
4037

4138
public_configs = [ ":default_config" ]

examples/window-app/silabs/src/AppTask.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
#include "WindowManager.h"
2525

26-
#include <app/clusters/on-off-server/on-off-server.h>
2726
#include <app/server/OnboardingCodesUtil.h>
2827
#include <app/server/Server.h>
2928
#include <app/util/attribute-storage.h>

src/app/BUILD.gn

+1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ buildconfig_header("app_buildconfig") {
7777
"TIME_SYNC_ENABLE_TSC_FEATURE=${time_sync_enable_tsc_feature}",
7878
"NON_SPEC_COMPLIANT_OTA_ACTION_DELAY_FLOOR=${non_spec_compliant_ota_action_delay_floor}",
7979
"CHIP_DEVICE_CONFIG_DYNAMIC_SERVER=${chip_build_controller_dynamic_server}",
80+
"CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP=${chip_enable_busy_handling_for_operational_session_setup}",
8081
]
8182

8283
visibility = [ ":app_config" ]

src/app/OperationalSessionSetup.cpp

+17-4
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,12 @@ void OperationalSessionSetup::DequeueConnectionCallbacks(CHIP_ERROR error, Sessi
351351
auto * exchangeMgr = mInitParams.exchangeMgr;
352352
Optional<SessionHandle> optionalSessionHandle = mSecureSession.Get();
353353
ScopedNodeId peerId = mPeerId;
354+
System::Clock::Milliseconds16 requestedBusyDelay =
355+
#if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
356+
mRequestedBusyDelay;
357+
#else
358+
System::Clock::kZero;
359+
#endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
354360

355361
if (releaseBehavior == ReleaseBehavior::Release)
356362
{
@@ -361,14 +367,15 @@ void OperationalSessionSetup::DequeueConnectionCallbacks(CHIP_ERROR error, Sessi
361367
// DO NOT touch any members of this object after this point. It's dead.
362368

363369
NotifyConnectionCallbacks(failureReady, setupFailureReady, successReady, error, stage, peerId, performingAddressUpdate,
364-
exchangeMgr, optionalSessionHandle);
370+
exchangeMgr, optionalSessionHandle, requestedBusyDelay);
365371
}
366372

367373
void OperationalSessionSetup::NotifyConnectionCallbacks(Cancelable & failureReady, Cancelable & setupFailureReady,
368374
Cancelable & successReady, CHIP_ERROR error,
369375
SessionEstablishmentStage stage, const ScopedNodeId & peerId,
370376
bool performingAddressUpdate, Messaging::ExchangeManager * exchangeMgr,
371-
const Optional<SessionHandle> & optionalSessionHandle)
377+
const Optional<SessionHandle> & optionalSessionHandle,
378+
System::Clock::Milliseconds16 requestedBusyDelay)
372379
{
373380
//
374381
// If we encountered no error, go ahead and call all success callbacks. Otherwise,
@@ -401,6 +408,12 @@ void OperationalSessionSetup::NotifyConnectionCallbacks(Cancelable & failureRead
401408
{
402409
// Initialize the ConnnectionFailureInfo object
403410
ConnnectionFailureInfo failureInfo(peerId, error, stage);
411+
#if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
412+
if (error == CHIP_ERROR_BUSY)
413+
{
414+
failureInfo.requestedBusyDelay.Emplace(requestedBusyDelay);
415+
}
416+
#endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
404417
cb->mCall(cb->mContext, failureInfo);
405418
}
406419
}
@@ -482,9 +495,9 @@ void OperationalSessionSetup::OnSessionEstablishmentError(CHIP_ERROR error, Sess
482495

483496
void OperationalSessionSetup::OnResponderBusy(System::Clock::Milliseconds16 requestedDelay)
484497
{
485-
#if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
498+
#if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES || CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
486499
// Store the requested delay, so that we can use it for scheduling our
487-
// retry.
500+
// retry or communicate it to our API consumer.
488501
mRequestedBusyDelay = requestedDelay;
489502
#endif
490503
}

src/app/OperationalSessionSetup.h

+18-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#pragma once
2828

29+
#include <app/AppConfig.h>
2930
#include <app/CASEClient.h>
3031
#include <app/CASEClientPool.h>
3132
#include <app/DeviceProxy.h>
@@ -161,6 +162,13 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate,
161162
CHIP_ERROR error;
162163
SessionEstablishmentStage sessionStage;
163164

165+
// When the response was BUSY, error will be CHIP_ERROR_BUSY and
166+
// requestedBusyDelay will be set, if handling of BUSY responses is
167+
// enabled.
168+
#if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
169+
Optional<System::Clock::Milliseconds16> requestedBusyDelay;
170+
#endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
171+
164172
ConnnectionFailureInfo(const ScopedNodeId & peer, CHIP_ERROR err, SessionEstablishmentStage stage) :
165173
peerId(peer), error(err), sessionStage(stage)
166174
{}
@@ -306,6 +314,10 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate,
306314

307315
bool mPerformingAddressUpdate = false;
308316

317+
#if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES || CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
318+
System::Clock::Milliseconds16 mRequestedBusyDelay = System::Clock::kZero;
319+
#endif // CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES || CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
320+
309321
#if CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
310322
// When we TryNextResult on the resolver, it will synchronously call back
311323
// into our OnNodeAddressResolved when it succeeds. We need to track
@@ -320,8 +332,6 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate,
320332

321333
uint8_t mResolveAttemptsAllowed = 0;
322334

323-
System::Clock::Milliseconds16 mRequestedBusyDelay = System::Clock::kZero;
324-
325335
Callback::CallbackDeque mConnectionRetry;
326336
#endif // CHIP_DEVICE_CONFIG_ENABLE_AUTOMATIC_CASE_RETRIES
327337

@@ -385,7 +395,12 @@ class DLL_EXPORT OperationalSessionSetup : public SessionEstablishmentDelegate,
385395
Callback::Cancelable & successReady, CHIP_ERROR error, SessionEstablishmentStage stage,
386396
const ScopedNodeId & peerId, bool performingAddressUpdate,
387397
Messaging::ExchangeManager * exchangeMgr,
388-
const Optional<SessionHandle> & optionalSessionHandle);
398+
const Optional<SessionHandle> & optionalSessionHandle,
399+
// requestedBusyDelay will be 0 if not
400+
// CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP,
401+
// and only has a meaningful value
402+
// when the error is CHIP_ERROR_BUSY.
403+
System::Clock::Milliseconds16 requestedBusyDelay);
389404

390405
/**
391406
* Triggers a DNSSD lookup to find a usable peer address.

src/app/ReadClient.cpp

+26-3
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ uint32_t ReadClient::ComputeTimeTillNextSubscription()
135135
waitTimeInMsec = minWaitTimeInMsec + (Crypto::GetRandU32() % (maxWaitTimeInMsec - minWaitTimeInMsec));
136136
}
137137

138+
if (mMinimalResubscribeDelay.count() > waitTimeInMsec)
139+
{
140+
waitTimeInMsec = mMinimalResubscribeDelay.count();
141+
}
142+
138143
return waitTimeInMsec;
139144
}
140145

@@ -1058,6 +1063,10 @@ CHIP_ERROR ReadClient::ProcessSubscribeResponse(System::PacketBufferHandle && aP
10581063

10591064
CHIP_ERROR ReadClient::SendAutoResubscribeRequest(ReadPrepareParams && aReadPrepareParams)
10601065
{
1066+
// Make sure we don't use minimal resubscribe delays from previous attempts
1067+
// for this one.
1068+
mMinimalResubscribeDelay = System::Clock::kZero;
1069+
10611070
mReadPrepareParams = std::move(aReadPrepareParams);
10621071
CHIP_ERROR err = SendSubscribeRequest(mReadPrepareParams);
10631072
if (err != CHIP_NO_ERROR)
@@ -1239,14 +1248,28 @@ void ReadClient::HandleDeviceConnected(void * context, Messaging::ExchangeManage
12391248
}
12401249
}
12411250

1242-
void ReadClient::HandleDeviceConnectionFailure(void * context, const ScopedNodeId & peerId, CHIP_ERROR err)
1251+
void ReadClient::HandleDeviceConnectionFailure(void * context, const OperationalSessionSetup::ConnnectionFailureInfo & failureInfo)
12431252
{
12441253
ReadClient * const _this = static_cast<ReadClient *>(context);
12451254
VerifyOrDie(_this != nullptr);
12461255

1247-
ChipLogError(DataManagement, "Failed to establish CASE for re-subscription with error '%" CHIP_ERROR_FORMAT "'", err.Format());
1256+
ChipLogError(DataManagement, "Failed to establish CASE for re-subscription with error '%" CHIP_ERROR_FORMAT "'",
1257+
failureInfo.error.Format());
1258+
1259+
#if CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
1260+
#if CHIP_DETAIL_LOGGING
1261+
if (failureInfo.requestedBusyDelay.HasValue())
1262+
{
1263+
ChipLogDetail(DataManagement, "Will delay resubscription by %u ms due to BUSY response",
1264+
failureInfo.requestedBusyDelay.Value().count());
1265+
}
1266+
#endif // CHIP_DETAIL_LOGGING
1267+
_this->mMinimalResubscribeDelay = failureInfo.requestedBusyDelay.ValueOr(System::Clock::kZero);
1268+
#else
1269+
_this->mMinimalResubscribeDelay = System::Clock::kZero;
1270+
#endif // CHIP_CONFIG_ENABLE_BUSY_HANDLING_FOR_OPERATIONAL_SESSION_SETUP
12481271

1249-
_this->Close(err);
1272+
_this->Close(failureInfo.error);
12501273
}
12511274

12521275
void ReadClient::OnResubscribeTimerCallback(System::Layer * /* If this starts being used, fix callers that pass nullptr */,

src/app/ReadClient.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ class ReadClient : public Messaging::ExchangeDelegate
612612

613613
static void HandleDeviceConnected(void * context, Messaging::ExchangeManager & exchangeMgr,
614614
const SessionHandle & sessionHandle);
615-
static void HandleDeviceConnectionFailure(void * context, const ScopedNodeId & peerId, CHIP_ERROR error);
615+
static void HandleDeviceConnectionFailure(void * context, const OperationalSessionSetup::ConnnectionFailureInfo & failureInfo);
616616

617617
CHIP_ERROR GetMinEventNumber(const ReadPrepareParams & aReadPrepareParams, Optional<EventNumber> & aEventMin);
618618

@@ -642,8 +642,12 @@ class ReadClient : public Messaging::ExchangeDelegate
642642
bool mForceCaseOnNextResub = true;
643643
bool mIsResubscriptionScheduled = false;
644644

645+
// mMinimalResubscribeDelay is used to store the delay returned with a BUSY
646+
// response to a Sigma1 message.
647+
System::Clock::Milliseconds16 mMinimalResubscribeDelay = System::Clock::kZero;
648+
645649
chip::Callback::Callback<OnDeviceConnected> mOnConnectedCallback;
646-
chip::Callback::Callback<OnDeviceConnectionFailure> mOnConnectionFailureCallback;
650+
chip::Callback::Callback<OperationalSessionSetup::OnSetupFailure> mOnConnectionFailureCallback;
647651

648652
ReadClient * mpNext = nullptr;
649653
InteractionModelEngine * mpImEngine = nullptr;

src/app/common_flags.gni

+4
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,8 @@ declare_args() {
1717
chip_app_use_echo = false
1818
chip_enable_read_client = true
1919
chip_build_controller_dynamic_server = false
20+
21+
# Flag that controls whether the time-to-wait from BUSY responses is
22+
# communicated to OperationalSessionSetup API consumers.
23+
chip_enable_busy_handling_for_operational_session_setup = true
2024
}

src/inet/UDPEndPointImplSockets.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,7 @@ CHIP_ERROR IPv4Bind(int socket, const IPAddress & address, uint16_t port)
170170
} // anonymous namespace
171171

172172
#if CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API
173-
UDPEndPointImplSockets::MulticastGroupHandler UDPEndPointImplSockets::sJoinMulticastGroupHandler;
174-
UDPEndPointImplSockets::MulticastGroupHandler UDPEndPointImplSockets::sLeaveMulticastGroupHandler;
173+
UDPEndPointImplSockets::MulticastGroupHandler UDPEndPointImplSockets::sMulticastGroupHandler;
175174
#endif // CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API
176175

177176
CHIP_ERROR UDPEndPointImplSockets::BindImpl(IPAddressType addressType, const IPAddress & addr, uint16_t port, InterfaceId interface)
@@ -801,10 +800,9 @@ CHIP_ERROR UDPEndPointImplSockets::IPv4JoinLeaveMulticastGroupImpl(InterfaceId a
801800
CHIP_ERROR UDPEndPointImplSockets::IPv6JoinLeaveMulticastGroupImpl(InterfaceId aInterfaceId, const IPAddress & aAddress, bool join)
802801
{
803802
#if CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API
804-
MulticastGroupHandler handler = join ? sJoinMulticastGroupHandler : sLeaveMulticastGroupHandler;
805-
if (handler != nullptr)
803+
if (sMulticastGroupHandler != nullptr)
806804
{
807-
return handler(aInterfaceId, aAddress);
805+
return sMulticastGroupHandler(aInterfaceId, aAddress, MulticastOperation::kJoin);
808806
}
809807
#endif // CHIP_SYSTEM_CONFIG_USE_PLATFORM_MULTICAST_API
810808

0 commit comments

Comments
 (0)