Created
June 22, 2020 13:50
-
-
Save bobmcwhirter/c0c2c8f2179d6f70578e6aa94a2f4da8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![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