From 8ee09500054e2b88e8ec3dfd45f1691cd98c3493 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20J=C3=B6rdens?= Date: Fri, 7 Jun 2019 11:26:24 +0200 Subject: [PATCH] panic: turn red leds on --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ce3f3d8..9b4c25b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,8 +4,16 @@ // Enable returning `!` #![feature(never_type)] +#[inline(never)] +#[panic_handler] #[cfg(not(feature = "semihosting"))] -extern crate panic_abort; +fn panic(_info: &core::panic::PanicInfo) -> ! { + let dp = unsafe { pac::Peripherals::steal() }; + dp.GPIOD.odr.modify(|_, w| w.odr6().high()); // FP_LED_1 + dp.GPIOG.odr.modify(|_, w| w.odr4().high()); // FP_LED_3 + loop { core::sync::atomic::compiler_fence(core::sync::atomic::Ordering::SeqCst); } +} + #[cfg(feature = "semihosting")] extern crate panic_semihosting;