Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/missing-isnullable-in-pcc-xml
Browse files Browse the repository at this point in the history
  • Loading branch information
tlykkeberg-grundfos committed Apr 12, 2022
2 parents 93f9e75 + c9350f7 commit 001260d
Show file tree
Hide file tree
Showing 78 changed files with 5,219 additions and 714 deletions.
6 changes: 4 additions & 2 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ ctypes
CurrentHue
CurrentLevel
CurrentSaturation
customAcl
customizations
cvfJ
cxx
Expand Down Expand Up @@ -417,8 +418,8 @@ DoorLock
doru
DOTBR
DOVERLAY
DownloadProtocolEnum
downcasting
DownloadProtocolEnum
Doxygen
dpkg
dropdown
Expand Down Expand Up @@ -923,8 +924,8 @@ OTAProviderIpAddress
OTAProviderNodeId
OTAProviderSerialPort
OTARequesterImpl
OTARequestorInterface
OTARequestorDriver
OTARequestorInterface
OTARequestorSerialPort
OTARequestorStorage
OtaSoftwareUpdateProvider
Expand Down Expand Up @@ -1073,6 +1074,7 @@ RequestorCanConsent
Requestor's
Requestors
responder
RestrictedEvent
retargeting
reusability
reviwed
Expand Down
9 changes: 9 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ config("abi_default") {
ldflags = cflags
}

config("dead_code_elimination_default") {
# Delete unreferenced sections. Helpful with -ffunction-sections.
if (current_os == "mac" || current_os == "ios") {
ldflags = [ "-Wl,-dead_strip" ]
} else {
ldflags = [ "-Wl,--gc-sections" ]
}
}

