-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
207 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
use defmt::Debug2Format; | ||
use esp_backtrace::arch; | ||
|
||
#[panic_handler] | ||
fn panic_handler(info: &core::panic::PanicInfo) -> ! { | ||
use defmt::println; | ||
|
||
println!(" "); | ||
println!(" "); | ||
|
||
if let Some(location) = info.location() { | ||
let (file, line, column) = (location.file(), location.line(), location.column()); | ||
println!( | ||
"!! A panic occured in '{}', at line {}, column {}", | ||
file, line, column | ||
); | ||
} else { | ||
println!("!! A panic occured at an unknown location"); | ||
} | ||
|
||
println!(" "); | ||
println!("{:#?}", Debug2Format(info)); | ||
println!(" "); | ||
println!("Backtrace:"); | ||
println!(" "); | ||
|
||
for e in arch::backtrace() { | ||
if let Some(addr) = e { | ||
println!("{:#X}", addr); | ||
} | ||
} | ||
|
||
halt(); | ||
} | ||
|
||
#[no_mangle] | ||
#[link_section = ".rwtext"] | ||
unsafe fn __user_exception(cause: arch::ExceptionCause, context: arch::Context) { | ||
use defmt::println; | ||
|
||
println!("\n\nException occured '{:?}'", Debug2Format(&cause)); | ||
println!("{:?}", Debug2Format(&context)); | ||
|
||
for e in arch::backtrace() { | ||
if let Some(addr) = e { | ||
println!("{:#X}", addr); | ||
} | ||
} | ||
|
||
println!(""); | ||
println!(""); | ||
println!(""); | ||
|
||
halt(); | ||
} | ||
|
||
fn halt() -> ! { | ||
mod registers { | ||
pub(crate) const SW_CPU_STALL: u32 = 0x600080bc; | ||
pub(crate) const OPTIONS0: u32 = 0x60008000; | ||
} | ||
|
||
let sw_cpu_stall = registers::SW_CPU_STALL as *mut u32; | ||
let options0 = registers::OPTIONS0 as *mut u32; | ||
|
||
unsafe { | ||
sw_cpu_stall.write_volatile( | ||
sw_cpu_stall.read_volatile() & !(0b111111 << 20) & !(0b111111 << 26) | ||
| (0x21 << 20) | ||
| (0x21 << 26), | ||
); | ||
options0.write_volatile(options0.read_volatile() & !(0b1111) | 0b1010); | ||
} | ||
|
||
loop {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.