/// Boots into a given memory bank.
Boots into a given memory bank.
Boots into a given memory bank .
pub fn boot(&mut self, image: Image<MCUF::Address>) -> Result<!, Error> {
        warn!("Jumping to a new firmware image. This will break `defmt`.");
        let image_location_raw: usize = image.location().into();
        let time_ms = self.start_time.and_then(|t| Some((T::now() - t).0));
        self.boot_metrics.boot_time_ms = time_ms;
        // NOTE(Safety): Thoroughly unsafe operations, for obvious reasons: We are jumping to an
        // entirely different firmware image! We have to assume everything is at the right place,
        // or literally anything could happen here. No turning back after entering this unsafe block.
        unsafe {
            let initial_stack_pointer = *(image_location_raw as *const u32);
            let reset_handler_pointer =
                *((image_location_raw + size_of::<u32>()) as *const u32) as *const ();
            let reset_handler = core::mem::transmute::<*const (), fn() -> !>(reset_handler_pointer);
            (*SCB::ptr()).vtor.write(image_location_raw as u32);
            *boot_metrics_mut() = self.boot_metrics.clone();
            #[allow(deprecated)]
            cortex_m::register::msp::write(initial_stack_pointer);
            reset_handler()
        }
    }
pub fn boot ( & mut self , image : Image < MCUF :: Address > ) -> Result < ! , Error > { warn ! ( " " ) ; let image_location_raw : usize = image . location ( ) . into ( ) ; let time_ms = self . start_time . and_then ( | t | Some ( ( T :: now ( ) - t ) . 0 ) ) ; self . boot_metrics . boot_time_ms = time_ms ; // NOTE(Safety): Thoroughly unsafe operations, for obvious reasons: We are jumping to an // entirely different firmware image! We have to assume everything is at the right place, // or literally anything could happen here. No turning back after entering this unsafe block. unsafe { let initial_stack_pointer = * ( image_location_raw as * const u32 ) ; let reset_handler_pointer = * ( ( image_location_raw + size_of :: < u32 > ( ) ) as * const u32 ) as * const ( ) ; let reset_handler = core :: mem :: transmute :: < * const ( ) , fn ( ) -> ! > ( reset_handler_pointer ) ; ( * SCB :: ptr ( ) ) . vtor . write ( image_location_raw as u32 ) ; * boot_metrics_mut ( ) = self . boot_metrics . clone ( ) ; # [ allow ( deprecated ) ] cortex_m :: register :: msp :: write ( initial_stack_pointer ) ; reset_handler ( ) } }
Boots into a given memory bank.
Boots into a given memory bank .
&mut self
image
Image<MCUF::Address>