software_dfu #46

Merged
sb10q merged 8 commits from software_dfu into master 2021-01-13 11:59:06 +08:00
2 changed files with 5 additions and 8 deletions
Showing only changes of commit 251e4d3dd4 - Show all commits

View File

@ -2,10 +2,11 @@ use cortex_m_rt::{pre_init};
const DFU_TRIG_MSG: u32 = 0xDECAFBAD;
extern "C" {
static mut _dfu_msg: u32;
}
pub unsafe fn set_dfu_trigger() {
extern "C" {
static mut _dfu_msg: u32;
}
_dfu_msg = DFU_TRIG_MSG;
}
@ -14,10 +15,6 @@ pub unsafe fn set_dfu_trigger() {
/// bootloader expects MCU to be in reset state when called.
#[pre_init]
unsafe fn __pre_init() {
extern "C" {
static mut _dfu_msg: u32;
}
if _dfu_msg == DFU_TRIG_MSG {
_dfu_msg = 0x00000000;

View File

@ -431,7 +431,7 @@ fn main() -> ! {
unsafe {
dfu::set_dfu_trigger();
}
socket.close();
SCB::sys_reset();
}
}