Skip to main content

check_size

Function check_size 

Source
pub const fn check_size(firmware: &[u8]) -> Result<(), LoadError>
Expand description

Checks an image before any of it goes out.

§Arguments

  • firmware - the image the caller holds.

§Returns

Ok(()) when it is the size a microcontroller holds.

§Errors

Returns LoadError::WrongSize otherwise, rather than writing a truncated image and leaving the chip to fail its own parity check later.