Description

GBL parser implementation.

Image parser for GBL files. Parses GBL files based on the GBL file format specification . Callbacks are used to present data and metadata contents of the GBL file to the bootloader.

Modules

Custom GBL Tags
Handle custom GBL tags for added functionality in the GBL parser.
GBL Format
GBL file specification.

Data Structures

struct ParserContext_t
Image parser context definition.
struct GblInputBuffer_t
GBL parser input buffer.

Macros

#define PARSER_FLAG_ENCRYPTED (1U << 0U)
GBL file is encrypted.
#define PARSER_FLAG_IS_EBLV2 (1U << 3U)
File is an EBL (version 2)
#define PARSER_FLAG_PARSE_CUSTOM_TAGS (1U << 5U)
Parse custom tags rather than silently traversing them.
#define PARSER_FLAGS_PUBLIC_MASK PARSER_FLAG_PARSE_CUSTOM_TAGS
Some flags are public, some are internal to the parser.
#define GBL_PARSER_BUFFER_SIZE 64UL
GBL parser buffer size.

Enumerations

enum EblParserState_t {
EblParserStateInit ,
EblParserStateIdle ,
EblParserStateHeader ,
EblParserStateHeaderV2 ,
EblParserStateBootloader ,
EblParserStateBootloaderData ,
EblParserStateApplication ,
EblParserStateMetadata ,
EblParserStateMetadataData ,
EblParserStateProg ,
EblParserStateProgData ,
EblParserStateSe ,
EblParserStateSeData ,
EblParserStateEraseProg ,
EblParserStateFinalize ,
EblParserStateDone ,
EblParserStateEncryptionInit ,
EblParserStateEncryptionContainer ,
EblParserStateSignature ,
EblParserStateCustomTag ,
EblParserStateError
}
State in the EBL parser state machine.

Functions

int32_t gbl_writeProgData ( ParserContext_t *context, uint8_t buffer[], size_t length, const BootloaderParserCallbacks_t *callbacks)
int32_t gbl_getData ( ParserContext_t *context, GblInputBuffer_t *input, uint8_t outputBuffer[], size_t outputLength, bool applySHA, bool decrypt)

Enumeration Type Documentation

State in the EBL parser state machine.

Enumerator
EblParserStateInit

Initial state.

EblParserStateIdle

Idle state.

EblParserStateHeader

Parsing header tag.

EblParserStateHeaderV2

Parsing V2 header tag.

EblParserStateBootloader

Parsing bootloader tag.

EblParserStateBootloaderData

Parsing bootloader tag data.

EblParserStateApplication

Parsing application tag.

EblParserStateMetadata

Parsing metadata tag.

EblParserStateMetadataData

Parsing metadata tag data.

EblParserStateProg

Parsing flash program tag.

EblParserStateProgData

Parsing flash program tag data.

EblParserStateSe

Parsing SE tag.

EblParserStateSeData

Parsing SE tag data.

EblParserStateEraseProg

Parsing flash erase&program tag.

EblParserStateFinalize

Finalizing file.

EblParserStateDone

Parsing complete.

EblParserStateEncryptionInit

Parsing encryption init tag.

EblParserStateEncryptionContainer

Parsing encryption data tag.

EblParserStateSignature

Parsing signature tag.

EblParserStateCustomTag

Parsing custom tag.

EblParserStateError

Error state.

Definition at line 68 of file btl_ebl_parser.h .

Function Documentation

int32_t gbl_writeProgData ( ParserContext_t * context,
uint8_t buffer[],
size_t length,
const BootloaderParserCallbacks_t * callbacks
)

Write application data. This function is called when parsing any tag with EblProg_t structured content.

Parameters
context GBL parser context
buffer Input buffer containing data to be written
length Size of input buffer
callbacks GBL Parser callbacks for writing data
Returns
Error code
int32_t gbl_getData ( ParserContext_t * context,
GblInputBuffer_t * input,
uint8_t outputBuffer[],
size_t outputLength,
bool applySHA,
bool decrypt
)

Get data from storage and internal input buffer. This function advances the parser state.

Parameters
context GBL parser context
input Input data
outputBuffer Output data
outputLength Output data length
applySHA Update SHA256 in the GBL parser context
decrypt Decrypt the output data
Returns
Error code