Skip to content

Commit

Permalink
Update pump-controller-app example app with OTA (#15633)
Browse files Browse the repository at this point in the history
* * Modified the pump-controller-app.zap to fit spec.
* Added OTA functionality to pump-controller-app.zap

* * Ran the `zap_regen_all.py` script

* * Added OTA functionality to the pump-controller-app application
* Modified the ICALL HEAP size to be able to link the project

* * Added line feed to comply with Restyle

* * Removed white space requested by Restyle bot

* * Updated to match ToT
  • Loading branch information
tlykkeberg-grundfos authored and pull[bot] committed Apr 29, 2022
1 parent fe995b3 commit 3353747
Show file tree
Hide file tree
Showing 12 changed files with 2,477 additions and 2,730 deletions.
2 changes: 2 additions & 0 deletions examples/pump-controller-app/cc13x2x7_26x2x7/args.gni
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ti_simplelink_board = "LP_CC2652R7"
# use -Os instead of -Og, LWIP release build
is_debug = false

chip_enable_ota_requestor = true

# Disable CHIP Logging
#chip_progress_logging = false
#chip_detail_logging = false
Expand Down
5 changes: 5 additions & 0 deletions examples/pump-controller-app/cc13x2x7_26x2x7/chip.syscfg
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const ECJPAKE = scripting.addModule("/ti/drivers/ECJPAKE");
const ECJPAKE1 = ECJPAKE.addInstance();
const NVS = scripting.addModule("/ti/drivers/NVS");
const NVS1 = NVS.addInstance();
const NVS2 = NVS.addInstance();
const RF = scripting.addModule("/ti/drivers/RF");
const RTOS = scripting.addModule("/ti/drivers/RTOS");
const SHA2 = scripting.addModule("/ti/drivers/SHA2");
Expand Down Expand Up @@ -148,6 +149,10 @@ NVS1.internalFlash.$name = "ti_drivers_nvs_NVSCC26XX0";
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;

RTOS.name = "FreeRTOS";

SHA21.$name = "CONFIG_SHA2_0";
Expand Down
30 changes: 26 additions & 4 deletions examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
#include "AppEvent.h"
#include <app/server/Server.h>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attribute-type.h>
#include <app-common/zap-generated/cluster-id.h>

#include "FreeRTOS.h"
#include <credentials/DeviceAttestationCredsProvider.h>
#include <credentials/examples/DeviceAttestationCredsExample.h>

#include <app/util/af-types.h>
#include <app/util/af.h>

#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/GenericOTARequestorDriver.h>
#include <platform/cc13x2_26x2/OTAImageProcessorImpl.h>
#endif
#include <app-common/zap-generated/attributes/Accessors.h>
#include <lib/support/CHIPMem.h>
#include <lib/support/CHIPPlatformMemory.h>
#include <platform/CHIPDeviceLayer.h>
Expand All @@ -49,6 +52,7 @@
#define APP_TASK_PRIORITY 4
#define APP_EVENT_QUEUE_SIZE 10

using namespace ::chip;
using namespace ::chip::Credentials;
using namespace ::chip::DeviceLayer;

Expand All @@ -62,6 +66,24 @@ static Button_Handle sAppRightHandle;

AppTask AppTask::sAppTask;

#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
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);
}
#endif

int AppTask::StartAppTask()
{
int ret = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/pump-controller-app/cc13x2x7_26x2x7/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <ti/drivers/SHA2.h>

#include <bget.h>
#define TOTAL_ICALL_HEAP_SIZE (0xE000)
#define TOTAL_ICALL_HEAP_SIZE (0xCB00)

using namespace ::chip;
using namespace ::chip::Inet;
Expand Down
Loading

0 comments on commit 3353747

Please sign in to comment.