diff --git a/xtensa-lx-rt/src/exception.rs b/xtensa-lx-rt/src/exception.rs index a088e4f3fe3..c24efaa887e 100644 --- a/xtensa-lx-rt/src/exception.rs +++ b/xtensa-lx-rt/src/exception.rs @@ -33,7 +33,7 @@ pub use context::Context; /// general exceptions, which vector to the user, kernel, or double-exception /// vectors). #[allow(unused)] -#[derive(Debug)] +#[derive(Debug, PartialEq)] #[repr(C)] pub enum ExceptionCause { /// Illegal Instruction diff --git a/xtensa-lx-rt/src/exception/context.rs b/xtensa-lx-rt/src/exception/context.rs index 08ba0cf4f43..1ea82fd1d47 100644 --- a/xtensa-lx-rt/src/exception/context.rs +++ b/xtensa-lx-rt/src/exception/context.rs @@ -134,6 +134,14 @@ unsafe extern "C" fn __default_exception(cause: ExceptionCause, save_frame: &mut #[no_mangle] #[link_section = ".rwtext"] extern "C" fn __default_user_exception(cause: ExceptionCause, save_frame: &Context) { + #[cfg(any(feature = "esp32", feature = "esp32s3"))] + if cause == ExceptionCause::Cp0Disabled { + panic!( + "The floating point coprocessor is disabled. You may want to enable the `float-save-restore` feature of the `xtensa-lx-rt` crate. {:08x?}", + save_frame + ) + } + panic!("Exception: {:?}, {:08x?}", cause, save_frame) }