Image ParserPlugin

Description

Image parser plugin.

Generic image parser interface for Silicon Labs bootloader.

Modules

GBL Parser
GBL parser implementation.

Data Structures

struct ImageProperties_t
Structure containing state of the image file processed.

Macros

#define BTL_IMAGE_CONTENT_APPLICATION 0x01U
Upgrade image contains application upgrade.
#define BTL_IMAGE_CONTENT_BOOTLOADER 0x02U
Upgrade image contains bootloader upgrade.
#define BTL_IMAGE_CONTENT_SE 0x04U
Upgrade image contains SE upgrade.
#define BTL_IMAGE_INSTRUCTION_APPLICATION 0x01U
Application upgrade should be applied from upgrade image.
#define BTL_IMAGE_INSTRUCTION_BOOTLOADER 0x02U
Bootloader upgrade should be applied from upgrade image.
#define BTL_IMAGE_INSTRUCTION_SE 0x04U
SE upgrade should be applied from upgrade image.

Functions

int32_t parser_init (void *context, void *decryptContext, void *authContext, uint8_t flags)
int32_t parser_parse (void *context, ImageProperties_t *imageProperties, uint8_t buffer[], size_t length, const BootloaderParserCallbacks_t *callbacks)
bool parser_requireAuthenticity (void)
bool parser_requireConfidentiality (void)
uint32_t parser_getApplicationAddress (void)
uint32_t parser_getBootloaderUpgradeAddress (void)
bool parser_applicationUpgradeValidCallback ( ApplicationData_t *app)

Function Documentation

int32_t parser_init ( void * context,
void * decryptContext,
void * authContext,
uint8_t flags
)

Initialize the parser's context

Parameters
context Pointer to context for the parser implementation
decryptContext Pointer to context for decryption of parsed file
authContext Pointer to context for authentication of parsed file
flags Flags for parser support
Returns
BOOTLOADER_OK if OK, error code otherwise.
int32_t parser_parse ( void * context,
ImageProperties_t * imageProperties,
uint8_t buffer[],
size_t length,
const BootloaderParserCallbacks_t * callbacks
)

Parse an image file in order to extract the binary and some metadata.

Pushes data into the image file parser to be parsed.

Parameters
context Pointer to the specific parser's context variable
imageProperties Pointer to the image file state variable
buffer Pointer to byte array containing data to parse
length Size in bytes of the data in buffer
callbacks Struct containing function pointers to be called by the parser to pass the extracted binary data back to BTL.
Returns
BOOTLOADER_OK if OK, error code otherwise.
bool parser_requireAuthenticity ( void )

Check whether the parser requires images to be signed

Returns
True if authenticity is required, else false
bool parser_requireConfidentiality ( void )

Check whether the parser requires images to be encrypted

Returns
True if confidentiality is required, else false
uint32_t parser_getApplicationAddress ( void )

Return the start address of the application

Returns
start address of the application
uint32_t parser_getBootloaderUpgradeAddress ( void )

Return the start address of the bootloader upgrade location

Returns
start address of the bootloader upgrade location if upgrading is supported, otherwise 0.
bool parser_applicationUpgradeValidCallback ( ApplicationData_t * app )

Callback to tell the parser whether to accept the application upgrade present in the upgrade image.

Parameters
[in] app Pointer to the application data structure contained in the upgrade image.
Returns
True if the application is accepted, and the parser should continue. False if the application is rejected. If rejected, the parser will abort parsing the image file and return BOOTLOADER_ERROR_PARSER_REJECTED .