From e41415f82ced313e4f440c318f7dbac88ea13e7d Mon Sep 17 00:00:00 2001 From: topquark12 Date: Tue, 12 Jan 2021 15:36:29 +0800 Subject: [PATCH] dfu: clean up --- src/dfu.rs | 4 ++-- src/main.rs | 36 +----------------------------------- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/src/dfu.rs b/src/dfu.rs index 0668a88..0e40935 100644 --- a/src/dfu.rs +++ b/src/dfu.rs @@ -3,10 +3,10 @@ use cortex_m_rt::{pre_init}; /// RAM location used to store DFU trigger message const DFU_MSG_ADDR: usize = 0x2001BC00; -/// DFU trigger message +/// DFU trigger message const DFU_TRIG_MSG: usize = 0xDECAFBAD; -/// Set DFU trigger message +/// Set DFU trigger pub unsafe fn trig_dfu() { let dfu_msg_addr = DFU_MSG_ADDR as *mut usize; *dfu_msg_addr = DFU_TRIG_MSG; diff --git a/src/main.rs b/src/main.rs index 0bae17a..142278f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use log::{error, info, warn}; use core::fmt::Write; use cortex_m::asm::wfi; -use cortex_m_rt::{entry}; +use cortex_m_rt::entry; use stm32f4xx_hal::{ hal::watchdog::{WatchdogEnable, Watchdog}, rcc::RccExt, @@ -482,37 +482,3 @@ fn main() -> ! { unreachable!() } - -// #[pre_init] -// #[no_mangle] -// unsafe fn __pre_init() { - -// let dfu_msg_addr = DFU_MSG_ADDR as *mut usize; - -// if *dfu_msg_addr == DFU_TRIG_MSG{ - -// *dfu_msg_addr = 0x00000000; - -// const RCC_APB2ENR: *mut u32 = 0xE000_ED88 as *mut u32; -// const RCC_APB2ENR_ENABLE_SYSCFG_CLOCK: u32 = 0x00004000; - -// core::ptr::write_volatile( -// RCC_APB2ENR, -// *RCC_APB2ENR | RCC_APB2ENR_ENABLE_SYSCFG_CLOCK, -// ); - -// const SYSCFG_MEMRMP: *mut u32 = 0x40013800 as *mut u32; -// const SYSCFG_MEMRMP_MAP_ROM: u32 = 0x00000001; - -// core::ptr::write_volatile( -// SYSCFG_MEMRMP, -// *SYSCFG_MEMRMP | SYSCFG_MEMRMP_MAP_ROM, -// ); - -// asm!("LDR R0, =0x1FFF0000"); -// asm!("LDR SP,[R0, #0]"); -// asm!("LDR R0,[R0, #4]"); -// asm!("BX R0"); -// } - -// } \ No newline at end of file