dfu: clean up

This commit is contained in:
topquark12 2021-01-12 15:36:29 +08:00
parent c861f2df83
commit e41415f82c
2 changed files with 3 additions and 37 deletions

View File

@ -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;

View File

@ -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");
// }
// }