config("target_default") {
if (current_toolchain == default_toolchain) {
defines = target_defines
Expand Down
5 changes: 5 additions & 0 deletions build/config/defaults.gni
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ declare_args() {
# Defaults target-specific configs.
default_configs_target = [ "${build_root}/config/compiler:target_default" ]

# Default configs for dead code elimination.
default_configs_dead_code =
[ "${build_root}/config/compiler:dead_code_elimination_default" ]

# Extra default configs.
default_configs_extra = []
}
Expand All @@ -105,6 +109,7 @@ default_configs += default_configs_aliasing
default_configs += default_configs_sanitize
default_configs += default_configs_fuzzing
default_configs += default_configs_target
default_configs += default_configs_dead_code
default_configs += default_configs_extra

executable_default_configs = []
Expand Down
23 changes: 22 additions & 1 deletion config/esp32/components/chip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ menu "CHIP Core"

config USE_MINIMAL_MDNS
bool "Use the minimal mDNS implementation shipped in the CHIP library"
default n
default y
help
The CHIP library is shipped with a minimal mDNS implementation,
enable this config to use it rather than the mDNS library in IDF.
Expand Down Expand Up @@ -780,4 +780,25 @@ menu "CHIP Device Layer"
The gn target of the external platform.
endmenu

menu "Matter Manufacturing Options"
config CHIP_FACTORY_NAMESPACE_PARTITION_LABEL
string "chip-factory namespace partition label"
default "nvs"
help
Label of the partition to store key-values in the "chip-factory" namespace.

config CHIP_CONFIG_NAMESPACE_PARTITION_LABEL
string "chip-config namespace partition label"
default "nvs"
help
Label of the partition to store key-values in the "chip-config" namespace.

config CHIP_COUNTERS_NAMESPACE_PARTITION_LABEL
string "chip-counters namespace partition label"
default "nvs"
help
Label of the partition to store key-values in the "chip-counters" namespace.

endmenu

endmenu
65 changes: 65 additions & 0 deletions examples/all-clusters-app/linux/AppOptions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "AppOptions.h"

using chip::ArgParser::OptionDef;
using chip::ArgParser::OptionSet;
using chip::ArgParser::PrintArgError;

constexpr uint16_t kOptionDacProviderFilePath = 0xFF01;

static chip::Credentials::Examples::TestHarnessDACProvider mDacProvider;

bool AppOptions::HandleOptions(const char * program, OptionSet * options, int identifier, const char * name, const char * value)
{
bool retval = true;
switch (identifier)
{
case kOptionDacProviderFilePath:
mDacProvider.Init(value);
break;
default:
PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", program, name);
retval = false;
break;
}

return retval;
}

OptionSet * AppOptions::GetOptions()
{
static OptionDef optionsDef[] = {
{ "dac_provider", chip::ArgParser::kArgumentRequired, kOptionDacProviderFilePath },
{},
};

static OptionSet options = {
AppOptions::HandleOptions, optionsDef, "PROGRAM OPTIONS",
" --dac_provider <filepath>\n"
" A json file with data used by the example dac provider to validate device attestation procedure.\n"
};

return &options;
}

chip::Credentials::DeviceAttestationCredentialsProvider * AppOptions::GetDACProvider()
{
return &mDacProvider;
}
34 changes: 34 additions & 0 deletions examples/all-clusters-app/linux/AppOptions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include "AppMain.h"

#include <app/tests/suites/credentials/TestHarnessDACProvider.h>

class AppOptions
{
public:
static chip::ArgParser::OptionSet * GetOptions();
static chip::Credentials::DeviceAttestationCredentialsProvider * GetDACProvider();

private:
static bool HandleOptions(const char * program, chip::ArgParser::OptionSet * options, int identifier, const char * name,
const char * value);
};
2 changes: 2 additions & 0 deletions examples/all-clusters-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ source_set("chip-all-clusters-common") {
"${chip_root}/examples/door-lock-app/linux/src/LockEndpoint.cpp",
"${chip_root}/examples/door-lock-app/linux/src/LockManager.cpp",
"${chip_root}/examples/door-lock-app/linux/src/ZCLDoorLockCallbacks.cpp",
"AppOptions.cpp",
"include/tv-callbacks.cpp",
"include/tv-callbacks.h",
"main-common.cpp",
Expand All @@ -34,6 +35,7 @@ source_set("chip-all-clusters-common") {
deps = [
"${chip_root}/examples/all-clusters-app/all-clusters-common",
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/src/app/tests/suites/credentials:dac_provider",
"${chip_root}/src/lib",
]

Expand Down
6 changes: 4 additions & 2 deletions examples/all-clusters-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@
*/

#include "AppMain.h"
#include "AppOptions.h"
#include "binding-handler.h"

int main(int argc, char * argv[])
{
VerifyOrDie(ChipLinuxAppInit(argc, argv) == 0);
VerifyOrDie(ChipLinuxAppInit(argc, argv, AppOptions::GetOptions()) == 0);
VerifyOrDie(InitBindingHandlers() == CHIP_NO_ERROR);
ChipLinuxAppMainLoop();

ChipLinuxAppMainLoop(AppOptions::GetDACProvider());
return 0;
}
2 changes: 1 addition & 1 deletion examples/all-clusters-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ To make them persistent, save the configuration options in the `prj.conf` file.

The example uses different configuration files depending on the supported
features. Configuration files are provided for different build types and they
are located in the `configuration/build-target` directory.
are located in the application root directory.

The `prj.conf` file represents a debug build type. Other build types are covered
by dedicated files with the build type added as a suffix to the prj part, as per
Expand Down
1 change: 0 additions & 1 deletion examples/chip-tool/commands/common/CHIPCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ CHIP_ERROR CHIPCommand::InitializeCommissioner(std::string key, chip::FabricId f
commissionerParams.controllerNOC = nocSpan;
}

commissionerParams.storageDelegate = &mCommissionerStorage;
// TODO: Initialize IPK epoch key in ExampleOperationalCredentials issuer rather than relying on DefaultIpkValue
commissionerParams.operationalCredentialsDelegate = mCredIssuerCmds->GetCredentialIssuer();
commissionerParams.controllerVendorId = chip::VendorId::TestVendor1;
Expand Down
15 changes: 5 additions & 10 deletions examples/chip-tool/commands/pairing/CommissionedListCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ CHIP_ERROR CommissionedListCommand::PrintInformation()
uint16_t pairedNodesIdsSize = sizeof(pairedNodesIds);
memset(pairedNodesIds, 0, pairedNodesIdsSize);

PERSISTENT_KEY_OP(static_cast<uint64_t>(0), chip::kPairedDeviceListKeyPrefix, key,
ReturnLogErrorOnFailure(mStorage.SyncGetKeyValue(key, pairedNodesIds, pairedNodesIdsSize)));

chip::SerializableU64Set<chip::Controller::kNumMaxPairedDevices> devices;
devices.Deserialize(chip::ByteSpan((uint8_t *) pairedNodesIds, pairedNodesIdsSize));

// TODO: Get the list of paired node IDs. chip-tool needs to store that as
// devices get paired.
uint16_t pairedDevicesCount = 0;
while (pairedNodesIds[pairedDevicesCount] != 0x0 && pairedDevicesCount < chip::Controller::kNumMaxPairedDevices)
{
Expand Down Expand Up @@ -69,13 +65,12 @@ CHIP_ERROR CommissionedListCommand::PrintInformation()

CHIP_ERROR CommissionedListCommand::PrintDeviceInformation(chip::NodeId deviceId)
{
// TODO: Controller::SerializedDevice and Controller::SerializableDevice are
// gone. Need to figure out what chip-tool should actually store/retrieve
// here.
chip::Controller::SerializedDevice deviceInfo;
uint16_t size = sizeof(deviceInfo.inner);

PERSISTENT_KEY_OP(deviceId, chip::kPairedDeviceKeyPrefix, key,
ReturnLogErrorOnFailure(mStorage.SyncGetKeyValue(key, deviceInfo.inner, size)));
VerifyOrReturnError(size <= sizeof(deviceInfo.inner), CHIP_ERROR_INVALID_DEVICE_DESCRIPTOR);

chip::Controller::SerializableDevice serializable;
constexpr size_t maxlen = BASE64_ENCODED_LEN(sizeof(serializable));
const size_t len = strnlen(chip::Uint8::to_const_char(&deviceInfo.inner[0]), maxlen);
Expand Down
2 changes: 1 addition & 1 deletion examples/light-switch-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ To make them persistent, save the configuration options in the `prj.conf` file.

The example uses different configuration files depending on the supported
features. Configuration files are provided for different build types and they
are located in the `configuration/build-target` directory.
are located in the application root directory.

The `prj.conf` file represents a debug build type. Other build types are covered
by dedicated files with the build type added as a suffix to the prj part, as per
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ To make them persistent, save the configuration options in the `prj.conf` file.

The example uses different configuration files depending on the supported
features. Configuration files are provided for different build types and they
are located in the `configuration/build-target` directory.
are located in the application root directory.

The `prj.conf` file represents a debug build type. Other build types are covered
by dedicated files with the build type added as a suffix to the prj part, as per
Expand Down
2 changes: 1 addition & 1 deletion examples/lock-app/nrfconnect/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ To make them persistent, save the configuration options in the `prj.conf` file.

The example uses different configuration files depending on the supported
features. Configuration files are provided for different build types and they
are located in the `configuration/build-target` directory.
are located in the application root directory.

The `prj.conf` file represents a debug build type. Other build types are covered
by dedicated files with the build type added as a suffix to the prj part, as per
Expand Down
65 changes: 65 additions & 0 deletions examples/placeholder/linux/AppOptions.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
*
* Copyright (c) 2022 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#include "AppOptions.h"

using chip::ArgParser::OptionDef;
using chip::ArgParser::OptionSet;
using chip::ArgParser::PrintArgError;

constexpr uint16_t kOptionDacProviderFilePath = 0xFF01;

static chip::Credentials::Examples::TestHarnessDACProvider mDacProvider;

bool AppOptions::HandleOptions(const char * program, OptionSet * options, int identifier, const char * name, const char * value)
{
bool retval = true;
switch (identifier)
{
case kOptionDacProviderFilePath:
mDacProvider.Init(value);
break;
default:
PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", program, name);
retval = false;
break;
}

return retval;
}

OptionSet * AppOptions::GetOptions()
{
static OptionDef optionsDef[] = {
{ "dac_provider", chip::ArgParser::kArgumentRequired, kOptionDacProviderFilePath },
{},
};

static OptionSet options = {
AppOptions::HandleOptions, optionsDef, "PROGRAM OPTIONS",
" --dac_provider <filepath>\n"
" A json file with data used by the example dac provider to validate device attestation procedure.\n"
};

return &options;
}

chip::Credentials::DeviceAttestationCredentialsProvider * AppOptions::GetDACProvider()
{
return &mDacProvider;
}
Loading

0 comments on commit 001260d

Please sign in to comment.