From 776be79f7bb10b09e795e2ea93bb795a653c9b4c Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Fri, 24 Jun 2022 19:56:15 +0200 Subject: Move bootloader main to examples This should remove some confusion around embassy-boot-* being a library vs. a binary. The binary is now an example bootloader instead. --- embassy-boot/nrf/src/main.rs | 48 -------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 embassy-boot/nrf/src/main.rs (limited to 'embassy-boot/nrf/src') diff --git a/embassy-boot/nrf/src/main.rs b/embassy-boot/nrf/src/main.rs deleted file mode 100644 index bc7e0755f..000000000 --- a/embassy-boot/nrf/src/main.rs +++ /dev/null @@ -1,48 +0,0 @@ -#![no_std] -#![no_main] - -use cortex_m_rt::{entry, exception}; -#[cfg(feature = "defmt")] -use defmt_rtt as _; -use embassy_boot_nrf::*; -use embassy_nrf::nvmc::Nvmc; - -#[entry] -fn main() -> ! { - let p = embassy_nrf::init(Default::default()); - - // Uncomment this if you are debugging the bootloader with debugger/RTT attached, - // as it prevents a hard fault when accessing flash 'too early' after boot. - /* - for i in 0..10000000 { - cortex_m::asm::nop(); - } - */ - - let mut bl = BootLoader::default(); - let start = bl.prepare(&mut SingleFlashProvider::new(&mut WatchdogFlash::start( - Nvmc::new(p.NVMC), - p.WDT, - 5, - ))); - unsafe { bl.load(start) } -} - -#[no_mangle] -#[cfg_attr(target_os = "none", link_section = ".HardFault.user")] -unsafe extern "C" fn HardFault() { - cortex_m::peripheral::SCB::sys_reset(); -} - -#[exception] -unsafe fn DefaultHandler(_: i16) -> ! { - const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; - let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; - - panic!("DefaultHandler #{:?}", irqn); -} - -#[panic_handler] -fn panic(_info: &core::panic::PanicInfo) -> ! { - cortex_m::asm::udf(); -} -- cgit