tock_tbf::parse

Function parse_tbf_header_lengths

Source
pub fn parse_tbf_header_lengths(
    app: &[u8; 8],
) -> Result<(u16, u16, u32), InitialTbfParseError>
Expand description

Parse the TBF header length and the entire length of the TBF binary.

ยงReturn

If all parsing is successful:

  • Ok((Version, TBF header length, entire TBF length))

If we cannot parse the header because we have run out of flash, or the values are entirely wrong we return UnableToParse. This means we have hit the end of apps in flash.

  • Err(InitialTbfParseError::UnableToParse)

Any other error we return an error and the length of the entire app so that we can skip over it and check for the next app.

  • Err(InitialTbfParseError::InvalidHeader(app_length))