Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bobmcwhirter/c0c2c8f2179d6f70578e6aa94a2f4da8 to your computer and use it in GitHub Desktop.
Save bobmcwhirter/c0c2c8f2179d6f70578e6aa94a2f4da8 to your computer and use it in GitHub Desktop.
#![no_std]
#![feature(asm)]
#![no_main]
use cortex_m_rt::entry;
use panic_halt as _;
extern crate stm32f1xx_hal;
#[entry]
unsafe fn boot() -> ! {
let sp: * const u32 = 0x08008000 as *const _;
let sp_val:u32 = *sp;
let reset: *const u32 = 0x08008004 as *const _;
let reset_val:u32 = (*reset) as u32;
do_jump( sp_val, reset_val );
loop {}
}
pub unsafe extern "C" fn do_jump(_sp: u32, _t: u32) -> () {
asm! {
"msr msp, r0",
};
asm! {
"blx r1"
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment