/// Programs a buffer's contents into the microcontroller's flash at the given start address.
/// The flash area must have been erased already for this operation to succeed.
Programs a buffer's contents into the microcontroller's flash at the given start address.
The flash area must have been erased already for this operation to succeed.
Programs a buffer ' s contents into the microcontroller ' s flash at the given start address . The flash area must have been erased already for this operation to succeed .
pub fn program_at<'d>(&mut self, data: &'d [u8], address: u32) -> Result<Program<'d, '_, T>> {
        // Ensure that the area to be written to is fully within application flash
        let bootloader_info = self.bootloader_info()?;
        if (bootloader_info.application_base > address)
            || (bootloader_info.application_base as usize + bootloader_info.application_size
                < address as usize + data.len())
        {
            return Err(Error::InvalidRequest);
        }
        // Programing works halfword-wise and will crash if the address is not aligned
        if address % 2 != 0 {
            return Err(Error::InvalidRequest);
        }
        Ok(Program::at(self, data, address))
    }
pub fn program_at < ' d > ( & mut self , data : & ' d [ u8 ] , address : u32 ) -> Result < Program < ' d , ' _ , T > > { // Ensure that the area to be written to is fully within application flash let bootloader_info = self . bootloader_info ( ) ? ; if ( bootloader_info . application_base > address ) || ( bootloader_info . application_base as usize + bootloader_info . application_size < address as usize + data . len ( ) ) { return Err ( Error :: InvalidRequest ) ; } // Programing works halfword-wise and will crash if the address is not aligned if address % 2 != 0 { return Err ( Error :: InvalidRequest ) ; } Ok ( Program :: at ( self , data , address ) ) }
Programs a buffer's contents into the microcontroller's flash at the given start address.
Programs a buffer ' s contents into the microcontroller ' s flash at the given start address .
&mut self
data
&'d [u8]
address
u32