dfu: cleanup
This commit is contained in:
parent
2e6116016a
commit
251e4d3dd4
11
src/dfu.rs
11
src/dfu.rs
@ -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;
|
||||
|
||||
|
@ -431,7 +431,7 @@ fn main() -> ! {
|
||||
unsafe {
|
||||
dfu::set_dfu_trigger();
|
||||
}
|
||||
socket.close();
|
||||
|
||||
SCB::sys_reset();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user