Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pump-controller-app example app with OTA #15633

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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