Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/fix-incorrect-return-codes-in-door-…
Browse files Browse the repository at this point in the history
…lock-cluster
  • Loading branch information
woody-apple authored Jun 23, 2022
2 parents f022314 + 1381c8e commit 5449e61
Show file tree
Hide file tree
Showing 99 changed files with 1,842 additions and 265 deletions.
7 changes: 7 additions & 0 deletions config/nrfconnect/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ chip_gn_arg_bool ("chip_detail_logging" CONFIG_MATTER_LOG_LE
chip_gn_arg_bool ("chip_automation_logging" "false")
chip_gn_arg_bool ("chip_malloc_sys_heap" CONFIG_CHIP_MALLOC_SYS_HEAP)

if (CONFIG_CHIP_FACTORY_DATA)
chip_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false")
chip_gn_arg_bool ("chip_enable_factory_data" "true")
elseif (CONFIG_CHIP_FACTORY_DATA_CUSTOM_BACKEND)
chip_gn_arg_bool ("chip_use_transitional_commissionable_data_provider" "false")
endif()

if (CONFIG_CHIP_ROTATING_DEVICE_ID)
chip_gn_arg_bool("chip_enable_rotating_device_id" "true")
chip_gn_arg_bool("chip_enable_additional_data_advertising" "true")
Expand Down
32 changes: 31 additions & 1 deletion config/nrfconnect/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

rsource "../../zephyr/Kconfig"

if CHIP

config CHIP_NFC_COMMISSIONING
bool "Enable NFC commissioning support"
default n
Expand Down Expand Up @@ -73,6 +75,22 @@ config CHIP_DEBUG_SYMBOLS
help
Build the application with debug symbols.

config CHIP_FACTORY_DATA
bool "Enable Factory Data support"
select ZCBOR
help
Enables support for reading factory data from flash memory partition.
It requires factory_data partition to exist in the partition manager
configuration file pm_static.yml.

config CHIP_FACTORY_DATA_CUSTOM_BACKEND
bool "Enable Factory Data custom backend"
depends on !CHIP_FACTORY_DATA
help
Enables user custom factory data implementation. It cannot be used
with the CHIP_FACTORY_DATA that enabled default nRF Connect factory data
implementation.

config CHIP_FACTORY_DATA_BUILD
bool "Enable Factory Data build"
default n
Expand All @@ -82,10 +100,20 @@ config CHIP_FACTORY_DATA_BUILD
configuration file pm_static.yml.
As a result a new output file factory_data.hex will be created.

config CHIP_FACTORY_DATA_VERSION
int
default 1
help
The Factory data version contains a current version of a factory data
parameter set that the user cannot change.
After moving to the next version of the factory data set, change the default value.
This config is used to validate the version of a factory data set on a device-side
with the version of factory data saved in the Flash memory.

if CHIP_FACTORY_DATA_BUILD

# Factory data definitions
config CHIP_MERGE_FACTORY_DATA_WITH_FIRMWARE
config CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE
bool "Enable merging generated factory data with the build target .hex file"
default y
help
Expand Down Expand Up @@ -224,3 +252,5 @@ config CHIP_DEVICE_ROTATING_DEVICE_UID
help
A device rotating id unique id which will be generated if
this config is not set in prj.conf file.

endif
4 changes: 2 additions & 2 deletions config/nrfconnect/chip-module/generate_factory_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# Created JSON file can be checked using JSON SCHEMA file if it is provided.
#
# This script can be manipulated using following kConfigs:
# - To merge generated factory data with final zephyr.hex file set kConfig CONFIG_CHIP_MERGE_FACTORY_DATA_WITH_FIRMWARE=y
# - To merge generated factory data with final zephyr.hex file set kConfig CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y
# - To use default certification paths set CONFIG_CHIP_FACTORY_DATA_USE_DEFAULTS_CERTS_PATH=y
#
# During generation process a some file will be created in zephyr's build directory:
Expand Down Expand Up @@ -187,7 +187,7 @@ nrfconnect_create_factory_data_hex_file(factory_data
${OUTPUT_FILE_PATH}
factory_data_hex)

if(CONFIG_CHIP_MERGE_FACTORY_DATA_WITH_FIRMWARE)
if(CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE)
# set custom target for merging factory_data hex file
add_custom_target(factory_data_merge
DEPENDS ${factory_data_hex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,36 @@ mcuboot_pad:
size: 0x200
app:
address: 0x7200
size: 0xf4e00
size: 0xf3e00
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0x7000
size: 0xf5000
size: 0xf4000
region: flash_primary
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0x7200
size: 0xf4e00
size: 0xf3e00
factory_data:
address: 0xfb000
size: 0x1000
region: flash_primary
settings_storage:
address: 0xfc000
size: 0x4000
region: flash_primary
mcuboot_secondary:
address: 0x0
size: 0xf5000
size: 0xf4000
device: MX25R64
region: external_flash
external_flash:
address: 0xf5000
size: 0x70b000
address: 0xf4000
size: 0x70c000
device: MX25R64
region: external_flash
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ mcuboot_pad:
size: 0x200
app:
address: 0xC200
size: 0xefe00
size: 0xeee00
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0xC000
size: 0xf0000
size: 0xef000
region: flash_primary
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0xC200
size: 0xefe00
size: 0xeee00
factory_data:
address: 0xfb000
size: 0x1000
region: flash_primary
settings_storage:
address: 0xfc000
size: 0x4000
Expand All @@ -33,17 +37,17 @@ mcuboot_primary_1:
region: ram_flash
mcuboot_secondary:
address: 0x0
size: 0xf0000
size: 0xef000
device: MX25R64
region: external_flash
mcuboot_secondary_1:
address: 0xf0000
address: 0xef000
size: 0x40000
device: MX25R64
region: external_flash
external_flash:
address: 0x130000
size: 0x6D0000
address: 0x12f000
size: 0x6D1000
device: MX25R64
region: external_flash
pcd_sram:
Expand Down
7 changes: 7 additions & 0 deletions examples/all-clusters-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,14 @@ CHIP_ERROR AppTask::Init()
k_timer_user_data_set(&sFunctionTimer, this);

// Initialize CHIP server
#if CONFIG_CHIP_FACTORY_DATA
ReturnErrorOnFailure(mFactoryDataProvider.Init());
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetCommissionableDataProvider(&mFactoryDataProvider);
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif

static CommonCaseDeviceServerInitParams initParams;
static OTATestEventTriggerDelegate testEventTriggerDelegate{ ByteSpan(kTestEventTriggerEnableKey) };
Expand Down
8 changes: 8 additions & 0 deletions examples/all-clusters-app/nrfconnect/main/include/AppTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include <platform/CHIPDeviceLayer.h>

#if CONFIG_CHIP_FACTORY_DATA
#include <platform/nrfconnect/FactoryDataProvider.h>
#endif

struct k_timer;
class AppEvent;
class LEDWidget;
Expand Down Expand Up @@ -63,4 +67,8 @@ class AppTask
bool mIsThreadProvisioned{ false };
bool mIsThreadEnabled{ false };
bool mHaveBLEConnections{ false };

#if CONFIG_CHIP_FACTORY_DATA
chip::DeviceLayer::FactoryDataProvider<chip::DeviceLayer::InternalFlashFactoryData> mFactoryDataProvider;
#endif
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,36 @@ mcuboot_pad:
size: 0x200
app:
address: 0x7200
size: 0xf4e00
size: 0xf3e00
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0x7000
size: 0xf5000
size: 0xf4000
region: flash_primary
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0x7200
size: 0xf4e00
size: 0xf3e00
factory_data:
address: 0xfb000
size: 0x1000
region: flash_primary
settings_storage:
address: 0xfc000
size: 0x4000
region: flash_primary
mcuboot_secondary:
address: 0x0
size: 0xf5000
size: 0xf4000
device: MX25R64
region: external_flash
external_flash:
address: 0xf5000
size: 0x70b000
address: 0xf4000
size: 0x70c000
device: MX25R64
region: external_flash
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@ mcuboot_pad:
size: 0x200
app:
address: 0xC200
size: 0xefe00
size: 0xeee00
mcuboot_primary:
orig_span: &id001
- mcuboot_pad
- app
span: *id001
address: 0xC000
size: 0xf0000
size: 0xef000
region: flash_primary
mcuboot_primary_app:
orig_span: &id002
- app
span: *id002
address: 0xC200
size: 0xefe00
size: 0xeee00
factory_data:
address: 0xfb000
size: 0x1000
region: flash_primary
settings_storage:
address: 0xfc000
size: 0x4000
Expand All @@ -33,17 +37,17 @@ mcuboot_primary_1:
region: ram_flash
mcuboot_secondary:
address: 0x0
size: 0xf0000
size: 0xef000
device: MX25R64
region: external_flash
mcuboot_secondary_1:
address: 0xf0000
address: 0xef000
size: 0x40000
device: MX25R64
region: external_flash
external_flash:
address: 0x130000
size: 0x6D0000
address: 0x12f000
size: 0x6D1000
device: MX25R64
region: external_flash
pcd_sram:
Expand Down
7 changes: 7 additions & 0 deletions examples/all-clusters-minimal-app/nrfconnect/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ CHIP_ERROR AppTask::Init()
k_timer_user_data_set(&sFunctionTimer, this);

// Initialize CHIP server
#if CONFIG_CHIP_FACTORY_DATA
ReturnErrorOnFailure(mFactoryDataProvider.Init());
SetDeviceInstanceInfoProvider(&mFactoryDataProvider);
SetDeviceAttestationCredentialsProvider(&mFactoryDataProvider);
SetCommissionableDataProvider(&mFactoryDataProvider);
#else
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider());
#endif

static chip::CommonCaseDeviceServerInitParams initParams;
(void) initParams.InitializeStaticResourcesBeforeServerInit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#include <platform/CHIPDeviceLayer.h>

#if CONFIG_CHIP_FACTORY_DATA
#include <platform/nrfconnect/FactoryDataProvider.h>
#endif

struct k_timer;
class AppEvent;
class LEDWidget;
Expand Down Expand Up @@ -63,4 +67,8 @@ class AppTask
bool mIsThreadProvisioned{ false };
bool mIsThreadEnabled{ false };
bool mHaveBLEConnections{ false };

#if CONFIG_CHIP_FACTORY_DATA
chip::DeviceLayer::FactoryDataProvider<chip::DeviceLayer::InternalFlashFactoryData> mFactoryDataProvider;
#endif
};
4 changes: 4 additions & 0 deletions examples/chef/nrfconnect/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,7 @@ CONFIG_CHIP_ENABLE_PAIRING_AUTOSTART=y
# Configure CHIP shell
CONFIG_CHIP_LIB_SHELL=y
CONFIG_OPENTHREAD_SHELL=n

# Disable factory data support.
CONFIG_CHIP_FACTORY_DATA=n
CONFIG_CHIP_FACTORY_DATA_BUILD=n
2 changes: 1 addition & 1 deletion examples/light-switch-app/efr32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ combination with JLinkRTTClient as follows:
a URL can be found in the RTT logs.

<info > [SVR] Copy/paste the below URL in a browser to see the QR Code:
<info > [SVR] https://dhrishi.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0
<info > [SVR] https://project-chip.github.io/connectedhomeip/qrcode.html?data=CH%3AI34NM%20-00%200C9SS0

**LED 0** shows the overall state of the device and its connectivity. The
following states are possible:
Expand Down
11 changes: 7 additions & 4 deletions examples/light-switch-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ make sure the IDF_PATH has been exported(See the manual setup steps above).

$ ./out/debug/chip-tool accesscontrol write acl '[{"fabricIndex": 1, "privilege": 5, "authMode": 2, "subjects": [112233], "targets": null },{"fabricIndex": 1, "privilege": 3, "authMode": 2, "subjects": [12344320], "targets": null }]' 12344321 0

- we use matter shell to bind and test.
- After successful commissioning, use the chip-tool for binding in
Lighting-switch.

binding:
$ ./out/debug/chip-tool binding write binding '[{"fabricIndex": 1, "node":20836, "endpoint":1, "cluster":6}]' 12344320 1

matter switch binding unicast 1 12344321 1
- Test toggle:

on:
Press `boot` button to toggle LED.

Using matter shell on:

matter switch onoff on

Expand Down
Loading

0 comments on commit 5449e61

Please sign in to comment.