Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
ca::Flasher Class Reference

#include <posix/app/chilictl/flash/Flasher.hpp>

Public Types

enum  FlashType {
  APROM_CLEAR = 0 , APROM_PROGRAM = 1 , APROM_CLEAR_AND_PROGRAM = 2 , DFU = 3 ,
  MANUFACTURER = 4
}
 Enumeration of different areas of flash to rewrite. More...
 
enum  State {
  INIT , OTA_ERASE , REBOOT , ERASE ,
  FLASH , VERIFY , VALIDATE , COMPLETE ,
  FAIL , INVALID
}
 State enumeration for flasher state machine. More...
 

Public Member Functions

 Flasher (const char *aAppFilePath, const char *aOtaBootFilePath, const char *aManufacturerDataFilePath, const DeviceInfo &aDeviceInfo, FlashType aFlashType)
 Construct a flasher instance. More...
 
 ~Flasher ()
 
ca_error Process ()
 Process the internal state, returning an error if no more processing can be done. More...
 
bool IsComplete ()
 Is the instance complete and successful? More...
 
State GetState ()
 Get the current state of the flasher. More...
 
void SetIgnoreVersion (bool aIgnoreVersion)
 Enable/Disable the version check for the connected device. More...
 
void SetEnumerateUartDevices (bool aEnumerateUartDevices)
 

Member Enumeration Documentation

◆ FlashType

Enumeration of different areas of flash to rewrite.

Enumerator
APROM_CLEAR 

Clear the APROM (application)

APROM_PROGRAM 

Rewrite the APROM while preserving persistent APROM data.

APROM_CLEAR_AND_PROGRAM 

Rewrite the APROM and delete persistent APROM data.

DFU 

Rewrite the DFU area (boot loader)

MANUFACTURER 

Rewrite the manufacturer reserved page.

◆ State

State enumeration for flasher state machine.

Enumerator
INIT 

Initial state.

OTA_ERASE 

Erase the metadata region of the external flash (only happens if OTA upgrade is enabled)

REBOOT 

Rebooted into DFU mode.

ERASE 

Erasing flash.

FLASH 

Flashing program.

VERIFY 

Verifying correct flashing.

VALIDATE 

Validating new program functionality.

COMPLETE 

Flashing completed successfully.

FAIL 

Flashing failed.

INVALID 

Class not correctly instantiated.

Constructor & Destructor Documentation

◆ Flasher()

ca::Flasher::Flasher ( const char *  aAppFilePath,
const char *  aOtaBootFilePath,
const char *  aManufacturerDataFilePath,
const DeviceInfo aDeviceInfo,
FlashType  aFlashType 
)

Construct a flasher instance.

Parameters
aAppFilePathPath to the binary file of the application to be flashed
aOtaBootFilePathPath to the binary file of the ota bootloader to be flashed
aManufacturerDataFilePathPath to the binary file of the manufacturer data file to be flashed
aDeviceInfoReference to a deviceInfo struct of the device to be reflashed
aFlashTypeType of reflashing to execute (Update application or bootloader?)

◆ ~Flasher()

ca::Flasher::~Flasher ( )

Member Function Documentation

◆ GetState()

State ca::Flasher::GetState ( )
inline

Get the current state of the flasher.

Returns
The current state of the flasher instance

◆ IsComplete()

bool ca::Flasher::IsComplete ( )

Is the instance complete and successful?

Returns
True if complete and successful

◆ Process()

ca_error ca::Flasher::Process ( )

Process the internal state, returning an error if no more processing can be done.

Return values
CA_ERROR_SUCCESSProcessing successful, not yet complete
CA_ERROR_ALREADYProcessing complete and successful
CA_ERROR_INVALID_STATEProcessing complete but failed

◆ SetEnumerateUartDevices()

void ca::Flasher::SetEnumerateUartDevices ( bool  aEnumerateUartDevices)
inline

◆ SetIgnoreVersion()

void ca::Flasher::SetIgnoreVersion ( bool  aIgnoreVersion)
inline

Enable/Disable the version check for the connected device.

This is useful if the connected device's version number is broken for some reason, but the actual firmware is up to date. Defaults to false (Version check is enabled)

Parameters
aIgnoreVersionSet to true to ignore the version check, Set to false to enable the version check

The documentation for this class was generated from the following files: