Soft panic for RTIO PLL reasons #199
|
@ -6,6 +6,7 @@ use unwind::backtrace;
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
#[cfg(feature = "target_kasli_soc")]
|
||||||
use libboard_zynq::error_led::ErrorLED;
|
use libboard_zynq::error_led::ErrorLED;
|
||||||
use crate::comms::soft_panic_main;
|
use crate::comms::soft_panic_main;
|
||||||
|
use log::error;
|
||||||
use libboard_zynq::timer::GlobalTimer;
|
use libboard_zynq::timer::GlobalTimer;
|
||||||
use libconfig::Config;
|
use libconfig::Config;
|
||||||
|
|
||||||
|
@ -15,15 +16,8 @@ static mut SOFT_PANICKED: bool = false;
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic(info: &core::panic::PanicInfo) -> ! {
|
fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
let id = MPIDR.read().cpu_id() as usize;
|
let id = MPIDR.read().cpu_id() as usize;
|
||||||
print!("Core {} ", id);
|
|
||||||
#[cfg(feature = "target_kasli_soc")]
|
|
||||||
{
|
|
||||||
let mut err_led = ErrorLED::error_led();
|
|
||||||
err_led.toggle(true);
|
|
||||||
}
|
|
||||||
let soft_panicked = unsafe { SOFT_PANICKED };
|
let soft_panicked = unsafe { SOFT_PANICKED };
|
||||||
|
print!("Core {} panic at ", id);
|
||||||
print!("panic at ");
|
|
||||||
if let Some(location) = info.location() {
|
if let Some(location) = info.location() {
|
||||||
print!("{}:{}:{}", location.file(), location.line(), location.column());
|
print!("{}:{}:{}", location.file(), location.line(), location.column());
|
||||||
} else {
|
} else {
|
||||||
|
@ -35,6 +29,7 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
println!("");
|
println!("");
|
||||||
}
|
}
|
||||||
unsafe {
|
unsafe {
|
||||||
|
// soft panics only allowed for core 0
|
||||||
if PANICKED[id] && (SOFT_PANICKED || id == 1) {
|
if PANICKED[id] && (SOFT_PANICKED || id == 1) {
|
||||||
println!("nested panic!");
|
println!("nested panic!");
|
||||||
loop {}
|
loop {}
|
||||||
|
@ -42,9 +37,13 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
SOFT_PANICKED = true;
|
SOFT_PANICKED = true;
|
||||||
PANICKED[id] = true;
|
PANICKED[id] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !soft_panicked && id == 0 {
|
if !soft_panicked && id == 0 {
|
||||||
soft_panic();
|
soft_panic(info);
|
||||||
|
}
|
||||||
|
#[cfg(feature = "target_kasli_soc")]
|
||||||
|
{
|
||||||
|
let mut err_led = ErrorLED::error_led();
|
||||||
|
err_led.toggle(true);
|
||||||
}
|
}
|
||||||
println!("Backtrace: ");
|
println!("Backtrace: ");
|
||||||
let _ = backtrace(|ip| {
|
let _ = backtrace(|ip| {
|
||||||
|
@ -56,8 +55,16 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
loop {}
|
loop {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn soft_panic() -> ! {
|
fn soft_panic(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
// log panic info to log (prints not visible in coremgmt logs)
|
||||||
|
if let Some(location) = info.location() {
|
||||||
|
error!("panic at {}:{}:{}", location.file(), location.line(), location.column());
|
||||||
|
} else {
|
||||||
|
error!("panic at unknown location");
|
||||||
|
}
|
||||||
|
if let Some(message) = info.message() {
|
||||||
|
error!("panic message: {}", message);
|
||||||
|
}
|
||||||
let timer = GlobalTimer::start();
|
let timer = GlobalTimer::start();
|
||||||
let cfg = match Config::new() {
|
let cfg = match Config::new() {
|
||||||
Ok(cfg) => cfg,
|
Ok(cfg) => cfg,
|
||||||
|
|
Loading…
Reference in New Issue