-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/fix-tv-app-install-flow-and-suppor…
…ted-clusters
- Loading branch information
Showing
12 changed files
with
223 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
examples/platform/nxp/zephyr/factory_data/source/AppFactoryDataExample.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* | ||
* Copyright (c) 2024 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 "AppFactoryData.h" | ||
|
||
#include <credentials/DeviceAttestationCredsProvider.h> | ||
#include <platform/CommissionableDataProvider.h> | ||
#include <platform/DeviceInstanceInfoProvider.h> | ||
|
||
#if CONFIG_CHIP_PLAT_LOAD_REAL_FACTORY_DATA | ||
#include "FactoryDataProvider.h" | ||
/* | ||
* Test key used to encrypt factory data before storing it to the flash. | ||
* The software key should be used only during development stage. | ||
* For production usage, it is recommended to use the OTP key which needs to be fused in the RT1060 SW_GP2. | ||
*/ | ||
static const uint8_t aes128TestKey[] | ||
__attribute__((aligned)) = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c }; | ||
#else | ||
#include <credentials/examples/DeviceAttestationCredsExample.h> | ||
#endif | ||
|
||
#if CONFIG_CHIP_FACTORY_DATA | ||
#include <platform/nxp/common/factory_data/FactoryDataProvider.h> | ||
#else | ||
#include <platform/nxp/zephyr/DeviceInstanceInfoProviderImpl.h> | ||
#endif | ||
|
||
#if CONFIG_CHIP_FACTORY_DATA && CONFIG_CHIP_ENCRYPTED_FACTORY_DATA | ||
#ifdef CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY | ||
|
||
#define KEY CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY | ||
#define HEXTONIBBLE(c) (*(c) >= 'A' ? (*(c) - 'A') + 10 : (*(c) - '0')) | ||
#define HEXTOBYTE(c) (HEXTONIBBLE(c) * 16 + HEXTONIBBLE(c + 1)) | ||
#define AES128_KEY_ARRAY \ | ||
HEXTOBYTE(KEY + 0), HEXTOBYTE(KEY + 2), HEXTOBYTE(KEY + 4), HEXTOBYTE(KEY + 6), HEXTOBYTE(KEY + 8), HEXTOBYTE(KEY + 10), \ | ||
HEXTOBYTE(KEY + 12), HEXTOBYTE(KEY + 14), HEXTOBYTE(KEY + 16), HEXTOBYTE(KEY + 18), HEXTOBYTE(KEY + 20), \ | ||
HEXTOBYTE(KEY + 22), HEXTOBYTE(KEY + 24), HEXTOBYTE(KEY + 26), HEXTOBYTE(KEY + 28), HEXTOBYTE(KEY + 30) | ||
#else | ||
#define AES128_KEY_ARRAY 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c | ||
#endif /* CONFIG_CHIP_ENCRYPTED_FACTORY_DATA_AES128_KEY */ | ||
|
||
/* | ||
* Test key used to encrypt factory data before storing it to the flash. | ||
*/ | ||
static const uint8_t aes128TestKey[] __attribute__((aligned)) = { AES128_KEY_ARRAY }; | ||
|
||
#endif /* CONFIG_CHIP_FACTORY_DATA && CONFIG_CHIP_ENCRYPTED_FACTORY_DATA */ | ||
|
||
using namespace chip; | ||
using namespace ::chip::Credentials; | ||
using namespace ::chip::DeviceLayer; | ||
|
||
/** | ||
* Allows to register Matter factory data before initializing the Matter stack | ||
* Load factory data from the flash to the RAM. | ||
* Needs to be done before starting other Matter modules to avoid concurrent access issues with DCP hardware module. | ||
* | ||
* This example demonstrates the usage of the ecb with a software key, to use other encryption mode, | ||
* or to use hardware keys, check available methodes from the FactoryDataProviderImpl class. | ||
*/ | ||
CHIP_ERROR NXP::App::AppFactoryData_PreMatterStackInit(void) | ||
{ | ||
return CHIP_NO_ERROR; | ||
} | ||
|
||
/** | ||
* Allows to register Matter factory data after initializing the Matter stack | ||
*/ | ||
CHIP_ERROR NXP::App::AppFactoryData_PostMatterStackInit(void) | ||
{ | ||
#if CONFIG_CHIP_FACTORY_DATA | ||
#if CONFIG_CHIP_ENCRYPTED_FACTORY_DATA | ||
FactoryDataPrvdImpl().SetEncryptionMode(FactoryDataProvider::encrypt_ecb); | ||
FactoryDataPrvdImpl().SetAes128Key(&aes128TestKey[0]); | ||
#endif /* CONFIG_CHIP_ENCRYPTED_FACTORY_DATA */ | ||
ReturnErrorOnFailure(FactoryDataPrvdImpl().Init()); | ||
SetDeviceInstanceInfoProvider(&FactoryDataPrvd()); | ||
SetDeviceAttestationCredentialsProvider(&FactoryDataPrvd()); | ||
SetCommissionableDataProvider(&FactoryDataPrvd()); | ||
#else | ||
SetDeviceInstanceInfoProvider(&DeviceInstanceInfoProviderMgrImpl()); | ||
SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); | ||
#endif /* CONFIG_CHIP_FACTORY_DATA */ | ||
return CHIP_NO_ERROR; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
src/platform/nxp/zephyr/boards/rd_rw612_bga/rd_rw612_bga.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* Copyright (c) 2023-2024 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. | ||
*/ | ||
|
||
&sram { | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
sram_data: memory@20000000 { | ||
compatible = "mmio-sram"; | ||
reg = <0x20000000 DT_SIZE_K(1216)>; | ||
}; | ||
}; | ||
|
||
/delete-node/ &boot_partition; | ||
/delete-node/ &slot0_partition; | ||
/delete-node/ &slot1_partition; | ||
/delete-node/ &fw_storage; | ||
/delete-node/ &storage_partition; | ||
|
||
&flexspi { | ||
status = "okay"; | ||
|
||
mx25u51245g: mx25u51245g@0 { | ||
status = "okay"; | ||
|
||
partitions { | ||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(128)>; | ||
}; | ||
|
||
slot0_partition: partition@20000 { | ||
label = "image-0"; | ||
reg = <0x00020000 0x440000>; | ||
}; | ||
|
||
slot1_partition: partition@460000 { | ||
label = "image-1"; | ||
reg = <0x00460000 0x440000>; | ||
}; | ||
|
||
storage_partition: partition@3FEF000 { | ||
label = "storage"; | ||
reg = <0x03FEF000 DT_SIZE_K(64)>; | ||
}; | ||
|
||
factory_partition: partition@3FFF000 { | ||
label = "factory-data"; | ||
reg = <0x03FFF000 DT_SIZE_K(4)>; | ||
}; | ||
|
||
}; | ||
}; | ||
}; |
Oops, something went wrong.