Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into fan-control-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mhazley committed Apr 28, 2023
2 parents 18941d7 + 6ec5f81 commit 18d2634
Show file tree
Hide file tree
Showing 35 changed files with 608 additions and 264 deletions.
1 change: 0 additions & 1 deletion docs/ERROR_CODES.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ This file was **AUTOMATICALLY** generated by
| 2 | 0x02 | `CHIP_ERROR_CONNECTION_ABORTED` |
| 3 | 0x03 | `CHIP_ERROR_INCORRECT_STATE` |
| 4 | 0x04 | `CHIP_ERROR_MESSAGE_TOO_LONG` |
| 5 | 0x05 | `CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION` |
| 6 | 0x06 | `CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS` |
| 7 | 0x07 | `CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER` |
| 8 | 0x08 | `CHIP_ERROR_NO_CONNECTION_HANDLER` |
Expand Down
5 changes: 5 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"examples/thermostat/nxp/linux-se05x/README.md",
"examples/common/m5stack-tft/repo",
"docs/guides/README.md",
"scripts/tools/memory/memdf/README.md",
"scripts/tools/memory/platform/README.md",
"scripts/tools/memory/README-GitHub-CI.md",
]


Expand Down Expand Up @@ -69,6 +72,8 @@
(MATTER_BASE, "examples/**/*.png"),
(MATTER_BASE, "examples/**/*.jpg"),
(MATTER_BASE, "examples/**/*.JPG"),
(MATTER_BASE, "src/tools/**/*.md"),
(MATTER_BASE, "scripts/tools/**/*.md"),
]
external_content_link_prefixes = [
"src/",
Expand Down
1 change: 1 addition & 0 deletions docs/guides/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ esp32/README
- [nRF Connect - Software Update](./nrfconnect_examples_software_update.md)
- [NXP - Android Commissioning](./nxp_k32w_android_commissioning.md)
- [NXP - Linux Examples](./nxp_imx8m_linux_examples.md)
- [NXP - Manufacturing Data](./nxp_manufacturing_flow.md)
- [Silicon Labs - Documentation](https://github.com/SiliconLabs/matter#readme)
- [Silicon Labs - Building](./silabs_efr32_building.md)
- [Silicon Labs - Software Update](./silabs_efr32_software_update.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
orphan: true
---

## Manufacturing data
# NXP manufacturing data guide

By default, the example application is configured to use generic test
certificates and provisioning data embedded with the application code. It is
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ discussion/index
guides/index
style/index
examples/index
tools/index
BUG_REPORT
code_generation
ERROR_CODES
Expand Down
63 changes: 63 additions & 0 deletions docs/tools/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Tools

The Matter SDK provides tools that allow you to generate and manage different
aspects of the Matter development.

## C++ tools

Source files for these tools are located at `src/tools`.

```{toctree}
:glob:
:maxdepth: 1
../src/tools/chip-cert/README
../src/tools/spake2p/README
```

## Python tools

Source files for these tools are located at `scripts/tools`.

### General tools

```{toctree}
:glob:
:maxdepth: 1
../scripts/tools/memory/README
../scripts/tools/spake2p/README
```

### NXP tools

```{toctree}
:glob:
:maxdepth: 1
../scripts/tools/nxp/factory_data_generator/README
../scripts/tools/nxp/ota/README
```

### Silabs tools

```{toctree}
:glob:
:maxdepth: 1
../scripts/tools/silabs/README
```

### Telink tools

```{toctree}
:glob:
:maxdepth: 1
../scripts/tools/telink/readme
```
2 changes: 1 addition & 1 deletion examples/contact-sensor-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ The resulting output file can be found in out/debug/chip-k32w0x-contact-example.
## Manufacturing data
See
[Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md).
[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md).
There are factory data generated binaries available in
examples/platform/nxp/k32w/k32w0/scripts/demo_generated_factory_data folder.
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ The resulting output file can be found in out/debug/chip-k32w0x-light-example.
## Manufacturing data

See
[Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md).
[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md).

There are factory data generated binaries available in
examples/platform/nxp/k32w/k32w0/scripts/demo_generated_factory_data folder.
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nxp/k32w/k32w0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ The resulting output file can be found in out/debug/chip-k32w0x-lock-example.
## Manufacturing data

See
[Guide for writing manufacturing data on NXP devices](../../../../platform/nxp/doc/manufacturing_flow.md).
[Guide for writing manufacturing data on NXP devices](../../../../../docs/guides/nxp_manufacturing_flow.md).

There are factory data generated binaries available in
examples/platform/nxp/k32w/k32w0/scripts/demo_generated_factory_data folder.
Expand Down
4 changes: 2 additions & 2 deletions scripts/tools/nxp/factory_data_generator/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## NXP Factory Data Generator
# NXP Factory Data Generator

For usage of the tool, please see
[Guide for writing manufacturing data on NXP devices](../../../../examples/platform/nxp/doc/manufacturing_flow.md).
[Guide for writing manufacturing data on NXP devices](../../../../docs/guides/nxp_manufacturing_flow.md).

## Tool implementation

Expand Down
2 changes: 1 addition & 1 deletion scripts/tools/nxp/ota/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private:
update OTA image. If the `PAA` changes, make sure to generate the new
certificates using the new `PAA` (which is only used by the controller, e.g.
`chip-tool`). Please see the
[manufacturing flow guide](../../../../examples/platform/nxp/doc/manufacturing_flow.md)
[manufacturing flow guide](../../../../docs/guides/nxp_manufacturing_flow.md)
for generating new certificates.

Example of OTA image generation with factory data and application update (using
Expand Down
2 changes: 1 addition & 1 deletion scripts/tools/silabs/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#`FactoryDataProvider` for EFR32 Matter device
# `FactoryDataProvider` for EFR32 Matter device

## Introduction

Expand Down
5 changes: 4 additions & 1 deletion src/app/clusters/mode-select-server/mode-select-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <app/CommandHandler.h>
#include <app/ConcreteCommandPath.h>
#include <app/clusters/mode-select-server/supported-modes-manager.h>
#include <app/clusters/on-off-server/on-off-server.h>
#include <app/util/af.h>
#include <app/util/attribute-storage.h>
#include <app/util/config.h>
Expand All @@ -34,6 +33,10 @@
#include <lib/support/CodeUtils.h>
#include <platform/DiagnosticDataProvider.h>

#ifdef EMBER_AF_PLUGIN_ON_OFF
#include <app/clusters/on-off-server/on-off-server.h>
#endif // EMBER_AF_PLUGIN_ON_OFF

using namespace std;
using namespace chip;
using namespace chip::app;
Expand Down
8 changes: 8 additions & 0 deletions src/credentials/FabricTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,14 @@ class DLL_EXPORT FabricTable
*/
bool HasOperationalKeyForFabric(FabricIndex fabricIndex) const;

/**
* @brief Returns the operational keystore. This is used for
* CASE and the only way the keystore should be used.
*
* @return The operational keystore, nullptr otherwise.
*/
const Crypto::OperationalKeystore * GetOperationalKeystore() { return mOperationalKeystore; }

/**
* @brief Add a pending trusted root certificate for the next fabric created with `AddNewPendingFabric*` methods.
*
Expand Down
14 changes: 13 additions & 1 deletion src/crypto/OperationalKeystore.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ class OperationalKeystore
virtual void RevertPendingKeypair() = 0;

// ==== Primary operation required: signature
/**
* @brief Whether `SignWithOpKeypair` may be performed in the background.
*
* If true, `CASESession` may attempt to perform `SignWithOpKeypair` in the
* background. In this case, `OperationalKeystore` should protect itself,
* e.g. with a mutex, as the signing could occur at any time during session
* establishment.
*
* @retval true if `SignWithOpKeypair` may be performed in the background
* @retval false if `SignWithOpKeypair` may NOT be performed in the background
*/
virtual bool SupportsSignWithOpKeypairInBackground() const { return false; }

/**
* @brief Sign a message with a fabric's currently-active operational keypair.
*
Expand All @@ -164,7 +177,6 @@ class OperationalKeystore
* @retval CHIP_ERROR_INVALID_FABRIC_INDEX if no active key is found for the given `fabricIndex` or if
* `fabricIndex` is invalid.
* @retval other CHIP_ERROR value on internal crypto engine errors
*
*/
virtual CHIP_ERROR SignWithOpKeypair(FabricIndex fabricIndex, const ByteSpan & message,
Crypto::P256ECDSASignature & outSignature) const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRManualSetupPayloadParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

NS_ASSUME_NONNULL_BEGIN

MTR_DEPRECATED("Please use [MTRSetupPayload setupPayloadWithOnboardingPayload", ios(16.1, 16.4), macos(13.0, 13.3),
MTR_DEPRECATED("Please use [MTRSetupPayload setupPayloadWithOnboardingPayload:error:]", ios(16.1, 16.4), macos(13.0, 13.3),
watchos(9.1, 9.4), tvos(16.1, 16.4))
@interface MTRManualSetupPayloadParser : NSObject
- (instancetype)initWithDecimalStringRepresentation:(NSString *)decimalStringRepresentation;
Expand Down
3 changes: 2 additions & 1 deletion src/darwin/Framework/CHIP/MTROnboardingPayloadParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ typedef NS_ENUM(NSUInteger, MTROnboardingPayloadType) {
MTROnboardingPayloadTypeQRCode = 0,
MTROnboardingPayloadTypeManualCode,
MTROnboardingPayloadTypeNFC
};
} MTR_NEWLY_DEPRECATED("MTROnboardingPayloadType is unused");

MTR_NEWLY_DEPRECATED("Please use [MTRSetupPayload setupPayloadWithOnboardingPayload:error:]")
@interface MTROnboardingPayloadParser : NSObject

+ (MTRSetupPayload * _Nullable)setupPayloadForOnboardingPayload:(NSString *)onboardingPayload
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRQRCodeSetupPayloadParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

NS_ASSUME_NONNULL_BEGIN

MTR_DEPRECATED("Please use [MTRSetupPayload setupPayloadWithOnboardingPayload", ios(16.1, 16.4), macos(13.0, 13.3),
MTR_DEPRECATED("Please use [MTRSetupPayload setupPayloadWithOnboardingPayload:error:]", ios(16.1, 16.4), macos(13.0, 13.3),
watchos(9.1, 9.4), tvos(16.1, 16.4))
@interface MTRQRCodeSetupPayloadParser : NSObject
- (instancetype)initWithBase38Representation:(NSString *)base38Representation;
Expand Down
3 changes: 0 additions & 3 deletions src/lib/core/CHIPError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ bool FormatCHIPError(char * buf, uint16_t bufSize, CHIP_ERROR err)
case CHIP_ERROR_MESSAGE_TOO_LONG.AsInteger():
desc = "Message too long";
break;
case CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION.AsInteger():
desc = "Unsupported exchange version";
break;
case CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS.AsInteger():
desc = "Too many unsolicited message handlers";
break;
Expand Down
9 changes: 1 addition & 8 deletions src/lib/core/CHIPError.h
Original file line number Diff line number Diff line change
Expand Up @@ -466,14 +466,7 @@ using CHIP_ERROR = ::chip::ChipError;
*/
#define CHIP_ERROR_MESSAGE_TOO_LONG CHIP_CORE_ERROR(0x04)

/**
* @def CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION
*
* @brief
* An exchange version is not supported.
*
*/
#define CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION CHIP_CORE_ERROR(0x05)
// AVAILABLE: 0x05

/**
* @def CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS
Expand Down
1 change: 0 additions & 1 deletion src/lib/core/tests/TestCHIPErrorStr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ static const CHIP_ERROR kTestElements[] =
CHIP_ERROR_CONNECTION_ABORTED,
CHIP_ERROR_INCORRECT_STATE,
CHIP_ERROR_MESSAGE_TOO_LONG,
CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION,
CHIP_ERROR_TOO_MANY_UNSOLICITED_MESSAGE_HANDLERS,
CHIP_ERROR_NO_UNSOLICITED_MESSAGE_HANDLER,
CHIP_ERROR_NO_CONNECTION_HANDLER,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/support/CHIPMem.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ inline SharedPtr<T> MakeShared(Args &&... args)
return SharedPtr<T>(New<T>(std::forward<Args>(args)...), Deleter<T>());
}

template <typename T>
using WeakPtr = std::weak_ptr<T>;

// See MemoryDebugCheckPointer().
extern bool MemoryInternalCheckPointer(const void * p, size_t min_size);

Expand Down
3 changes: 2 additions & 1 deletion src/platform/qpg/OTAImageProcessorImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ CHIP_ERROR OTAImageProcessorImpl::ProcessHeader(ByteSpan & block)

if (true != qvCHIP_OtaValidateImage(qvCHIP_OtaImgHeader))
{
return CHIP_ERROR_UNSUPPORTED_EXCHANGE_VERSION;
// Dropping image due to invalid header
return CHIP_DEVICE_ERROR_SOFTWARE_UPDATE_IGNORED;
}
}

Expand Down
15 changes: 7 additions & 8 deletions src/platform/silabs/SilabsConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ static StaticSemaphore_t nvm3_SemStruct;

void nvm3_lockBegin(void)
{
if (nvm3_Sem == NULL)
{
nvm3_Sem = xSemaphoreCreateBinaryStatic(&nvm3_SemStruct);
xSemaphoreGive(nvm3_Sem);
}

VerifyOrDie(nvm3_Sem != NULL);
xSemaphoreTake(nvm3_Sem, portMAX_DELAY);
}
Expand All @@ -65,15 +71,8 @@ namespace Internal {

CHIP_ERROR SilabsConfig::Init()
{
#ifndef BRD4325A // TODO: fix semaphore usage in nvm3_lock for siwx917. use weak implementation for that board instead
nvm3_Sem = xSemaphoreCreateBinaryStatic(&nvm3_SemStruct);
// nvm3_Sem is created in nvm3_lockBegin()

if (nvm3_Sem == NULL)
{
return CHIP_ERROR_NO_MEMORY;
}
xSemaphoreGive(nvm3_Sem);
#endif // not BRD4325A
return MapNvm3Error(nvm3_open(nvm3_defaultHandle, nvm3_defaultInit));
}

Expand Down
2 changes: 1 addition & 1 deletion src/platform/tests/TestConfigurationMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ int TestConfigurationMgr()
{
nlTestSuite theSuite = { "ConfigurationMgr tests", &sTests[0], TestConfigurationMgr_Setup, TestConfigurationMgr_Teardown };

// Run test suit againt one context.
// Run test suite against one context.
nlTestRunner(&theSuite, nullptr);
return nlTestRunnerStats(&theSuite);
}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/tests/TestConnectivityMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int TestConnectivityMgr()
{
nlTestSuite theSuite = { "ConfigurationMgr tests", &sTests[0], TestConnectivityMgr_Setup, TestConnectivityMgr_Teardown };

// Run test suit againt one context.
// Run test suite against one context.
nlTestRunner(&theSuite, nullptr);
return nlTestRunnerStats(&theSuite);
}
Expand Down
Loading

0 comments on commit 18d2634

Please sign in to comment.