Skip to content

Commit 897c92e

Browse files
authored
Try to be more helpful (#2044)
1 parent aacc001 commit 897c92e

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

xtensa-lx-rt/src/exception.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub use context::Context;
3333
/// general exceptions, which vector to the user, kernel, or double-exception
3434
/// vectors).
3535
#[allow(unused)]
36-
#[derive(Debug)]
36+
#[derive(Debug, PartialEq)]
3737
#[repr(C)]
3838
pub enum ExceptionCause {
3939
/// Illegal Instruction

xtensa-lx-rt/src/exception/context.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ unsafe extern "C" fn __default_exception(cause: ExceptionCause, save_frame: &mut
134134
#[no_mangle]
135135
#[link_section = ".rwtext"]
136136
extern "C" fn __default_user_exception(cause: ExceptionCause, save_frame: &Context) {
137+
#[cfg(any(feature = "esp32", feature = "esp32s3"))]
138+
if cause == ExceptionCause::Cp0Disabled {
139+
panic!(
140+
"Access to the floating point coprocessor is not allowed. You may want to enable the `float-save-restore` feature of the `xtensa-lx-rt` crate. {:08x?}",
141+
save_frame
142+
)
143+
}
144+
137145
panic!("Exception: {:?}, {:08x?}", cause, save_frame)
138146
}
139147

0 commit comments

Comments
 (0)