154 bool isErased(uint32_t flashAddress, uint16_t size);
Class to store microapps on flash.
Definition: cs_MicroappStorage.h:12
cs_ret_code_t write(uint32_t flashAddress, const uint8_t *data, uint16_t size)
Write to flash.
cs_ret_code_t validateApp(uint8_t appIndex)
Validate the overall binary, this goes through flash and checks it completely.
cs_ret_code_t init()
Initialize fstorage, allocate buffer.
cs_ret_code_t erase(uint8_t appIndex)
Erases storage space of given app.
bool _writing
Keep up whether or not we are currently writing to (or erasing) flash.
Definition: cs_MicroappStorage.h:107
void handleFileStorageEvent(nrf_fstorage_evt_t *evt)
Internal usage: when fstorage is done, this function will be called (indirectly through app_scheduler...
void printHeader(uint8_t logLevel, microapp_binary_header_t &header)
uint8_t _writeBuffer[MICROAPP_STORAGE_BUF_SIZE]
The buffer is required to perform writes to flash, as the data has to be aligned, and stay in memory ...
Definition: cs_MicroappStorage.h:113
uint16_t _chunkSize
Definition: cs_MicroappStorage.h:120
MicroappStorage(MicroappStorage const &)=delete
void onFlashWritten(cs_ret_code_t retCode)
Called when data has been written to flash.
const uint8_t * _chunkData
When writing a chunk of data, it will be done in parts.
Definition: cs_MicroappStorage.h:119
uint16_t _chunkWritten
Definition: cs_MicroappStorage.h:121
MicroappStorage()
Singleton, constructor, also copy constructor, is private.
static MicroappStorage & getInstance()
Definition: cs_MicroappStorage.h:14
uint32_t _chunkFlashAddress
Definition: cs_MicroappStorage.h:122
void resetChunkVars()
To be called when a chunk has been written (or when it failed to write).
cs_ret_code_t writeChunk(uint8_t appIndex, uint16_t offset, const uint8_t *data, uint16_t size)
Write a chunk to flash.
void getAppHeader(uint8_t appIndex, microapp_binary_header_t &header)
Get a copy of the microapp binary header.
bool isErased(uint8_t appIndex)
Checks if storage space of this microapp is erased.
cs_ret_code_t writeNextChunkPart()
Write the next part of a chunk.
void operator=(MicroappStorage const &)=delete
uint32_t getStartInstructionAddress(uint8_t appIndex)
Get the address in flash, where the microapp program starts.
constexpr uint8_t MICROAPP_STORAGE_BUF_SIZE
Definition: cs_MicroappStorage.h:7
uint16_t cs_ret_code_t
Definition: cs_Typedefs.h:21