Skip to content

Commit

Permalink
[QPG] QPG SDK feature updates (#27151)
Browse files Browse the repository at this point in the history
* [QPG] Enable ACL extension attribute for light and lock application

* [QPG] Use FactoryDataProvider to validate vid and pid in otaheader validation

* [QPG] Do not initialize KVS twice; cleanup around OTA requestor init

* [QPG] integrate build of libFactoryData

* [QPG] Update version + fix in DoorLock state after boot

* Restyled by gn

* Move to updated qpg libs

* [QPG] Increase timeout for Matter SDK library

---------

Co-authored-by: Brecht Van Cauwenberghe <brecht.van.cauwenberghe@qorvo.com>
Co-authored-by: lucicop <lucian.copat@qorvo.com>
Co-authored-by: Thomas Langewouters <thomas.langewouters@qorvo.com>
Co-authored-by: Restyled.io <commits@restyled.io>
  • Loading branch information
5 people authored Jun 8, 2023
1 parent a9eefca commit 3d481f3
Show file tree
Hide file tree
Showing 14 changed files with 88 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/examples-qpg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
--copy-artifacts-to out/artifacts \
"
- name: Build Matter SDK library
timeout-minutes: 5
timeout-minutes: 10
run: |
config/qpg/chip-gn/build.sh
Expand Down
2 changes: 2 additions & 0 deletions examples/lighting-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ qpg_executable("lighting_app") {
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
"${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib",
"${chip_root}/third_party/qpg_sdk:qpg_light_factorydata_lib",
"${chip_root}/third_party/qpg_sdk:qpg_light_firmwaredata_lib",
]

if (chip_openthread_ftd) {
Expand Down
4 changes: 2 additions & 2 deletions examples/lighting-app/qpg/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* A uint32_t identifying the software version running on the device.
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0002
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003
#endif

/**
Expand All @@ -53,7 +53,7 @@
* {MAJOR_VERSION}.0d{MINOR_VERSION}
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0"
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1"
#endif
/**
* CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
Expand Down
2 changes: 2 additions & 0 deletions examples/lighting-app/qpg/zap/light.matter
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ server cluster AccessControl = 31 {
}

attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0;
attribute access(read: administer, write: administer) AccessControlExtensionStruct extension[] = 1;
readonly attribute int16u subjectsPerAccessControlEntry = 2;
readonly attribute int16u targetsPerAccessControlEntry = 3;
readonly attribute int16u accessControlEntriesPerFabric = 4;
Expand Down Expand Up @@ -1738,6 +1739,7 @@ endpoint 0 {
emits event AccessControlEntryChanged;
emits event AccessControlExtensionChanged;
callback attribute acl;
callback attribute extension;
callback attribute subjectsPerAccessControlEntry default = 4;
callback attribute targetsPerAccessControlEntry default = 3;
callback attribute accessControlEntriesPerFabric default = 4;
Expand Down
5 changes: 3 additions & 2 deletions examples/lighting-app/qpg/zap/light.zap
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@
"mfgCode": null,
"side": "server",
"type": "array",
"included": 0,
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
Expand Down Expand Up @@ -10281,5 +10281,6 @@
"endpointVersion": 1,
"deviceIdentifier": 269
}
]
],
"log": []
}
2 changes: 2 additions & 0 deletions examples/lock-app/qpg/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ qpg_executable("lock_app") {
"${chip_root}/third_party/openthread/platforms:libopenthread-platform",
"${chip_root}/third_party/openthread/platforms:libopenthread-platform-utils",
"${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata_lib",
"${chip_root}/third_party/qpg_sdk:qpg_lock_factorydata_lib",
"${chip_root}/third_party/qpg_sdk:qpg_lock_firmwaredata_lib",
]

if (chip_openthread_ftd) {
Expand Down
4 changes: 2 additions & 2 deletions examples/lock-app/qpg/include/CHIPProjectConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* A uint32_t identifying the software version running on the device.
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0002
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION 0x0003
#endif

/**
Expand All @@ -53,7 +53,7 @@
* {MAJOR_VERSION}.0d{MINOR_VERSION}
*/
#ifndef CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.0"
#define CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING "1.1"
#endif
/**
* CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
Expand Down
21 changes: 16 additions & 5 deletions examples/lock-app/qpg/src/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -585,13 +585,24 @@ void AppTask::UpdateClusterState(void)
auto newValue = BoltLockMgr().IsUnlocked() ? DoorLock::DlLockState::kUnlocked : DoorLock::DlLockState::kLocked;

SystemLayer().ScheduleLambda([newValue] {
ChipLogProgress(NotSpecified, "UpdateClusterState");
chip::app::DataModel::Nullable<chip::app::Clusters::DoorLock::DlLockState> currentLockState;
chip::app::Clusters::DoorLock::Attributes::LockState::Get(QPG_LOCK_ENDPOINT_ID, currentLockState);

EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue);

if (status != EMBER_ZCL_STATUS_SUCCESS)
if (currentLockState.IsNull())
{
EmberAfStatus status = DoorLock::Attributes::LockState::Set(QPG_LOCK_ENDPOINT_ID, newValue);
if (status != EMBER_ZCL_STATUS_SUCCESS)
{
ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status);
}
}
else
{
ChipLogError(NotSpecified, "ERR: updating DoorLock %x", status);
ChipLogProgress(NotSpecified, "Updating LockState attribute");
if (!DoorLockServer::Instance().SetLockState(QPG_LOCK_ENDPOINT_ID, newValue))
{
ChipLogError(NotSpecified, "ERR: updating DoorLock");
}
}
});
}
Expand Down
2 changes: 2 additions & 0 deletions examples/lock-app/qpg/zap/lock.matter
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ server cluster AccessControl = 31 {
}

attribute access(read: administer, write: administer) AccessControlEntryStruct acl[] = 0;
attribute access(read: administer, write: administer) AccessControlExtensionStruct extension[] = 1;
readonly attribute int16u subjectsPerAccessControlEntry = 2;
readonly attribute int16u targetsPerAccessControlEntry = 3;
readonly attribute int16u accessControlEntriesPerFabric = 4;
Expand Down Expand Up @@ -1872,6 +1873,7 @@ endpoint 0 {
emits event AccessControlEntryChanged;
emits event AccessControlExtensionChanged;
callback attribute acl;
callback attribute extension;
callback attribute subjectsPerAccessControlEntry default = 4;
callback attribute targetsPerAccessControlEntry default = 3;
callback attribute accessControlEntriesPerFabric default = 4;
Expand Down
5 changes: 3 additions & 2 deletions examples/lock-app/qpg/zap/lock.zap
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@
"mfgCode": null,
"side": "server",
"type": "array",
"included": 0,
"included": 1,
"storageOption": "External",
"singleton": 0,
"bounded": 0,
Expand Down Expand Up @@ -9399,5 +9399,6 @@
"endpointVersion": 1,
"deviceIdentifier": 10
}
]
],
"log": []
}
17 changes: 5 additions & 12 deletions examples/platform/qpg/app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ constexpr int extDiscTimeoutSecs = 20;

CHIP_ERROR CHIP_Init(void);

#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
void InitOTARequestorHandler(void)
{
InitializeOTARequestor();
}
#endif

void Application_Init(void)
{
CHIP_ERROR error;
Expand All @@ -96,13 +89,13 @@ void Application_Init(void)
GP_CLEARBOX_TESTING_APPLICATION_INIT_HOOK;
#endif

/* Initialize IO */
qvIO_Init();

#if defined(GP_APP_DIVERSITY_POWERCYCLECOUNTING)
gpAppFramework_Reset_Init();
#endif

/* Initialize IO */
qvIO_Init();

/* Initialize CHIP stack */
error = CHIP_Init();
if (error != CHIP_NO_ERROR)
Expand Down Expand Up @@ -137,7 +130,7 @@ void ChipEventHandler(const ChipDeviceEvent * aEvent, intptr_t /* arg */)
{
case DeviceEventType::kDnssdInitialized:
#if CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR
InitOTARequestorHandler();
InitializeOTARequestor();
#endif
break;
default:
Expand Down Expand Up @@ -199,7 +192,7 @@ CHIP_ERROR CHIP_Init(void)
qvIO_EnableSleep(true);
#elif CHIP_DEVICE_CONFIG_THREAD_FTD
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_Router);
qvIO_EnableSleep(false);
qvIO_EnableSleep(true);
#else
ret = ConnectivityMgr().SetThreadDeviceType(ConnectivityManager::kThreadDeviceType_MinimalEndDevice);
qvIO_EnableSleep(false);
Expand Down
17 changes: 15 additions & 2 deletions examples/platform/qpg/ota/ota.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <app/clusters/ota-requestor/DefaultOTARequestor.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorDriver.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <platform/DeviceInstanceInfoProvider.h>
#include <platform/qpg/OTAImageProcessorImpl.h>

using namespace chip;
Expand All @@ -52,9 +53,21 @@ OTAImageProcessorImpl gImageProcessor;

bool OtaHeaderValidationCb(qvCHIP_Ota_ImageHeader_t imageHeader)
{

uint16_t vendorId = 0;
uint16_t productId = 0;

if (GetDeviceInstanceInfoProvider()->GetVendorId(vendorId) != CHIP_NO_ERROR)
{
return false;
}
if (GetDeviceInstanceInfoProvider()->GetProductId(productId) != CHIP_NO_ERROR)
{
return false;
}

// Check that the image matches vendor and product ID and that the version is higher than what we currently have
if (imageHeader.vendorId != CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID ||
imageHeader.productId != CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID ||
if (imageHeader.vendorId != vendorId || imageHeader.productId != productId ||
imageHeader.softwareVersion <= CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION)
{
return false;
Expand Down
32 changes: 32 additions & 0 deletions third_party/qpg_sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,35 @@ config("qpg_retain_factorydata") {
"-Wl,-u_binary_factory_data_start",
]
}

qpg_make_build("qpg_light_firmwaredata") {
make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FirmwareData_light/libFirmwareData_light.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/FactoryData/Makefile.FirmwareData_light",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/FirmwareData_light",
]
}
static_library("qpg_light_firmwaredata_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_light_firmwaredata" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FirmwareData_light/libFirmwareData_light.a" ]
}

qpg_make_build("qpg_lock_firmwaredata") {
make_sources = [ "${qpg_sdk_root}/Tools/FactoryData" ]
make_output = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FirmwareData_lock/libFirmwareData_lock.a" ]
make_args = [
"-f",
rebase_path(qpg_sdk_root, root_build_dir) +
"/Libraries/Qorvo/FactoryData/Makefile.FirmwareData_lock",
"WORKDIR=" + rebase_path(target_gen_dir, root_build_dir) +
"/${qpg_sdk_lib_dir}/FirmwareData_lock",
]
}
static_library("qpg_lock_firmwaredata_lib") {
deps = [ "${chip_root}/third_party/qpg_sdk:qpg_lock_firmwaredata" ]
libs = [ "${target_gen_dir}/${qpg_sdk_lib_dir}/FirmwareData_lock/libFirmwareData_lock.a" ]
}
2 changes: 1 addition & 1 deletion third_party/qpg_sdk/repo
Submodule repo updated 68 files
+1 −1 Applications/Bootloader/Makefile.UMB_QPG6105DK_B01_nrt_flash_compr_armgccemb
+1 −1 Applications/Bootloader/Makefile.UMB_QPG6105DK_B01_nrt_flash_compr_secure
+1 −1 Applications/Bootloader/gen/UMB_QPG6105DK_B01_nrt_flash_compr_armgccemb/qorvo_config.h
+2 −2 Applications/Bootloader/gen/UMB_QPG6105DK_B01_nrt_flash_compr_armgccemb/qorvo_internals.h
+1 −1 Applications/Bootloader/gen/UMB_QPG6105DK_B01_nrt_flash_compr_secure/qorvo_config.h
+2 −2 Applications/Bootloader/gen/UMB_QPG6105DK_B01_nrt_flash_compr_secure/qorvo_internals.h
+0 −3 Applications/Bootloader/inc/mbedtls_user_config.h
+10 −2 Applications/Matter/base/Makefile.base_qpg6105__uart_rx_development
+10 −2 Applications/Matter/base/Makefile.base_qpg6105_development
+1 −4 Applications/Matter/base/gen/base_qpg6105__uart_rx_development/qorvo_config.h
+3 −3 Applications/Matter/base/gen/base_qpg6105__uart_rx_development/qorvo_internals.h
+1 −4 Applications/Matter/base/gen/base_qpg6105_development/qorvo_config.h
+3 −3 Applications/Matter/base/gen/base_qpg6105_development/qorvo_internals.h
+1 −1 Applications/Matter/shared/config/inc/FreeRTOSConfig.h
+ Binaries/FactoryData/FactoryData_example/FactoryData_example.a
+12 −0 Components/Qorvo/BSP/qvIO/src/qvIO.c
+156 −0 Components/Qorvo/BaseUtils/gpCom/src/gpCom_Rx.c
+39 −1 Components/Qorvo/BaseUtils/gpCom/src/gpCom_defs.h
+66 −0 Components/Qorvo/BaseUtils/gpCom/src/gpCom_serial.c
+71 −6 Components/Qorvo/BaseUtils/gpCom/src/gpCom_serialUART.c
+14 −5 Components/Qorvo/HAL_PLATFORM/halCortexM4/inc/hal_UART.h
+393 −215 Components/Qorvo/HAL_PLATFORM/halCortexM4/k8e/src/hal_UART.c
+1 −3 Components/Qorvo/HAL_PLATFORM/halCortexM4/k8e/src/ivt.c
+0 −8 Components/Qorvo/HAL_RF/gpRadio/src/gpRadio.c
+28 −0 Components/Qorvo/HAL_RF/gphal/inc/gpHal_Ble.h
+0 −3 Components/Qorvo/HAL_RF/gphal/inc/gpHal_RadioMgmt.h
+2 −0 Components/Qorvo/HAL_RF/gphal/inc/gpHal_SEC.h
+0 −3 Components/Qorvo/HAL_RF/gphal/k8e/src/gpHal_TrimVddRamTune.c
+0 −3 Components/Qorvo/HAL_RF/gphal/src/gpHal_RadioMgmt.c
+2 −39 Components/Qorvo/Matter/qvCHIP/src/qvCHIP_KVS.c
+113 −52 Components/Qorvo/Matter/qvCHIP/src/qvCHIP_factorydata.c
+8 −0 Components/Qorvo/OS/gpBaseComps/src/gpBaseComps_StackInit.c
+2 −2 Components/Qorvo/OS/gpFreeRTOS/config/FreeRTOSConfig.h
+54 −64 Components/Qorvo/OpenThread/qvOT/src/radio_qorvo.c
+15 −9 Libraries/Qorvo/FactoryData/Makefile.FactoryData_base
+15 −9 Libraries/Qorvo/FactoryData/Makefile.FactoryData_light_static_pake
+15 −9 Libraries/Qorvo/FactoryData/Makefile.FactoryData_lock_static_pake
+91 −0 Libraries/Qorvo/FactoryData/Makefile.FirmwareData_base
+91 −0 Libraries/Qorvo/FactoryData/Makefile.FirmwareData_light
+91 −0 Libraries/Qorvo/FactoryData/Makefile.FirmwareData_lock
+4 −3 Libraries/Qorvo/MatterQorvoGlue/Makefile.MatterQorvoGlue_qpg6105_libbuild
+1 −4 Libraries/Qorvo/MatterQorvoGlue/gen/MatterQorvoGlue_qpg6105_libbuild/qorvo_config.h
+3 −8 Libraries/Qorvo/MatterQorvoGlue/gen/MatterQorvoGlue_qpg6105_libbuild/qorvo_internals.h
+9 −8 Libraries/Qorvo/OpenThreadQorvoGlue/Makefile.OpenThreadQorvoGlue_qpg6105_ftd
+3 −2 Libraries/Qorvo/OpenThreadQorvoGlue/gen/OpenThreadQorvoGlue_qpg6105_ftd/qorvo_internals.h
+3 −2 Libraries/Qorvo/QorvoStack/Makefile.QorvoStack_qpg6105
+3 −2 Libraries/Qorvo/QorvoStack/Makefile.QorvoStack_qpg6105_uart_rx
+1 −4 Libraries/Qorvo/QorvoStack/gen/QorvoStack_qpg6105/qorvo_config.h
+3 −8 Libraries/Qorvo/QorvoStack/gen/QorvoStack_qpg6105/qorvo_internals.h
+1 −4 Libraries/Qorvo/QorvoStack/gen/QorvoStack_qpg6105_uart_rx/qorvo_config.h
+3 −8 Libraries/Qorvo/QorvoStack/gen/QorvoStack_qpg6105_uart_rx/qorvo_internals.h
+1 −1 Libraries/Qorvo/mbedtls_alt/Makefile.mbedtls_alt_qpg6105
+2 −2 Libraries/Qorvo/mbedtls_alt/gen/mbedtls_alt_qpg6105/qorvo_internals.h
+20 −23 Libraries/Qorvo/mbedtls_alt/inc/common-mbedtls-config.h
+24 −1 Libraries/Qorvo/mbedtls_alt/inc/qpg6105-mbedtls-config.h
+1 −1 Scripts/git_add_submodules.sh
+0 −1 Tools/FactoryData/Credentials/qorvo_base.factory_data_config
+1 −0 Tools/FactoryData/Credentials/qorvo_base.firmware_data_config
+0 −1 Tools/FactoryData/Credentials/test_base.factory_data_config
+1 −0 Tools/FactoryData/Credentials/test_base.firmware_data_config
+16 −0 Tools/FactoryData/Credentials/test_light.factory_data_config
+1 −0 Tools/FactoryData/Credentials/test_light.firmware_data_config
+1 −17 Tools/FactoryData/Credentials/test_light_static_pake.factory_data_config
+16 −0 Tools/FactoryData/Credentials/test_lock.factory_data_config
+1 −0 Tools/FactoryData/Credentials/test_lock.firmware_data_config
+1 −17 Tools/FactoryData/Credentials/test_lock_static_pake.factory_data_config
+23 −7 Tools/FactoryData/generate_factory_data.py
+22 −10 Tools/MemoryOverview/memoryoverview.py

0 comments on commit 3d481f3

Please sign in to comment.