use crate::Address;
pub trait Processor {
fn do_jump(&mut self, address: Address) -> !;
fn setup(&mut self, config: &crate::hardware::Config);
}
#[cfg(feature = "cortex-m")]
pub mod cortex_m {
use super::Processor;
pub struct CortexM {}
impl CortexM {
pub fn new() -> Self {
Self {}
}
}
impl Processor for CortexM {
fn do_jump(&mut self, address: super::Address) -> ! {
unsafe {
(*cortex_m::peripheral::SCB::ptr()).vtor.write(address);
cortex_m::asm::bootload(address as *const u32);
}
}
fn setup(&mut self, config: &crate::hardware::Config) {
}
}
}