panic: always turn on red leds, and halt
This commit is contained in:
parent
addf743607
commit
843173f29d
|
@ -520,12 +520,6 @@ dependencies = [
|
|||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "panic-halt"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "de96540e0ebde571dc55c73d60ef407c653844e6f9a1e2fdbd40c07b9252d812"
|
||||
|
||||
[[package]]
|
||||
name = "panic-semihosting"
|
||||
version = "0.5.6"
|
||||
|
@ -729,7 +723,6 @@ dependencies = [
|
|||
"mcp23017",
|
||||
"miniconf",
|
||||
"nb 1.0.0",
|
||||
"panic-halt",
|
||||
"panic-semihosting",
|
||||
"paste",
|
||||
"serde",
|
||||
|
|
|
@ -33,7 +33,6 @@ cortex-m-rt = { version = "0.6", features = ["device"] }
|
|||
cortex-m-log = { version = "0.7", features = ["log-integration"] }
|
||||
log = "0.4"
|
||||
panic-semihosting = { version = "0.5", optional = true }
|
||||
panic-halt = "0.2"
|
||||
serde = { version = "1.0", features = ["derive"], default-features = false }
|
||||
heapless = { version = "0.5", features = ["serde"] }
|
||||
cortex-m-rtic = "0.5.5"
|
||||
|
|
|
@ -4,9 +4,6 @@ use stm32h7xx_hal as hal;
|
|||
#[cfg(feature = "semihosting")]
|
||||
use panic_semihosting as _;
|
||||
|
||||
#[cfg(not(any(feature = "nightly", feature = "semihosting")))]
|
||||
use panic_halt as _;
|
||||
|
||||
mod adc;
|
||||
mod afe;
|
||||
mod configuration;
|
||||
|
@ -47,15 +44,15 @@ pub use configuration::{setup, PounderDevices, StabilizerDevices};
|
|||
|
||||
#[inline(never)]
|
||||
#[panic_handler]
|
||||
#[cfg(all(feature = "nightly", not(feature = "semihosting")))]
|
||||
#[cfg(all(not(feature = "semihosting")))]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
let gpiod = unsafe { &*hal::stm32::GPIOD::ptr() };
|
||||
gpiod.odr.modify(|_, w| w.odr6().high().odr12().high()); // FP_LED_1, FP_LED_3
|
||||
#[cfg(feature = "nightly")]
|
||||
core::intrinsics::abort();
|
||||
#[cfg(not(feature = "nightly"))]
|
||||
unsafe {
|
||||
core::intrinsics::abort();
|
||||
// Turn on both red LEDs, FP_LED_1, FP_LED_3
|
||||
gpiod.odr.modify(|_, w| w.odr6().high().odr12().high());
|
||||
loop { // Halt
|
||||
core::sync::atomic::compiler_fence(
|
||||
core::sync::atomic::Ordering::SeqCst,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,8 +60,3 @@ fn panic(_info: &core::panic::PanicInfo) -> ! {
|
|||
fn HardFault(ef: &cortex_m_rt::ExceptionFrame) -> ! {
|
||||
panic!("HardFault at {:#?}", ef);
|
||||
}
|
||||
|
||||
#[cortex_m_rt::exception]
|
||||
fn DefaultHandler(irqn: i16) {
|
||||
panic!("Unhandled exception (IRQn = {})", irqn);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue