Function tock_tbf::parse::parse_tbf_header_lengths

source ·
pub fn parse_tbf_header_lengths(
    app: &'static [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))