GBL Parser
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
| enum EblParserState_t |
State in the EBL parser state machine.
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
-
contextGBL parser context bufferInput buffer containing data to be written lengthSize of input buffer callbacksGBL 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
-
contextGBL parser context inputInput data outputBufferOutput data outputLengthOutput data length applySHAUpdate SHA256 in the GBL parser context decryptDecrypt the output data
- Returns
- Error code