AM263Px MCU+ SDK: FOTA Agent

| AM263Px MCU+ SDK 26.00.00 |

FOTA Agent

The Fota Agent driver provides API to Update Firmware over The Air by scheduling the writes in chunks of smaller size while the new image is being recieved over a certain protocol(CAN for example).

# Features Supported

- Supports Writes in sector size.
- Only ELF image format supported
- Both XIP and Non-XIP files

# Example Usage

Include the below file to access the APIs

#include <stdio.h>
#include <drivers/fota_agent/v0/fota_agent.h>

Init API

FOTAAgent_Handle fotaAgentHandle;
FOTAAgent_Params agentParams;
uint8_t gFotaAgentProcessingBuffer[WRITE_CHUNK_SIZE];
ELFUP_ELFPH gProgramHeaderArray[MAX_ELF_PROGRAM_HEADER];
FOTAAgent_Params_init(&agentParams);
agentParams.pProcessingBuffer = gFotaAgentProcessingBuffer;
agentParams.pProgramHeader = gProgramHeaderArray;
agentParams.programHeaderCnt = MAX_ELF_PROGRAM_HEADER;
FOTAAgent_init(&fotaAgentHandle, &agentParams);

Write Start API

status = FOTAAgent_writeStart(&fotaAgentHandle, offset, TRUE);

Write Update API

for(int i = 0; i < APP_OSPI_DATA_SIZE; i++)
{
status = FOTAAgent_writeUpdate(&fotaAgentHandle, &gOspiTxBuf[i], 1);
DebugP_assert(status == SystemP_SUCCESS);
}

Write End API

status += FOTAAgent_writeEnd(&fotaAgentHandle);
DebugP_assert(status==SystemP_SUCCESS);

# API

APIs for FOTA Agent

FOTAAgent_Params_init
int32_t FOTAAgent_Params_init(FOTAAgent_Params *params)
Initilize params with default values.
FOTAAgent_writeEnd
int32_t FOTAAgent_writeEnd(FOTAAgent_Handle *pHandle)
Logically end writes and end the state machine.
FOTAAgent_Params::pProgramHeader
ELFUP_ELFPH * pProgramHeader
Definition: fota_agent.h:85
FOTAAgent_init
int32_t FOTAAgent_init(FOTAAgent_Handle *pHandle, FOTAAgent_Params *params)
Initilize FOTA Agent API.
FOTAAgent_writeUpdate
int32_t FOTAAgent_writeUpdate(FOTAAgent_Handle *pHandle, uint8_t *buf, uint32_t size)
Update internal machine with new data.
FOTAAgent_Params
FOTA Agent Driver Handle.
Definition: fota_agent.h:83
FOTAAgent_Params::pProcessingBuffer
uint8_t * pProcessingBuffer
Definition: fota_agent.h:86
FOTAAgent_writeStart
int32_t FOTAAgent_writeStart(FOTAAgent_Handle *pHandle, uint32_t wrOffset, char doFlashSegments)
Logically start writes and initilize state internal machine.
FOTAAgent_Handle
Definition: fota_agent.h:91
SystemP_SUCCESS
#define SystemP_SUCCESS
Return status when the API execution was successful.
Definition: SystemP.h:56
FOTAAgent_Params::programHeaderCnt
size_t programHeaderCnt
Definition: fota_agent.h:84
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:187
fota_agent.h
FOTA Agent Driver API/interface file.