Application Parser Interface#

Application interface for the bootloader image parser.

The Parser Interface can be used to parse upgrade images from the context of the application.

Modules#

BootloaderParserCallbacks_t

Typedefs#

typedef void(*
BootloaderParserCallback_t)(uint32_t address, uint8_t *data, size_t length, void *context)

Bootloader parser callback.

Functions#

int32_t
bootloader_initParser(BootloaderParserContext_t *context, size_t contextSize)

Initialize the image parser.

int32_t
bootloader_parseBuffer(BootloaderParserContext_t *context, BootloaderParserCallbacks_t *callbacks, uint8_t data[], size_t numBytes)

Parse a buffer.

int32_t
bootloader_parseImageInfo(BootloaderParserContext_t *context, uint8_t data[], size_t numBytes, ApplicationData_t *appInfo, uint32_t *bootloaderVersion)

Parse a buffer and get application and bootloader upgrade metadata from the buffer.

uint32_t

Find the size of the context struct BootloaderParserContext used by the bootloader image parser to store parser state.

Typedef Documentation#

BootloaderParserCallback_t#

typedef void(* BootloaderParserCallback_t) (uint32_t address, uint8_t *data, size_t length, void *context) )(uint32_t address, uint8_t *data, size_t length, void *context)

Bootloader parser callback.

Parameters
N/Aaddress

Address of the data

N/Adata

Raw data

N/Alength

Size in bytes of raw data.

N/Acontext

A context variable defined by the implementation that is implementing this callback.


Definition at line 48 of file platform/bootloader/api/btl_interface_parser.h

Function Documentation#

bootloader_initParser#

int32_t bootloader_initParser (BootloaderParserContext_t * context, size_t contextSize)

Initialize the image parser.

Parameters
[in]context

Pointer to the parser context struct.

[in]contextSize

Size of the context struct.

Returns

  • BOOTLOADER_OK if success, BOOTLOADER_ERROR_PARSE_CONTEXT if context struct is too small.


Definition at line 77 of file platform/bootloader/api/btl_interface_parser.h

bootloader_parseBuffer#

int32_t bootloader_parseBuffer (BootloaderParserContext_t * context, BootloaderParserCallbacks_t * callbacks, uint8_t data, size_t numBytes)

Parse a buffer.

Parameters
[in]context

Pointer to the parser context struct.

[in]callbacks

Callbacks to be called by the parser.

[in]data

Data to be parsed.

[in]numBytes

Size of the data buffer.

Returns

  • BOOTLOADER_ERROR_PARSE_CONTINUE if the chunk was parsed correctly, and a new chunk is expected. BOOTLOADER_ERROR_PARSE_ERROR if something went wrong while parsing. BOOTLOADER_ERROR_PARSE_SUCCESS if the entire file was successfully parsed.


Definition at line 93 of file platform/bootloader/api/btl_interface_parser.h

bootloader_parseImageInfo#

int32_t bootloader_parseImageInfo (BootloaderParserContext_t * context, uint8_t data, size_t numBytes, ApplicationData_t * appInfo, uint32_t * bootloaderVersion)

Parse a buffer and get application and bootloader upgrade metadata from the buffer.

Parameters
[in]context

Pointer to the parser context struct.

[in]data

Data to be parsed.

[in]numBytes

Size of the data buffer.

[out]appInfo

Pointer to ApplicationData_t struct.

[out]bootloaderVersion

Pointer to an integer representing bootloader version.

Note

  • appInfo and bootloaderVersion will default to zeros.

Returns


Definition at line 115 of file platform/bootloader/api/btl_interface_parser.h

bootloader_parserContextSize#

uint32_t bootloader_parserContextSize (void )

Find the size of the context struct BootloaderParserContext used by the bootloader image parser to store parser state.

Parameters
N/A

Returns


Definition at line 133 of file platform/bootloader/api/btl_interface_parser.h