diff --git a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn index fe6c006de15aeb..2636803899e2ab 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/lock-app/cc13x2x7_26x2x7/BUILD.gn @@ -43,7 +43,6 @@ ti_sysconfig("sysconfig") { sources = [ "${project_dir}/chip.syscfg" ] outputs = [ - "ti_devices_config.c", "ti_radio_config.c", "ti_radio_config.h", "ti_drivers_config.c", @@ -111,17 +110,6 @@ ti_simplelink_executable("lock_app") { "-Wconversion", ] - ldscript = "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/cc13x2x7_cc26x2x7.lds" - - inputs = [ ldscript ] - - ldflags = [ - "-L${ti_simplelink_sdk_root}/source", - rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_linker.cmd.genlibs", - root_build_dir), - "-T" + rebase_path(ldscript, root_build_dir), - ] - output_dir = root_out_dir } diff --git a/examples/lock-app/cc13x2x7_26x2x7/args.gni b/examples/lock-app/cc13x2x7_26x2x7/args.gni index 5b402aef6a410b..6abffce95b189d 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/args.gni +++ b/examples/lock-app/cc13x2x7_26x2x7/args.gni @@ -23,7 +23,9 @@ ti_simplelink_board = "LP_CC2652R7" # Size Optimizations # use -Os instead of -Og, LWIP release build -#is_debug = false +is_debug = false + +chip_enable_ota_requestor = true # Disable CHIP Logging #chip_progress_logging = false diff --git a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg b/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg index f195ca15ec32d7..b5153bf099c450 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg +++ b/examples/lock-app/cc13x2x7_26x2x7/chip.syscfg @@ -45,6 +45,7 @@ var Button1 = Button.addInstance(); var Button2 = Button.addInstance(); var ECJPAKE = ECJPAKE.addInstance(); var NVS1 = NVS.addInstance(); +var NVS2 = NVS.addInstance(); var SHA21 = SHA2.addInstance(); var LED1 = LED.addInstance(); var LED2 = LED.addInstance(); @@ -84,23 +85,24 @@ Button2.gpioPin.interruptTrigger = "Falling Edge"; /* ======== CCFG ======== */ var CCFG = scripting.addModule("/ti/devices/CCFG"); -const deviceName = system.getScript("/ti/ti154stack/ti154stack_common.js").getLaunchPadFromDevice(); const ccfgSettings = system.getScript("/ti/common/lprf_ccfg_settings.js").ccfgSettings; for(var setting in ccfgSettings) { CCFG[setting] = ccfgSettings[setting]; } -// Update LF Clock Source for CC2652RB devices -if(deviceName.includes("RB")) -{ - CCFG.srcClkLF = "Derived from HF XOSC"; -} +// Disable CCFG generation, this is added by the BIM project +CCFG.enableCodeGeneration = false; + /* NVS */ NVS1.$name = "CONFIG_NVSINTERNAL"; NVS1.internalFlash.regionBase = 0xAA000; NVS1.internalFlash.regionSize = 0x4000; +NVS2.$name = "CONFIG_NVSEXTERNAL"; +NVS2.nvsType = "External"; // NVS Region Type +NVS2.$hardware = system.deviceData.board.components.MX25R8035F; + /* RF */ /* if an antenna component exists, assign it to the rf instance */ if (system.deviceData.board && system.deviceData.board.components.RF) { diff --git a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp index 8649f916b3ebb1..6e9ce8e4e4f8b4 100644 --- a/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp +++ b/examples/lock-app/cc13x2x7_26x2x7/main/AppTask.cpp @@ -27,9 +27,14 @@ #include #include +#include + +#include +#include #include #include -#include +#include +#include #include @@ -43,6 +48,7 @@ #define APP_TASK_PRIORITY 4 #define APP_EVENT_QUEUE_SIZE 10 +using namespace ::chip; using namespace ::chip::Credentials; using namespace ::chip::DeviceLayer; @@ -56,6 +62,22 @@ static Button_Handle sAppRightHandle; AppTask AppTask::sAppTask; +static OTARequestor sRequestorCore; +static GenericOTARequestorDriver sRequestorUser; +static BDXDownloader sDownloader; +static OTAImageProcessorImpl sImageProcessor; + +void InitializeOTARequestor(void) +{ + // Initialize and interconnect the Requestor and Image Processor objects + SetRequestorInstance(&sRequestorCore); + + sRequestorCore.Init(&Server::GetInstance(), &sRequestorUser, &sDownloader); + sImageProcessor.SetOTADownloader(&sDownloader); + sDownloader.SetImageProcessorDelegate(&sImageProcessor); + sRequestorUser.Init(&sRequestorCore, &sImageProcessor); +} + int AppTask::StartAppTask() { int ret = 0; @@ -87,7 +109,7 @@ int AppTask::Init() cc13x2_26x2LogInit(); // Init Chip memory management before the stack - chip::Platform::MemoryInit(); + Platform::MemoryInit(); CHIP_ERROR ret = PlatformMgr().InitChipStack(); if (ret != CHIP_NO_ERROR) @@ -131,7 +153,7 @@ int AppTask::Init() // Init ZCL Data Model and start server PLAT_LOG("Initialize Server"); - chip::Server::GetInstance().Init(); + Server::GetInstance().Init(); // Initialize device attestation config SetDeviceAttestationCredentialsProvider(Examples::GetExampleDACProvider()); @@ -172,8 +194,10 @@ int AppTask::Init() ConfigurationMgr().LogDeviceConfig(); + InitializeOTARequestor(); + // QR code will be used with CHIP Tool - PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE)); + PrintOnboardingCodes(RendezvousInformationFlags(RendezvousInformationFlag::kBLE)); return 0; } @@ -322,7 +346,7 @@ void AppTask::DispatchEvent(AppEvent * aEvent) // Enable BLE advertisements if (!ConnectivityMgr().IsBLEAdvertisingEnabled()) { - if (chip::Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) + if (Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow() == CHIP_NO_ERROR) { PLAT_LOG("Enabled BLE Advertisement"); } diff --git a/examples/lock-app/esp32/main/CMakeLists.txt b/examples/lock-app/esp32/main/CMakeLists.txt index 984b0d761f78f7..ffa3db3ff25571 100644 --- a/examples/lock-app/esp32/main/CMakeLists.txt +++ b/examples/lock-app/esp32/main/CMakeLists.txt @@ -48,11 +48,13 @@ idf_component_register(INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning-old" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/diagnostic-logs-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ethernet-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/thread-network-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/wifi-network-diagnostics-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/software-diagnostics-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/switch-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-diagnostics-server" @@ -154,6 +156,7 @@ idf_component_register(PRIV_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning-old" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/on-off-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/operational-credentials-server" + "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/ota-requestor" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-configuration-server" "${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/power-source-server" diff --git a/examples/lock-app/lock-common/BUILD.gn b/examples/lock-app/lock-common/BUILD.gn old mode 100644 new mode 100755 diff --git a/examples/lock-app/lock-common/lock-app.matter b/examples/lock-app/lock-common/lock-app.matter index 5bd41d87d3402f..da2d5a30c59483 100644 --- a/examples/lock-app/lock-common/lock-app.matter +++ b/examples/lock-app/lock-common/lock-app.matter @@ -209,6 +209,8 @@ server cluster EthernetNetworkDiagnostics = 55 { readonly attribute int64u timeSinceReset = 8; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + + command ResetCounts(): DefaultSuccess = 0; } server cluster FixedLabel = 64 { @@ -494,6 +496,140 @@ server cluster NetworkCommissioning = 49 { command ScanNetworks(ScanNetworksRequest): ScanNetworksResponse = 0; } +client cluster OtaSoftwareUpdateProvider = 41 { + enum OTAApplyUpdateAction : ENUM8 { + kProceed = 0; + kAwaitNextAction = 1; + kDiscontinue = 2; + } + + enum OTADownloadProtocol : ENUM8 { + kBDXSynchronous = 0; + kBDXAsynchronous = 1; + kHttps = 2; + kVendorSpecific = 3; + } + + enum OTAQueryStatus : ENUM8 { + kUpdateAvailable = 0; + kBusy = 1; + kNotAvailable = 2; + kDownloadProtocolNotSupported = 3; + } + + readonly global attribute int16u clusterRevision = 65533; + + request struct ApplyUpdateRequestRequest { + OCTET_STRING updateToken = 0; + INT32U newVersion = 1; + } + + request struct NotifyUpdateAppliedRequest { + OCTET_STRING updateToken = 0; + INT32U softwareVersion = 1; + } + + request struct QueryImageRequest { + vendor_id vendorId = 0; + INT16U productId = 1; + INT32U softwareVersion = 2; + OTADownloadProtocol protocolsSupported[] = 3; + optional INT16U hardwareVersion = 4; + optional CHAR_STRING location = 5; + optional BOOLEAN requestorCanConsent = 6; + optional OCTET_STRING metadataForProvider = 7; + } + + response struct ApplyUpdateResponse { + OTAApplyUpdateAction action = 0; + INT32U delayedActionTime = 1; + } + + response struct QueryImageResponse { + OTAQueryStatus status = 0; + optional INT32U delayedActionTime = 1; + optional CHAR_STRING imageURI = 2; + optional INT32U softwareVersion = 3; + optional CHAR_STRING softwareVersionString = 4; + optional OCTET_STRING updateToken = 5; + optional BOOLEAN userConsentNeeded = 6; + optional OCTET_STRING metadataForRequestor = 7; + } + + command ApplyUpdateRequest(ApplyUpdateRequestRequest): ApplyUpdateResponse = 2; + command NotifyUpdateApplied(NotifyUpdateAppliedRequest): DefaultSuccess = 4; + command QueryImage(QueryImageRequest): QueryImageResponse = 0; +} + +server cluster OtaSoftwareUpdateRequestor = 42 { + enum OTAAnnouncementReason : ENUM8 { + kSimpleAnnouncement = 0; + kUpdateAvailable = 1; + kUrgentUpdateAvailable = 2; + } + + enum OTAChangeReasonEnum : ENUM8 { + kUnknown = 0; + kSuccess = 1; + kFailure = 2; + kTimeOut = 3; + kDelayByProvider = 4; + } + + enum OTAUpdateStateEnum : ENUM8 { + kUnknown = 0; + kIdle = 1; + kQuerying = 2; + kDelayedOnQuery = 3; + kDownloading = 4; + kApplying = 5; + kDelayedOnApply = 6; + kRollingBack = 7; + kDelayedOnUserConsent = 8; + } + + struct ProviderLocation { + fabric_idx fabricIndex = 0; + node_id providerNodeID = 1; + endpoint_no endpoint = 2; + } + + info event StateTransition = 0 { + nullable OTAUpdateStateEnum previousState = 0; + OTAUpdateStateEnum newState = 1; + OTAChangeReasonEnum reason = 2; + nullable INT32U targetSoftwareVersion = 3; + } + + critical event VersionApplied = 1 { + INT32U softwareVersion = 0; + INT16U productID = 1; + } + + info event DownloadError = 2 { + INT32U softwareVersion = 0; + INT64U bytesDownloaded = 1; + nullable INT8U progressPercent = 2; + nullable INT64S platformCode = 3; + } + + attribute ProviderLocation defaultOtaProviders[] = 0; + readonly attribute boolean updatePossible = 1; + readonly attribute OTAUpdateStateEnum updateState = 2; + readonly attribute nullable int8u updateStateProgress = 3; + readonly global attribute int16u clusterRevision = 65533; + + request struct AnnounceOtaProviderRequest { + node_id providerNodeId = 0; + vendor_id vendorId = 1; + OTAAnnouncementReason announcementReason = 2; + optional OCTET_STRING metadataForNode = 3; + endpoint_no endpoint = 4; + } + + command AnnounceOtaProvider(AnnounceOtaProviderRequest): DefaultSuccess = 0; +} + server cluster OnOff = 6 { enum OnOffDelayedAllOffEffectVariant : enum8 { kFadeToOffIn0p8Seconds = 0; @@ -738,6 +874,8 @@ server cluster SoftwareDiagnostics = 52 { readonly attribute int64u currentHeapHighWatermark = 3; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + + command ResetWatermarks(): DefaultSuccess = 0; } server cluster ThreadNetworkDiagnostics = 53 { @@ -889,6 +1027,8 @@ server cluster ThreadNetworkDiagnostics = 53 { readonly attribute NetworkFault activeNetworkFaultsList[] = 62; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + + command ResetCounts(): DefaultSuccess = 0; } server cluster TimeFormatLocalization = 44 { @@ -982,6 +1122,8 @@ server cluster WiFiNetworkDiagnostics = 54 { readonly attribute int64u overrunCount = 12; readonly global attribute bitmap32 featureMap = 65532; readonly global attribute int16u clusterRevision = 65533; + + command ResetCounts(): DefaultSuccess = 0; } @@ -997,6 +1139,8 @@ endpoint 0 { server cluster GeneralDiagnostics; server cluster LocalizationConfiguration; server cluster NetworkCommissioning; + binding cluster OtaSoftwareUpdateProvider; + server cluster OtaSoftwareUpdateRequestor; server cluster OperationalCredentials; server cluster PowerSource; server cluster PowerSourceConfiguration; diff --git a/examples/lock-app/lock-common/lock-app.zap b/examples/lock-app/lock-common/lock-app.zap old mode 100644 new mode 100755 index 17158ab1a732b2..c5c8df700c8c2f --- a/examples/lock-app/lock-common/lock-app.zap +++ b/examples/lock-app/lock-common/lock-app.zap @@ -1360,6 +1360,281 @@ } ] }, + { + "name": "OTA Software Update Provider", + "code": 41, + "mfgCode": null, + "define": "OTA_PROVIDER_CLUSTER", + "side": "client", + "enabled": 1, + "commands": [ + { + "name": "QueryImage", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "ApplyUpdateRequest", + "code": 2, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + }, + { + "name": "NotifyUpdateApplied", + "code": 4, + "mfgCode": null, + "source": "client", + "incoming": 0, + "outgoing": 1 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "OTA Software Update Provider", + "code": 41, + "mfgCode": null, + "define": "OTA_PROVIDER_CLUSTER", + "side": "server", + "enabled": 0, + "commands": [ + { + "name": "QueryImageResponse", + "code": 1, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + }, + { + "name": "ApplyUpdateResponse", + "code": 3, + "mfgCode": null, + "source": "server", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 0, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0x0001", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "OTA Software Update Requestor", + "code": 42, + "mfgCode": null, + "define": "OTA_REQUESTOR_CLUSTER", + "side": "client", + "enabled": 0, + "commands": [ + { + "name": "AnnounceOtaProvider", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], + "attributes": [ + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "client", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, + { + "name": "OTA Software Update Requestor", + "code": 42, + "mfgCode": null, + "define": "OTA_REQUESTOR_CLUSTER", + "side": "server", + "enabled": 1, + "commands": [], + "attributes": [ + { + "name": "DefaultOtaProviders", + "code": 0, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "External", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "UpdatePossible", + "code": 1, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateState", + "code": 2, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + }, + { + "name": "UpdateStateProgress", + "code": 3, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "AttributeList", + "code": 65531, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "FeatureMap", + "code": 65532, + "mfgCode": null, + "side": "server", + "included": 0, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "0", + "reportable": 1, + "minInterval": 1, + "maxInterval": 65534, + "reportableChange": 0 + }, + { + "name": "ClusterRevision", + "code": 65533, + "mfgCode": null, + "side": "server", + "included": 1, + "storageOption": "RAM", + "singleton": 0, + "bounded": 0, + "defaultValue": "1", + "reportable": 1, + "minInterval": 0, + "maxInterval": 65344, + "reportableChange": 0 + } + ] + }, { "name": "Localization Configuration", "code": 43, @@ -2377,7 +2652,7 @@ "code": 0, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 1 } ], @@ -2507,7 +2782,16 @@ "define": "THREAD_NETWORK_DIAGNOSTICS_CLUSTER", "side": "client", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { "name": "ClusterRevision", @@ -3519,7 +3803,16 @@ "define": "WIFI_NETWORK_DIAGNOSTICS_CLUSTER", "side": "client", "enabled": 0, - "commands": [], + "commands": [ + { + "name": "ResetCounts", + "code": 0, + "mfgCode": null, + "source": "client", + "incoming": 1, + "outgoing": 0 + } + ], "attributes": [ { "name": "ClusterRevision", @@ -3787,7 +4080,7 @@ "code": 0, "mfgCode": null, "source": "client", - "incoming": 0, + "incoming": 1, "outgoing": 1 } ], @@ -6253,4 +6546,4 @@ "deviceIdentifier": 10 } ] -} \ No newline at end of file +} diff --git a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn b/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn index 26088b371f4386..ea0acea00155be 100644 --- a/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/persistent-storage/cc13x2x7_26x2x7/BUILD.gn @@ -82,15 +82,6 @@ ti_simplelink_executable("persistent_storage") { "-Wconversion", ] - ldscript = "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/cc13x2x7_cc26x2x7.lds" - - inputs = [ ldscript ] - - ldflags = [ - "-L${ti_simplelink_sdk_root}/source", - "-T" + rebase_path(ldscript, root_build_dir), - ] - output_dir = root_out_dir } diff --git a/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn b/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn index d623d0f5c3c996..63cd58da9dace1 100644 --- a/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/pump-app/cc13x2x7_26x2x7/BUILD.gn @@ -110,17 +110,6 @@ ti_simplelink_executable("pump_app") { "-Wconversion", ] - ldscript = "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/cc13x2x7_cc26x2x7.lds" - - inputs = [ ldscript ] - - ldflags = [ - "-L${ti_simplelink_sdk_root}/source", - rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_linker.cmd.genlibs", - root_build_dir), - "-T" + rebase_path(ldscript, root_build_dir), - ] - output_dir = root_out_dir } diff --git a/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn b/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn index 445fddb705eaa2..fedefd4dcb5d5d 100644 --- a/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn +++ b/examples/pump-controller-app/cc13x2x7_26x2x7/BUILD.gn @@ -111,17 +111,6 @@ ti_simplelink_executable("pump_controller_app") { "-Wconversion", ] - ldscript = "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/cc13x2x7_cc26x2x7.lds" - - inputs = [ ldscript ] - - ldflags = [ - "-L${ti_simplelink_sdk_root}/source", - rebase_path("${target_gen_dir}/sysconfig/ti_utils_build_linker.cmd.genlibs", - root_build_dir), - "-T" + rebase_path(ldscript, root_build_dir), - ] - output_dir = root_out_dir } diff --git a/src/platform/cc13x2_26x2/BUILD.gn b/src/platform/cc13x2_26x2/BUILD.gn index e77d1e99170467..d110cb240eb81b 100644 --- a/src/platform/cc13x2_26x2/BUILD.gn +++ b/src/platform/cc13x2_26x2/BUILD.gn @@ -63,6 +63,16 @@ static_library("cc13x2_26x2") { ] } + if (chip_enable_ota_requestor) { + sources += [ + # this needs to be in the final link to place the data correctly + # see ${chip_root}/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni + #"oad_image_header.c", + "OTAImageProcessorImpl.cpp", + "OTAImageProcessorImpl.h", + ] + } + if (chip_enable_openthread) { # needed for MTD/FTD import("//build_overrides/ti_simplelink_sdk.gni") diff --git a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h index e22eef5189a422..e86c92a2183dff 100644 --- a/src/platform/cc13x2_26x2/CHIPPlatformConfig.h +++ b/src/platform/cc13x2_26x2/CHIPPlatformConfig.h @@ -30,7 +30,7 @@ // ==================== General Platform Adaptations ==================== -#define CHIP_CONFIG_ABORT() assert() +#define CHIP_CONFIG_ABORT() abort() #define CHIP_CONFIG_PERSISTED_STORAGE_KEY_TYPE uint16_t #define CHIP_CONFIG_PERSISTED_STORAGE_ENC_MSG_CNTR_ID 1 diff --git a/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp new file mode 100644 index 00000000000000..d05c949ea62fb7 --- /dev/null +++ b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.cpp @@ -0,0 +1,437 @@ +/* + * + * Copyright (c) 2021 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 +#include + +#include "OTAImageProcessorImpl.h" + +#include +#include + +#include + +// clang-format off +/* driverlib header for resetting the SoC */ +#include +#include DeviceFamily_constructPath(driverlib/sys_ctrl.h) +// clang-format on + +namespace chip { + +CHIP_ERROR OTAImageProcessorImpl::PrepareDownload() +{ + DeviceLayer::PlatformMgr().ScheduleWork(HandlePrepareDownload, reinterpret_cast(this)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAImageProcessorImpl::Finalize() +{ + DeviceLayer::PlatformMgr().ScheduleWork(HandleFinalize, reinterpret_cast(this)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAImageProcessorImpl::Apply() +{ + DeviceLayer::PlatformMgr().ScheduleWork(HandleApply, reinterpret_cast(this)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAImageProcessorImpl::Abort() +{ + DeviceLayer::PlatformMgr().ScheduleWork(HandleAbort, reinterpret_cast(this)); + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAImageProcessorImpl::ProcessBlock(ByteSpan & block) +{ + if (nullptr == mNvsHandle) + { + return CHIP_ERROR_INTERNAL; + } + + if ((nullptr == block.data()) || block.empty()) + { + return CHIP_ERROR_INVALID_ARGUMENT; + } + + // Store block data for HandleProcessBlock to access + CHIP_ERROR err = SetBlock(block); + if (err != CHIP_NO_ERROR) + { + ChipLogError(SoftwareUpdate, "Cannot set block data: %" CHIP_ERROR_FORMAT, err.Format()); + } + + DeviceLayer::PlatformMgr().ScheduleWork(HandleProcessBlock, reinterpret_cast(this)); + return CHIP_NO_ERROR; +} + +/* DESIGN NOTE: The Boot Image Manager will search external flash for an + * `ExtImageInfo_t` structure every 4K for 1M. This structure points to where + * the executable image is in external flash with a uint32_t. It is possible to + * have multiple images ready to be programmed into the internal flash of the + * device. This design is only concerned with managing 1 image in external + * flash starting at `IMG_START` and being defined by a meta header at address + * 0. Future designs may be able to take advantage of other images for rollback + * functionality, however this will require a larger external flash chip. + */ + +#define IMG_START (4 * EFL_SIZE_META) + +static bool readExtFlashImgHeader(NVS_Handle handle, imgFixedHdr_t * header) +{ + int_fast16_t status; + status = NVS_read(handle, IMG_START, header, sizeof(header)); + return (status == NVS_STATUS_SUCCESS); +} + +static bool eraseExtFlashHeader(NVS_Handle handle) +{ + int_fast16_t status; + NVS_Attrs regionAttrs; + unsigned int sectors; + + NVS_getAttrs(handle, ®ionAttrs); + /* calculate the number of sectors to erase */ + sectors = (sizeof(imgFixedHdr_t) + (regionAttrs.sectorSize - 1)) / regionAttrs.sectorSize; + status = NVS_erase(handle, IMG_START, sectors * regionAttrs.sectorSize); + + return (status == NVS_STATUS_SUCCESS); +} + +/* makes room for the new block if needed */ +static bool writeExtFlashImgPages(NVS_Handle handle, size_t bytesWritten, MutableByteSpan block) +{ + int_fast16_t status; + NVS_Attrs regionAttrs; + unsigned int erasedSectors; + unsigned int neededSectors; + size_t sectorSize; + + NVS_getAttrs(handle, ®ionAttrs); + sectorSize = regionAttrs.sectorSize; + erasedSectors = (bytesWritten + (sectorSize - 1)) / sectorSize; + neededSectors = ((bytesWritten + block.size()) + (sectorSize - 1)) / sectorSize; + if (neededSectors != erasedSectors) + { + status = NVS_erase(handle, IMG_START + (erasedSectors * sectorSize), (neededSectors - erasedSectors) * sectorSize); + if (status != NVS_STATUS_SUCCESS) + { + return false; + } + } + status = NVS_write(handle, IMG_START + bytesWritten, block.data(), block.size(), NVS_WRITE_POST_VERIFY); + return (status == NVS_STATUS_SUCCESS); +} + +static bool readExtFlashMetaHeader(NVS_Handle handle, ExtImageInfo_t * header) +{ + int_fast16_t status; + status = NVS_read(handle, EFL_ADDR_META, header, sizeof(header)); + return (status == NVS_STATUS_SUCCESS); +} + +static bool eraseExtFlashMetaHeader(NVS_Handle handle) +{ + int_fast16_t status; + NVS_Attrs regionAttrs; + unsigned int sectors; + + NVS_getAttrs(handle, ®ionAttrs); + /* calculate the number of sectors to erase */ + sectors = (sizeof(ExtImageInfo_t) + (regionAttrs.sectorSize - 1)) / regionAttrs.sectorSize; + status = NVS_erase(handle, EFL_ADDR_META, sectors * regionAttrs.sectorSize); + + return (status == NVS_STATUS_SUCCESS); +} + +static bool writeExtFlashMetaHeader(NVS_Handle handle, ExtImageInfo_t * header) +{ + int_fast16_t status; + if (!eraseExtFlashMetaHeader(handle)) + { + return false; + } + status = NVS_write(handle, EFL_ADDR_META, header, sizeof(header), NVS_WRITE_POST_VERIFY); + return (status == NVS_STATUS_SUCCESS); +} + +/** + * Generated on by pycrc v0.9.2, https://pycrc.org using the configuration: + * - Width = 32 + * - Poly = 0x04c11db7 + * - XorIn = 0xffffffff + * - ReflectIn = True + * - XorOut = 0xffffffff + * - ReflectOut = True + * - Algorithm = bit-by-bit-fast + * + * Modified to take uint32_t as the CRC type + */ +uint32_t crc_reflect(uint32_t data, size_t data_len) +{ + unsigned int i; + uint32_t ret; + + ret = data & 0x01; + for (i = 1; i < data_len; i++) + { + data >>= 1; + ret = (ret << 1) | (data & 0x01); + } + return ret; +} + +uint32_t crc_update(uint32_t crc, const void * data, size_t data_len) +{ + const unsigned char * d = (const unsigned char *) data; + unsigned int i; + bool bit; + unsigned char c; + + while (data_len--) + { + c = *d++; + for (i = 0x01; i & 0xff; i <<= 1) + { + bit = crc & 0x80000000; + if (c & i) + { + bit = !bit; + } + crc <<= 1; + if (bit) + { + crc ^= 0x04c11db7; + } + } + crc &= 0xffffffff; + } + return crc & 0xffffffff; +} + +static bool validateExtFlashImage(NVS_Handle handle) +{ + uint32_t crc; + imgFixedHdr_t header; + size_t addr, endAddr; + + if (!readExtFlashImgHeader(handle, &header)) + { + return false; + } + + /* CRC is calculated after the CRC element of the image header */ + addr = IMG_START + IMG_DATA_OFFSET; + endAddr = IMG_START + header.len; + + crc = 0xFFFFFFFF; + + while (addr < endAddr) + { + uint8_t buffer[32]; + size_t bytesLeft = endAddr - addr; + size_t toRead = (sizeof(buffer) < bytesLeft) ? sizeof(buffer) : bytesLeft; + + if (NVS_STATUS_SUCCESS != NVS_read(handle, addr, buffer, toRead)) + { + return false; + } + + crc = crc_update(crc, buffer, toRead); + + addr += toRead; + } + + crc = crc_reflect(crc, 32) ^ 0xffffffff; + + return (crc == header.crc32); +} + +void OTAImageProcessorImpl::HandlePrepareDownload(intptr_t context) +{ + NVS_Params nvsParams; + NVS_Handle handle; + auto * imageProcessor = reinterpret_cast(context); + if (imageProcessor == nullptr) + { + ChipLogError(SoftwareUpdate, "ImageProcessor context is null"); + return; + } + else if (imageProcessor->mDownloader == nullptr) + { + ChipLogError(SoftwareUpdate, "mDownloader is null"); + return; + } + + NVS_Params_init(&nvsParams); + handle = NVS_open(CONFIG_NVSEXTERNAL, &nvsParams); + if (NULL == handle) + { + imageProcessor->mDownloader->OnPreparedForDownload(CHIP_ERROR_OPEN_FAILED); + return; + } + + if (!eraseExtFlashMetaHeader(handle)) + { + NVS_close(handle); + imageProcessor->mDownloader->OnPreparedForDownload(CHIP_ERROR_WRITE_FAILED); + return; + } + + imageProcessor->mNvsHandle = handle; + imageProcessor->mDownloader->OnPreparedForDownload(CHIP_NO_ERROR); +} + +void OTAImageProcessorImpl::HandleFinalize(intptr_t context) +{ + ExtImageInfo_t header; + auto * imageProcessor = reinterpret_cast(context); + if (imageProcessor == nullptr) + { + return; + } + + if (!readExtFlashImgHeader(imageProcessor->mNvsHandle, &(header.fixedHdr))) + { + return; + } + header.extFlAddr = IMG_START; + header.counter = 0x0; + + if (validateExtFlashImage(imageProcessor->mNvsHandle)) + { + // only write the meta header if the crc check passes + writeExtFlashMetaHeader(imageProcessor->mNvsHandle, &header); + } + else + { + // ensure the external image is not mistaken for a valid image + eraseExtFlashMetaHeader(imageProcessor->mNvsHandle); + } + + imageProcessor->ReleaseBlock(); + + ChipLogProgress(SoftwareUpdate, "OTA image downloaded"); +} + +void OTAImageProcessorImpl::HandleApply(intptr_t context) +{ + ExtImageInfo_t header; + auto * imageProcessor = reinterpret_cast(context); + if (imageProcessor == nullptr) + { + return; + } + + if (!readExtFlashMetaHeader(imageProcessor->mNvsHandle, &header)) + { + return; + } + header.fixedHdr.imgCpStat = NEED_COPY; + + writeExtFlashMetaHeader(imageProcessor->mNvsHandle, &header); + + // reset SoC to kick BIM + SysCtrlSystemReset(); +} + +void OTAImageProcessorImpl::HandleAbort(intptr_t context) +{ + auto * imageProcessor = reinterpret_cast(context); + if (imageProcessor == nullptr) + { + return; + } + + if (!eraseExtFlashMetaHeader(imageProcessor->mNvsHandle)) + { + imageProcessor->mDownloader->OnPreparedForDownload(CHIP_ERROR_WRITE_FAILED); + } + + NVS_close(imageProcessor->mNvsHandle); + imageProcessor->ReleaseBlock(); +} + +void OTAImageProcessorImpl::HandleProcessBlock(intptr_t context) +{ + auto * imageProcessor = reinterpret_cast(context); + if (imageProcessor == nullptr) + { + ChipLogError(SoftwareUpdate, "ImageProcessor context is null"); + return; + } + else if (imageProcessor->mDownloader == nullptr) + { + ChipLogError(SoftwareUpdate, "mDownloader is null"); + return; + } + + // TODO: Process block header if any + + if (!writeExtFlashImgPages(imageProcessor->mNvsHandle, imageProcessor->mParams.downloadedBytes, imageProcessor->mBlock)) + { + imageProcessor->mDownloader->EndDownload(CHIP_ERROR_WRITE_FAILED); + return; + } + + imageProcessor->mParams.downloadedBytes += imageProcessor->mBlock.size(); + imageProcessor->mDownloader->FetchNextData(); +} + +CHIP_ERROR OTAImageProcessorImpl::SetBlock(ByteSpan & block) +{ + if (!IsSpanUsable(block)) + { + ReleaseBlock(); + return CHIP_NO_ERROR; + } + if (mBlock.size() < block.size()) + { + if (!mBlock.empty()) + { + ReleaseBlock(); + } + uint8_t * mBlock_ptr = static_cast(chip::Platform::MemoryAlloc(block.size())); + if (mBlock_ptr == nullptr) + { + return CHIP_ERROR_NO_MEMORY; + } + mBlock = MutableByteSpan(mBlock_ptr, block.size()); + } + CHIP_ERROR err = CopySpanToMutableSpan(block, mBlock); + if (err != CHIP_NO_ERROR) + { + ChipLogError(SoftwareUpdate, "Cannot copy block data: %" CHIP_ERROR_FORMAT, err.Format()); + return err; + } + return CHIP_NO_ERROR; +} + +CHIP_ERROR OTAImageProcessorImpl::ReleaseBlock() +{ + if (mBlock.data() != nullptr) + { + chip::Platform::MemoryFree(mBlock.data()); + } + + mBlock = MutableByteSpan(); + return CHIP_NO_ERROR; +} + +} // namespace chip diff --git a/src/platform/cc13x2_26x2/OTAImageProcessorImpl.h b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.h new file mode 100644 index 00000000000000..8471d753ca3ff6 --- /dev/null +++ b/src/platform/cc13x2_26x2/OTAImageProcessorImpl.h @@ -0,0 +1,65 @@ +/* + * + * Copyright (c) 2021 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 +#include +#include + +#include + +namespace chip { + +class OTAImageProcessorImpl : public OTAImageProcessorInterface +{ +public: + //////////// OTAImageProcessorInterface Implementation /////////////// + CHIP_ERROR PrepareDownload() override; + CHIP_ERROR Finalize() override; + CHIP_ERROR Apply() override; + CHIP_ERROR Abort() override; + CHIP_ERROR ProcessBlock(ByteSpan & block) override; + + void SetOTADownloader(OTADownloader * downloader) { mDownloader = downloader; } + +private: + //////////// Actual handlers for the OTAImageProcessorInterface /////////////// + static void HandlePrepareDownload(intptr_t context); + static void HandleFinalize(intptr_t context); + static void HandleApply(intptr_t context); + static void HandleAbort(intptr_t context); + static void HandleProcessBlock(intptr_t context); + + /** + * Called to allocate memory for mBlock if necessary and set it to block + */ + CHIP_ERROR SetBlock(ByteSpan & block); + + /** + * Called to release allocated memory for mBlock + */ + CHIP_ERROR ReleaseBlock(); + + NVS_Handle mNvsHandle; + uint16_t mMetaPage; + MutableByteSpan mBlock; + OTADownloader * mDownloader; +}; + +} // namespace chip diff --git a/src/platform/cc13x2_26x2/cc13x2x7_cc26x2x7_freertos_ota.lds b/src/platform/cc13x2_26x2/cc13x2x7_cc26x2x7_freertos_ota.lds new file mode 100644 index 00000000000000..d470eea96a1888 --- /dev/null +++ b/src/platform/cc13x2_26x2/cc13x2x7_cc26x2x7_freertos_ota.lds @@ -0,0 +1,282 @@ +/* + * + * Copyright (c) 2022 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * + * 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. + */ + +/** + * @file + * Linkerscript for Matter executable with space reserved for the TI BIM. + */ + +STACKSIZE = 0x800; + +MEMORY +{ + /* last page removed for BIM, CCFG is supplied by that project */ + /* FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x000affa8 */ + /* FLASH_CCFG (RX) : ORIGIN = 0x000affa8, LENGTH = 0x00000058 */ + FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x000ae000 + /* BLE ROM reserves RAM at the beginning of the ram image */ + /* SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00024000 */ + SRAM (RWX) : ORIGIN = 0x20000fdf, LENGTH = 0x00023021 + GPRAM (RWX) : ORIGIN = 0x11000000, LENGTH = 0x00002000 + /* Explicitly placed off target for the storage of logging data. + * The data placed here is NOT loaded onto the target device. + * This is part of 1 GB of external memory from 0x60000000 - 0x9FFFFFFF. + * ARM memory map can be found here: + * https://developer.arm.com/documentation/ddi0337/e/memory-map/about-the-memory-map + */ + LOG_DATA (R) : ORIGIN = 0x90000000, LENGTH = 0x40000 +} + +REGION_ALIAS("REGION_TEXT", FLASH); +REGION_ALIAS("REGION_BSS", SRAM); +REGION_ALIAS("REGION_DATA", SRAM); +REGION_ALIAS("REGION_STACK", SRAM); +REGION_ALIAS("REGION_HEAP", SRAM); +REGION_ALIAS("REGION_LOG", LOG_DATA); +REGION_ALIAS("REGION_ARM_EXIDX", FLASH); +REGION_ALIAS("REGION_ARM_EXTAB", FLASH); + +SECTIONS { + /* BIM header placed at the base of flash by default */ + PROVIDE (_img_header_base_address = + DEFINED(_img_header_base_address) ? _img_header_base_address : 0x0); + + .oad_image_header (_img_header_base_address) : AT (_img_header_base_address) { + KEEP (*(.oad_image_header)) + } > REGION_TEXT + + /* interrupt vectors shifted to accomodate BIM header */ + PROVIDE (_intvecs_base_address = + DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x100); + + .resetVecs (_intvecs_base_address) : AT (_intvecs_base_address) { + KEEP (*(.resetVecs)) + } > REGION_TEXT + + PROVIDE (_vtable_base_address = + DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000); + + .vtable (_vtable_base_address) (NOLOAD) : { + KEEP (*(.ramVecs)) + } > REGION_DATA + + /* + * UDMACC26XX_CONFIG_BASE below must match UDMACC26XX_CONFIG_BASE defined + * by ti/drivers/dma/UDMACC26XX.h + * The user is allowed to change UDMACC26XX_CONFIG_BASE to move it away from + * the default address 0x2000_1800, but remember it must be 1024 bytes aligned. + */ + UDMACC26XX_CONFIG_BASE = 0x20001800; + + /* + * Define absolute addresses for the DMA channels. + * DMA channels must always be allocated at a fixed offset from the DMA base address. + * --------- DO NOT MODIFY ----------- + */ + DMA_UART0_RX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x10); + DMA_UART0_TX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x20); + DMA_SPI0_RX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x30); + DMA_SPI0_TX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x40); + DMA_UART1_RX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x50); + DMA_UART1_TX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x60); + DMA_ADC_PRI_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x70); + DMA_GPT0A_PRI_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x90); + DMA_SPI1_RX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x100); + DMA_SPI1_TX_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x110); + + DMA_UART0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x210); + DMA_UART0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x220); + DMA_SPI0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x230); + DMA_SPI0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x240); + DMA_UART1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x250); + DMA_UART1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x260); + DMA_ADC_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x270); + DMA_GPT0A_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x290); + DMA_SPI1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x300); + DMA_SPI1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS = (UDMACC26XX_CONFIG_BASE + 0x310); + + /* + * Allocate UART0, UART1, SPI0, SPI1, ADC, and GPTimer0 DMA descriptors at absolute addresses. + * --------- DO NOT MODIFY ----------- + */ + UDMACC26XX_uart0RxControlTableEntry_is_placed = 0; + .dmaUart0RxControlTableEntry DMA_UART0_RX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART0_RX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart0RxControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart0TxControlTableEntry_is_placed = 0; + .dmaUart0TxControlTableEntry DMA_UART0_TX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART0_TX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart0TxControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi0RxControlTableEntry_is_placed = 0; + .dmaSpi0RxControlTableEntry DMA_SPI0_RX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI0_RX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi0RxControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi0TxControlTableEntry_is_placed = 0; + .dmaSpi0TxControlTableEntry DMA_SPI0_TX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI0_TX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi0TxControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart1RxControlTableEntry_is_placed = 0; + .dmaUart1RxControlTableEntry DMA_UART1_RX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART1_RX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart1RxControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart1TxControlTableEntry_is_placed = 0; + .dmaUart1TxControlTableEntry DMA_UART1_TX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART1_TX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart1TxControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaADCPriControlTableEntry_is_placed = 0; + .dmaADCPriControlTableEntry DMA_ADC_PRI_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_ADC_PRI_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaADCPriControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaGPT0APriControlTableEntry_is_placed = 0; + .dmaGPT0APriControlTableEntry DMA_GPT0A_PRI_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_GPT0A_PRI_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaGPT0APriControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi1RxControlTableEntry_is_placed = 0; + .dmaSpi1RxControlTableEntry DMA_SPI1_RX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI1_RX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi1RxControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi1TxControlTableEntry_is_placed = 0; + .dmaSpi1TxControlTableEntry DMA_SPI1_TX_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI1_TX_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi1TxControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart0RxAltControlTableEntry_is_placed = 0; + .dmaUart0RxAltControlTableEntry DMA_UART0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart0RxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart0TxAltControlTableEntry_is_placed = 0; + .dmaUart0TxAltControlTableEntry DMA_UART0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart0TxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi0RxAltControlTableEntry_is_placed = 0; + .dmaSpi0RxAltControlTableEntry DMA_SPI0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI0_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi0RxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi0TxAltControlTableEntry_is_placed = 0; + .dmaSpi0TxAltControlTableEntry DMA_SPI0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI0_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi0TxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart1RxAltControlTableEntry_is_placed = 0; + .dmaUart1RxAltControlTableEntry DMA_UART1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart1RxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_uart1TxAltControlTableEntry_is_placed = 0; + .dmaUart1TxAltControlTableEntry DMA_UART1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_UART1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaUart1TxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaADCAltControlTableEntry_is_placed = 0; + .dmaADCAltControlTableEntry DMA_ADC_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_ADC_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaADCAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaGPT0AAltControlTableEntry_is_placed = 0; + .dmaGPT0AAltControlTableEntry DMA_GPT0A_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_GPT0A_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaGPT0AAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi1RxAltControlTableEntry_is_placed = 0; + .dmaSpi1RxAltControlTableEntry DMA_SPI1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI1_RX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi1RxAltControlTableEntry)} > REGION_DATA + + UDMACC26XX_dmaSpi1TxAltControlTableEntry_is_placed = 0; + .dmaSpi1TxAltControlTableEntry DMA_SPI1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS (NOLOAD) : AT (DMA_SPI1_TX_ALT_CONTROL_TABLE_ENTRY_ADDRESS) {*(.dmaSpi1TxAltControlTableEntry)} > REGION_DATA + + + + /* if a ROM-only symbol is present, then ROM is being used. + * Reserve memory for surgically placed config constants. + */ + _rom_rodata_start = 0x2000; + _rom_rodata_size = DEFINED(ROM_RODATA_SIZE) ? 0 : DEFINED(ROM_RODATA_SIZE_NO_OAD) ? 0x330 : 0; + + .rom_rodata_reserve (_rom_rodata_start): { + . += _rom_rodata_size; + } > REGION_TEXT AT> REGION_TEXT + + .text : { + CREATE_OBJECT_SYMBOLS + *(.text) + *(.text.*) + . = ALIGN(0x4); + KEEP (*(.ctors)) + . = ALIGN(0x4); + KEEP (*(.dtors)) + . = ALIGN(0x4); + __init_array_start = .; + KEEP (*(.init_array*)) + __init_array_end = .; + *(.init) + *(.fini*) + } > REGION_TEXT AT> REGION_TEXT + + PROVIDE (__etext = .); + PROVIDE (_etext = .); + PROVIDE (etext = .); + + .rodata : { + *(.rodata) + *(.rodata.*) + *(.rodata_*) + } > REGION_TEXT AT> REGION_TEXT + + .data : ALIGN(4) { + __data_load__ = LOADADDR (.data); + __data_start__ = .; + *(.data) + *(.data.*) + . = ALIGN (4); + __data_end__ = .; + } > REGION_DATA AT> REGION_TEXT + + .ARM.exidx : { + __exidx_start = .; + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + __exidx_end = .; + } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX + + .ARM.extab : { + *(.ARM.extab* .gnu.linkonce.armextab.*) + } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB + + /* End of executable code/data, NVS is not part of the OTA image */ + PROVIDE (_flash_end_address = .); + + .nvs (0xAA000) (NOLOAD) : AT (0xAA000) ALIGN(0x2000) { + *(.nvs) + } > REGION_TEXT + + /* CCFG is supplied by the BIM project */ + /* + .ccfg : { + KEEP (*(.ccfg)) + } > FLASH_CCFG AT> FLASH_CCFG + */ + + .bss : { + __bss_start__ = .; + *(.shbss) + *(.bss) + *(.bss.*) + *(COMMON) + . = ALIGN (4); + __bss_end__ = .; + } > REGION_BSS AT> REGION_BSS + + .heap : { + __heap_start__ = .; + end = __heap_start__; + _end = end; + __end = end; + KEEP(*(.heap)) + __heap_end__ = .; + __HeapLimit = __heap_end__; + } > REGION_HEAP AT> REGION_HEAP + + .stack (NOLOAD) : ALIGN(0x8) { + _stack = .; + __stack = .; + KEEP(*(.stack)) + . += STACKSIZE; + _stack_end = .; + __stack_end = .; + } > REGION_STACK AT> REGION_STACK + + .log_data (COPY) : { + KEEP (*(.log_data)) + } > REGION_LOG +} + +ENTRY(resetISR) diff --git a/src/platform/cc13x2_26x2/oad_image_header.c b/src/platform/cc13x2_26x2/oad_image_header.c new file mode 100644 index 00000000000000..5d925c14cdccc8 --- /dev/null +++ b/src/platform/cc13x2_26x2/oad_image_header.c @@ -0,0 +1,81 @@ +/* + * + * Copyright (c) 2020 Project CHIP Authors + * Copyright (c) 2020 Texas Instruments Incorporated + * + * 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. + */ + +/* definition needed to ensure the OAD image header has room for the ecdsa sig */ +#define SECURITY +#include + +// clang-format off + +#define MY_APP_SOFTWARE_VER { '0', '0', '0', '1' } + +#if defined(__GNUC__) + +/* provided by the linkerfile */ +extern char _flash_end_address; +extern char _intvecs_base_address; + +#define FLASH_END_ADDRESS ((uint32_t)(&_flash_end_address)) +#define RESET_VECT_ADDRESS ((uint32_t)(&_intvecs_base_address)) + +const imgHdr_t __attribute__((section( ".oad_image_header"))) __attribute__((used)) oad_image_header = +#else + +#error "compiler currently note supported" + +#endif + +{ + .fixedHdr = { + .imgID = OAD_IMG_ID_VAL, // User-defined Image Identification bytes + .crc32 = DEFAULT_CRC, // Image's 32-bit CRC value + .bimVer = BIM_VER, // BIM version + .metaVer = META_VER, // Metadata version + .techType = OAD_WIRELESS_TECH_THREAD, // Wireless protocol type BLE/TI-MAC/ZIGBEE etc. + .imgCpStat = DEFAULT_STATE, // Image copy status + .crcStat = DEFAULT_STATE, // CRC status + .imgType = OAD_IMG_TYPE_APP, // Image Type + .imgNo = 0x0, // Image number of 'image type' + .imgVld = DEFAULT_STATE, // Image validation bytes, used by BIM. + .len = INVALID_LEN, // Image length in bytes. + .prgEntry = RESET_VECT_ADDRESS, // Program entry address + .softVer = MY_APP_SOFTWARE_VER, // Software version of the image + .imgEndAddr = FLASH_END_ADDRESS, // Address of the last byte of a contiguous image + .hdrLen = OAD_IMG_FULL_HDR_LEN, // Total length of the image header + .rfu = 0xFFFF, // Reserved bytes + }, +#if (defined(SECURITY)) + .secInfoSeg = { + .segTypeSecure = IMG_SECURITY_SEG_ID, // Segment type - for Secuirty info payload + .wirelessTech = OAD_WIRELESS_TECH_THREAD, // Wireless technology type + .verifStat = DEFAULT_STATE, // Verification status + .secSegLen = SECURITY_SEG_LEN, // Payload segment length + .secVer = SECURITY_VER, // Security version + .secTimestamp = 0x0, // Security timestamp, filled by python script + .secSignerInfo = {0}, // filled by python script + /* .eccSign, filled by python script */ + }, +#endif + .imgPayload = { + .segTypeImg = IMG_PAYLOAD_SEG_ID, // Segment type - for Contiguous image payload + .wirelessTech = OAD_WIRELESS_TECH_THREAD, // Wireless technology type + .rfu = 0, // Reserved bytes + .imgSegLen = 0, // filled by python script + .startAddr = (uint32_t)(&oad_image_header), // Start address of image on internal flash + }, +}; diff --git a/third_party/ti_simplelink_sdk/run_oad_tool.py b/third_party/ti_simplelink_sdk/run_oad_tool.py new file mode 100644 index 00000000000000..9c7b62da4f883d --- /dev/null +++ b/third_party/ti_simplelink_sdk/run_oad_tool.py @@ -0,0 +1,55 @@ +# Copyright 2020 Texas Instruments Incorporated + +"""A wrapper to run the oad tool. + +This script provides a basic Python wrapper for GN to call the TI OAD image +tool. This will result in a downloadable binary file. Currently this is only +used for CC13XX_CC26XX devices. + +Run with: + python run_oad_tool.py +""" + +import sys +import subprocess +import json +import intelhex + +# The extension is probably not necessary +if sys.platform.startswith('win'): + proc_call = [sys.argv[1] + '/tools/common/oad/oad_image_tool.exe'] + +else: + proc_call = [sys.argv[1] + '/tools/common/oad/oad_image_tool'] + +root_out_dir = sys.argv[2] +project_name = sys.argv[3] +pem_file = sys.argv[4] +hex_file = root_out_dir + '/' + project_name + '.hex' +oad_bin_file = root_out_dir + '/' + project_name + '.bin' +combined_hex = root_out_dir + '/' + project_name + '-bim.hex' +bim_hex_file = sys.argv[5] + +proc_call += [ + '--verbose', + 'ccs', + root_out_dir, + '7', + '-hex1', hex_file, + '-k', pem_file, + '-o', sys.argv[3] +] + +# run oad_tool to fill in the header +subprocess.call(proc_call) + +# merge binary executable with bim hex file +ota_image = intelhex.IntelHex() +ota_image.fromfile(oad_bin_file, format='bin') + +bim_hex = intelhex.IntelHex() +bim_hex.fromfile(bim_hex_file, format='hex') + +ota_image.merge(bim_hex) + +ota_image.tofile(combined_hex, format='hex') diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni index d2b6d9d240e853..49f3e40cad5d0c 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_board.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_board.gni @@ -38,18 +38,21 @@ if (ti_simplelink_board == "CC1352R1_LAUNCHXL") { # set -DDeviceFamily_CC13X2? ti_simplelink_soc = "cc1352r1f3" + ti_simplelink_bim_name = "cc1352r1lp" } else if (ti_simplelink_board == "CC2652R1_LAUNCHXL") { ti_simplelink_device_family = "cc13x2_26x2" ti_simplelink_soc_family = "cc26x2" # set -DDeviceFamily_CC26X2? ti_simplelink_soc = "cc2652r1f3" + ti_simplelink_bim_name = "cc2652r1lp" } else if (ti_simplelink_board == "LP_CC2652R7") { ti_simplelink_device_family = "cc13x2x7_26x2x7" ti_simplelink_soc_family = "cc26x2" # set -DDeviceFamily_CC26X2? ti_simplelink_soc = "cc2652r1f7" + ti_simplelink_bim_name = "cc2652r7lp" } else { print("Please provide a valid value for TI_SIMPLELINK_BOARD env variable") assert(false, "The board ${ti_simplelink_board} is unsupported as for now.") diff --git a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni index 0db5bdb3beb97b..f8a00d79bdf245 100644 --- a/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni +++ b/third_party/ti_simplelink_sdk/ti_simplelink_executable.gni @@ -13,11 +13,93 @@ # limitations under the License. import("//build_overrides/build.gni") +import("//build_overrides/chip.gni") +import("//build_overrides/ti_simplelink_sdk.gni") import("${build_root}/toolchain/flashable_executable.gni") +import("${chip_root}/src/platform/device.gni") +import("ti_simplelink_board.gni") +import("ti_simplelink_sdk.gni") template("ti_simplelink_executable") { - flashable_executable(target_name) { + simplelink_target_name = target_name + + if (chip_enable_ota_requestor) { + # Generating the ota binary image + final_target = "${target_name}_ota" + } else { + # The executable is the final target. + final_target = "${simplelink_target_name}.out" + } + output_base_name = get_path_info(invoker.output_name, "name") + + objcopy_image_name = output_base_name + ".hex" + objcopy_image_format = "ihex" + objcopy = "arm-none-eabi-objcopy" + + flashable_executable("${simplelink_target_name}.out") { forward_variables_from(invoker, "*") + + if (ti_simplelink_device_family == "cc13x2x7_26x2x7") { + if (chip_enable_ota_requestor) { + sources += + [ "${chip_root}/src/platform/cc13x2_26x2/oad_image_header.c" ] + ldscript = "${chip_root}/src/platform/cc13x2_26x2/cc13x2x7_cc26x2x7_freertos_ota.lds" + } else { + ldscript = "${ti_simplelink_sdk_root}/source/ti/dmm/apps/common/freertos/cc13x2x7_cc26x2x7.lds" + } + + inputs = [ ldscript ] + + ldflags = [ + "-L${ti_simplelink_sdk_root}/source", + rebase_path( + "${target_gen_dir}/sysconfig/ti_utils_build_linker.cmd.genlibs", + root_build_dir), + "-T" + rebase_path(ldscript, root_build_dir), + ] + } + } + + if (chip_enable_ota_requestor && + ti_simplelink_device_family == "cc13x2x7_26x2x7") { + pw_python_action("${target_name}_ota") { + public_deps = [ ":${simplelink_target_name}.out.image" ] + + script = "${ti_simplelink_sdk_build_root}/run_oad_tool.py" + sources = [ "${root_out_dir}/${objcopy_image_name}" ] + outputs = [ + "${root_out_dir}/${output_base_name}.bin", + "${root_out_dir}/${output_base_name}-bim.hex", + ] + + if (defined(invoker.pem_file)) { + pem_file = invoker.pem_file + } else { + pem_file = "${ti_simplelink_sdk_root}/tools/common/oad/private.pem" + } + + if (defined(invoker.bim_hex)) { + bim_hex = invoker.bim_hex + } else { + bim_hex = "${ti_simplelink_sdk_root}/examples/rtos/${ti_simplelink_board}/ble5stack/hexfiles/bim_offchip/Release/${ti_simplelink_bim_name}_bim_offchip.hex" + } + + args = [ + ti_simplelink_sdk_root, + rebase_path(root_out_dir, root_build_dir), + output_base_name, + rebase_path(pem_file, root_build_dir), + rebase_path(bim_hex, root_build_dir), + ] + } + } + + group(simplelink_target_name) { + data_deps = [ ":$final_target" ] + + if (defined(invoker.data_deps)) { + data_deps += invoker.data_deps + } } } diff --git a/zzz_generated/lock-app/zap-generated/CHIPClientCallbacks.h b/zzz_generated/lock-app/zap-generated/CHIPClientCallbacks.h index fbed9690c1f3da..7ce7f6e003bd31 100644 --- a/zzz_generated/lock-app/zap-generated/CHIPClientCallbacks.h +++ b/zzz_generated/lock-app/zap-generated/CHIPClientCallbacks.h @@ -16,3 +16,18 @@ */ // THIS FILE IS GENERATED BY ZAP + +#pragma once + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// List specific responses diff --git a/zzz_generated/lock-app/zap-generated/CHIPClusters.h b/zzz_generated/lock-app/zap-generated/CHIPClusters.h index fbed9690c1f3da..15ec5aca34a215 100644 --- a/zzz_generated/lock-app/zap-generated/CHIPClusters.h +++ b/zzz_generated/lock-app/zap-generated/CHIPClusters.h @@ -16,3 +16,26 @@ */ // THIS FILE IS GENERATED BY ZAP + +// Prevent multiple inclusion +#pragma once + +#include +#include + +#include +#include +#include + +namespace chip { +namespace Controller { + +class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase +{ +public: + OtaSoftwareUpdateProviderCluster() : ClusterBase(app::Clusters::OtaSoftwareUpdateProvider::Id) {} + ~OtaSoftwareUpdateProviderCluster() {} +}; + +} // namespace Controller +} // namespace chip diff --git a/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp b/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp index a79af1d93987a1..6532e779bd69db 100644 --- a/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp +++ b/zzz_generated/lock-app/zap-generated/IMClusterCommandHandler.cpp @@ -136,6 +136,43 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace DiagnosticLogs +namespace EthernetNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfEthernetNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace EthernetNetworkDiagnostics + namespace GeneralCommissioning { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -276,6 +313,44 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace NetworkCommissioning +namespace OtaSoftwareUpdateRequestor { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::AnnounceOtaProvider::Id: { + Commands::AnnounceOtaProvider::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = + emberAfOtaSoftwareUpdateRequestorClusterAnnounceOtaProviderCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace OtaSoftwareUpdateRequestor + namespace OnOff { void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) @@ -444,6 +519,117 @@ void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandP } // namespace OperationalCredentials +namespace SoftwareDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetWatermarks::Id: { + Commands::ResetWatermarks::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfSoftwareDiagnosticsClusterResetWatermarksCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace SoftwareDiagnostics + +namespace ThreadNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfThreadNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace ThreadNetworkDiagnostics + +namespace WiFiNetworkDiagnostics { + +void DispatchServerCommand(CommandHandler * apCommandObj, const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aDataTlv) +{ + CHIP_ERROR TLVError = CHIP_NO_ERROR; + bool wasHandled = false; + { + switch (aCommandPath.mCommandId) + { + case Commands::ResetCounts::Id: { + Commands::ResetCounts::DecodableType commandData; + TLVError = DataModel::Decode(aDataTlv, commandData); + if (TLVError == CHIP_NO_ERROR) + { + wasHandled = emberAfWiFiNetworkDiagnosticsClusterResetCountsCallback(apCommandObj, aCommandPath, commandData); + } + break; + } + default: { + // Unrecognized command ID, error status will apply. + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCommand); + ChipLogError(Zcl, "Unknown command " ChipLogFormatMEI " for cluster " ChipLogFormatMEI, + ChipLogValueMEI(aCommandPath.mCommandId), ChipLogValueMEI(aCommandPath.mClusterId)); + return; + } + } + } + + if (CHIP_NO_ERROR != TLVError || !wasHandled) + { + apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::InvalidCommand); + ChipLogProgress(Zcl, "Failed to dispatch command, TLVError=%" CHIP_ERROR_FORMAT, TLVError.Format()); + } +} + +} // namespace WiFiNetworkDiagnostics + } // namespace Clusters void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV::TLVReader & aReader, CommandHandler * apCommandObj) @@ -458,18 +644,33 @@ void DispatchSingleClusterCommand(const ConcreteCommandPath & aCommandPath, TLV: case Clusters::DiagnosticLogs::Id: Clusters::DiagnosticLogs::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::EthernetNetworkDiagnostics::Id: + Clusters::EthernetNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::GeneralCommissioning::Id: Clusters::GeneralCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; case Clusters::NetworkCommissioning::Id: Clusters::NetworkCommissioning::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::OtaSoftwareUpdateRequestor::Id: + Clusters::OtaSoftwareUpdateRequestor::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; case Clusters::OnOff::Id: Clusters::OnOff::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; case Clusters::OperationalCredentials::Id: Clusters::OperationalCredentials::DispatchServerCommand(apCommandObj, aCommandPath, aReader); break; + case Clusters::SoftwareDiagnostics::Id: + Clusters::SoftwareDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::ThreadNetworkDiagnostics::Id: + Clusters::ThreadNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; + case Clusters::WiFiNetworkDiagnostics::Id: + Clusters::WiFiNetworkDiagnostics::DispatchServerCommand(apCommandObj, aCommandPath, aReader); + break; default: ChipLogError(Zcl, "Unknown cluster " ChipLogFormatMEI, ChipLogValueMEI(aCommandPath.mClusterId)); apCommandObj->AddStatus(aCommandPath, Protocols::InteractionModel::Status::UnsupportedCluster); diff --git a/zzz_generated/lock-app/zap-generated/PluginApplicationCallbacks.h b/zzz_generated/lock-app/zap-generated/PluginApplicationCallbacks.h index 191bf30c4ef48f..af1cfc19cd6a87 100644 --- a/zzz_generated/lock-app/zap-generated/PluginApplicationCallbacks.h +++ b/zzz_generated/lock-app/zap-generated/PluginApplicationCallbacks.h @@ -33,6 +33,8 @@ MatterGeneralDiagnosticsPluginServerInitCallback(); \ MatterLocalizationConfigurationPluginServerInitCallback(); \ MatterNetworkCommissioningPluginServerInitCallback(); \ + MatterOtaSoftwareUpdateProviderPluginClientInitCallback(); \ + MatterOtaSoftwareUpdateRequestorPluginServerInitCallback(); \ MatterOnOffPluginServerInitCallback(); \ MatterOperationalCredentialsPluginServerInitCallback(); \ MatterPowerSourcePluginServerInitCallback(); \ diff --git a/zzz_generated/lock-app/zap-generated/af-gen-event.h b/zzz_generated/lock-app/zap-generated/af-gen-event.h old mode 100644 new mode 100755 diff --git a/zzz_generated/lock-app/zap-generated/callback-stub.cpp b/zzz_generated/lock-app/zap-generated/callback-stub.cpp index c06298152e6bda..ee1b74de8a718b 100644 --- a/zzz_generated/lock-app/zap-generated/callback-stub.cpp +++ b/zzz_generated/lock-app/zap-generated/callback-stub.cpp @@ -62,6 +62,12 @@ void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId) case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID: emberAfNetworkCommissioningClusterInitCallback(endpoint); break; + case ZCL_OTA_PROVIDER_CLUSTER_ID: + emberAfOtaSoftwareUpdateProviderClusterInitCallback(endpoint); + break; + case ZCL_OTA_REQUESTOR_CLUSTER_ID: + emberAfOtaSoftwareUpdateRequestorClusterInitCallback(endpoint); + break; case ZCL_ON_OFF_CLUSTER_ID: emberAfOnOffClusterInitCallback(endpoint); break; @@ -150,6 +156,16 @@ void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(Endpoi // To prevent warning (void) endpoint; } +void __attribute__((weak)) emberAfOtaSoftwareUpdateProviderClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} +void __attribute__((weak)) emberAfOtaSoftwareUpdateRequestorClusterInitCallback(EndpointId endpoint) +{ + // To prevent warning + (void) endpoint; +} void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint) { // To prevent warning diff --git a/zzz_generated/lock-app/zap-generated/endpoint_config.h b/zzz_generated/lock-app/zap-generated/endpoint_config.h index a36bc800742670..df66ab251d7188 100644 --- a/zzz_generated/lock-app/zap-generated/endpoint_config.h +++ b/zzz_generated/lock-app/zap-generated/endpoint_config.h @@ -576,7 +576,7 @@ #define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask // This is an array of EmberAfAttributeMetadata structures. -#define GENERATED_ATTRIBUTE_COUNT 202 +#define GENERATED_ATTRIBUTE_COUNT 207 #define GENERATED_ATTRIBUTES \ { \ \ @@ -637,6 +637,14 @@ ZAP_EMPTY_DEFAULT() }, /* UniqueID */ \ { 0x0000FFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ + { 0x00000000, ZAP_TYPE(ARRAY), 0, ZAP_ATTRIBUTE_MASK(EXTERNAL_STORAGE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ + ZAP_EMPTY_DEFAULT() }, /* DefaultOtaProviders */ \ + { 0x00000001, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(1) }, /* UpdatePossible */ \ + { 0x00000002, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0) }, /* UpdateState */ \ + { 0x00000003, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(NULLABLE), ZAP_SIMPLE_DEFAULT(0) }, /* UpdateStateProgress */ \ + { 0x0000FFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(1) }, /* ClusterRevision */ \ + \ /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ { 0x00000001, ZAP_TYPE(CHAR_STRING), 36, ZAP_ATTRIBUTE_MASK(TOKENIZE) | ZAP_ATTRIBUTE_MASK(WRITABLE), \ ZAP_LONG_DEFAULTS_INDEX(0) }, /* ActiveLocale */ \ @@ -885,6 +893,10 @@ // clang-format off #define GENERATED_COMMANDS { \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */\ + /* client_generated */ \ + 0x00000000 /* AnnounceOtaProvider */, \ + chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: General Commissioning (server) */\ /* client_generated */ \ 0x00000000 /* ArmFailSafe */, \ @@ -916,6 +928,14 @@ /* client_generated */ \ 0x00000000 /* ResetWatermarks */, \ chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */\ + /* client_generated */ \ + 0x00000000 /* ResetCounts */, \ + chip::kInvalidCommandId /* end of list */, \ + /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */\ + /* client_generated */ \ + 0x00000000 /* ResetCounts */, \ + chip::kInvalidCommandId /* end of list */, \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */\ /* client_generated */ \ 0x00000000 /* ResetCounts */, \ @@ -955,7 +975,7 @@ // clang-format on #define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask -#define GENERATED_CLUSTER_COUNT 22 +#define GENERATED_CLUSTER_COUNT 24 // clang-format off #define GENERATED_CLUSTERS { \ @@ -992,10 +1012,32 @@ .clientGeneratedCommandList = nullptr ,\ .serverGeneratedCommandList = nullptr ,\ },\ + { \ + /* Endpoint: 0, Cluster: OTA Software Update Provider (client) */ \ + .clusterId = 0x00000029, \ + .attributes = ZAP_ATTRIBUTE_INDEX(29), \ + .attributeCount = 0, \ + .clusterSize = 0, \ + .mask = ZAP_CLUSTER_MASK(CLIENT), \ + .functions = NULL, \ + .clientGeneratedCommandList = nullptr ,\ + .serverGeneratedCommandList = nullptr ,\ + },\ + { \ + /* Endpoint: 0, Cluster: OTA Software Update Requestor (server) */ \ + .clusterId = 0x0000002A, \ + .attributes = ZAP_ATTRIBUTE_INDEX(29), \ + .attributeCount = 5, \ + .clusterSize = 5, \ + .mask = ZAP_CLUSTER_MASK(SERVER), \ + .functions = NULL, \ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 0 ) ,\ + .serverGeneratedCommandList = nullptr ,\ + },\ { \ /* Endpoint: 0, Cluster: Localization Configuration (server) */ \ .clusterId = 0x0000002B, \ - .attributes = ZAP_ATTRIBUTE_INDEX(29), \ + .attributes = ZAP_ATTRIBUTE_INDEX(34), \ .attributeCount = 3, \ .clusterSize = 38, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -1006,7 +1048,7 @@ { \ /* Endpoint: 0, Cluster: Time Format Localization (server) */ \ .clusterId = 0x0000002C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(32), \ + .attributes = ZAP_ATTRIBUTE_INDEX(37), \ .attributeCount = 4, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION) | ZAP_CLUSTER_MASK(PRE_ATTRIBUTE_CHANGED_FUNCTION), \ @@ -1017,7 +1059,7 @@ { \ /* Endpoint: 0, Cluster: Power Source Configuration (server) */ \ .clusterId = 0x0000002E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(36), \ + .attributes = ZAP_ATTRIBUTE_INDEX(41), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1028,7 +1070,7 @@ { \ /* Endpoint: 0, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(38), \ + .attributes = ZAP_ATTRIBUTE_INDEX(43), \ .attributeCount = 6, \ .clusterSize = 73, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1039,40 +1081,40 @@ { \ /* Endpoint: 0, Cluster: General Commissioning (server) */ \ .clusterId = 0x00000030, \ - .attributes = ZAP_ATTRIBUTE_INDEX(44), \ + .attributes = ZAP_ATTRIBUTE_INDEX(49), \ .attributeCount = 6, \ .clusterSize = 16, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 0 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 4 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 2 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 6 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Network Commissioning (server) */ \ .clusterId = 0x00000031, \ - .attributes = ZAP_ATTRIBUTE_INDEX(50), \ + .attributes = ZAP_ATTRIBUTE_INDEX(55), \ .attributeCount = 10, \ .clusterSize = 60, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 7 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 14 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 9 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 16 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Diagnostic Logs (server) */ \ .clusterId = 0x00000032, \ - .attributes = ZAP_ATTRIBUTE_INDEX(60), \ + .attributes = ZAP_ATTRIBUTE_INDEX(65), \ .attributeCount = 0, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 17 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 19 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: General Diagnostics (server) */ \ .clusterId = 0x00000033, \ - .attributes = ZAP_ATTRIBUTE_INDEX(60), \ + .attributes = ZAP_ATTRIBUTE_INDEX(65), \ .attributeCount = 9, \ .clusterSize = 17, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1083,73 +1125,73 @@ { \ /* Endpoint: 0, Cluster: Software Diagnostics (server) */ \ .clusterId = 0x00000034, \ - .attributes = ZAP_ATTRIBUTE_INDEX(69), \ + .attributes = ZAP_ATTRIBUTE_INDEX(74), \ .attributeCount = 6, \ .clusterSize = 30, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 19 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 21 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Thread Network Diagnostics (server) */ \ .clusterId = 0x00000035, \ - .attributes = ZAP_ATTRIBUTE_INDEX(75), \ + .attributes = ZAP_ATTRIBUTE_INDEX(80), \ .attributeCount = 65, \ .clusterSize = 247, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = nullptr ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 23 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \ .clusterId = 0x00000036, \ - .attributes = ZAP_ATTRIBUTE_INDEX(140), \ + .attributes = ZAP_ATTRIBUTE_INDEX(145), \ .attributeCount = 15, \ .clusterSize = 58, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = nullptr ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 25 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Ethernet Network Diagnostics (server) */ \ .clusterId = 0x00000037, \ - .attributes = ZAP_ATTRIBUTE_INDEX(155), \ + .attributes = ZAP_ATTRIBUTE_INDEX(160), \ .attributeCount = 11, \ .clusterSize = 57, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 21 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 27 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: AdministratorCommissioning (server) */ \ .clusterId = 0x0000003C, \ - .attributes = ZAP_ATTRIBUTE_INDEX(166), \ + .attributes = ZAP_ATTRIBUTE_INDEX(171), \ .attributeCount = 4, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 23 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 29 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 0, Cluster: Operational Credentials (server) */ \ .clusterId = 0x0000003E, \ - .attributes = ZAP_ATTRIBUTE_INDEX(170), \ + .attributes = ZAP_ATTRIBUTE_INDEX(175), \ .attributeCount = 7, \ .clusterSize = 4, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ .functions = NULL, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 27 ) ,\ - .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 37 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 33 ) ,\ + .serverGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 43 ) ,\ },\ { \ /* Endpoint: 0, Cluster: Fixed Label (server) */ \ .clusterId = 0x00000040, \ - .attributes = ZAP_ATTRIBUTE_INDEX(177), \ + .attributes = ZAP_ATTRIBUTE_INDEX(182), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1160,7 +1202,7 @@ { \ /* Endpoint: 0, Cluster: User Label (server) */ \ .clusterId = 0x00000041, \ - .attributes = ZAP_ATTRIBUTE_INDEX(179), \ + .attributes = ZAP_ATTRIBUTE_INDEX(184), \ .attributeCount = 2, \ .clusterSize = 2, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1171,18 +1213,18 @@ { \ /* Endpoint: 1, Cluster: On/Off (server) */ \ .clusterId = 0x00000006, \ - .attributes = ZAP_ATTRIBUTE_INDEX(181), \ + .attributes = ZAP_ATTRIBUTE_INDEX(186), \ .attributeCount = 7, \ .clusterSize = 13, \ .mask = ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \ .functions = chipFuncArrayOnOffServer, \ - .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 42 ) ,\ + .clientGeneratedCommandList = ZAP_GENERATED_COMMANDS_INDEX( 48 ) ,\ .serverGeneratedCommandList = nullptr ,\ },\ { \ /* Endpoint: 1, Cluster: Descriptor (server) */ \ .clusterId = 0x0000001D, \ - .attributes = ZAP_ATTRIBUTE_INDEX(188), \ + .attributes = ZAP_ATTRIBUTE_INDEX(193), \ .attributeCount = 5, \ .clusterSize = 0, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1193,7 +1235,7 @@ { \ /* Endpoint: 1, Cluster: Power Source (server) */ \ .clusterId = 0x0000002F, \ - .attributes = ZAP_ATTRIBUTE_INDEX(193), \ + .attributes = ZAP_ATTRIBUTE_INDEX(198), \ .attributeCount = 9, \ .clusterSize = 133, \ .mask = ZAP_CLUSTER_MASK(SERVER), \ @@ -1207,12 +1249,12 @@ #define ZAP_CLUSTER_INDEX(index) (&generatedClusters[index]) -#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 22 +#define ZAP_FIXED_ENDPOINT_DATA_VERSION_COUNT 23 // This is an array of EmberAfEndpointType structures. #define GENERATED_ENDPOINT_TYPES \ { \ - { ZAP_CLUSTER_INDEX(0), 19, 653 }, { ZAP_CLUSTER_INDEX(19), 3, 146 }, \ + { ZAP_CLUSTER_INDEX(0), 21, 658 }, { ZAP_CLUSTER_INDEX(21), 3, 146 }, \ } // Largest attribute size is needed for various buffers @@ -1224,7 +1266,7 @@ static_assert(ATTRIBUTE_LARGEST <= CHIP_CONFIG_MAX_ATTRIBUTE_STORE_ELEMENT_SIZE, #define ATTRIBUTE_SINGLETONS_SIZE (39) // Total size of attribute storage -#define ATTRIBUTE_MAX_SIZE (799) +#define ATTRIBUTE_MAX_SIZE (804) // Number of fixed endpoints #define FIXED_ENDPOINT_COUNT (2) diff --git a/zzz_generated/lock-app/zap-generated/gen_config.h b/zzz_generated/lock-app/zap-generated/gen_config.h index 72efd2c3742078..3bcd81c50d2489 100644 --- a/zzz_generated/lock-app/zap-generated/gen_config.h +++ b/zzz_generated/lock-app/zap-generated/gen_config.h @@ -40,6 +40,8 @@ #define EMBER_AF_GENERAL_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_LOCALIZATION_CONFIGURATION_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1) +#define EMBER_AF_OTA_PROVIDER_CLUSTER_CLIENT_ENDPOINT_COUNT (1) +#define EMBER_AF_OTA_REQUESTOR_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1) #define EMBER_AF_POWER_SOURCE_CLUSTER_SERVER_ENDPOINT_COUNT (2) @@ -107,6 +109,15 @@ #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER #define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING +// Use this macro to check if the client side of the OTA Software Update Provider cluster is included +#define ZCL_USING_OTA_PROVIDER_CLUSTER_CLIENT +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_PROVIDER_CLIENT + +// Use this macro to check if the server side of the OTA Software Update Requestor cluster is included +#define ZCL_USING_OTA_REQUESTOR_CLUSTER_SERVER +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_REQUESTOR_SERVER +#define EMBER_AF_PLUGIN_OTA_SOFTWARE_UPDATE_REQUESTOR + // Use this macro to check if the server side of the On/Off cluster is included #define ZCL_USING_ON_OFF_CLUSTER_SERVER #define EMBER_AF_PLUGIN_ON_OFF_SERVER