WIP main: reboot on panic
TODO: maybe even show a message
This commit is contained in:
parent
17b84d9aec
commit
df8fc19449
2 changed files with 38 additions and 1 deletions
|
|
@ -90,7 +90,6 @@ embedded-io-async = { version = "0.7.0", optional = true }
|
||||||
esp-alloc = { version = "0.10.0", optional = true }
|
esp-alloc = { version = "0.10.0", optional = true }
|
||||||
esp-backtrace = { version = "0.19.0", optional = true, features = [
|
esp-backtrace = { version = "0.19.0", optional = true, features = [
|
||||||
"esp32c5",
|
"esp32c5",
|
||||||
"panic-handler",
|
|
||||||
"println",
|
"println",
|
||||||
] }
|
] }
|
||||||
esp-println = { version = "0.17.0", optional = true, default-features = false, features = ["colors", "critical-section", "jtag-serial", "esp32c5", "log-04"] }
|
esp-println = { version = "0.17.0", optional = true, default-features = false, features = ["colors", "critical-section", "jtag-serial", "esp32c5", "log-04"] }
|
||||||
|
|
|
||||||
38
src/main.rs
38
src/main.rs
|
|
@ -78,6 +78,44 @@ const SERIAL_FIFO_SIZE_THLD: u8 = 100; // hardware has max. 128 byte
|
||||||
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
// For more information see: <https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-reference/system/app_image_format.html#application-description>
|
||||||
esp_bootloader_esp_idf::esp_app_desc!();
|
esp_bootloader_esp_idf::esp_app_desc!();
|
||||||
|
|
||||||
|
// TODO: do the equivalent of CONFIG_ESP_SYSTEM_PANIC_PRINT_REBOOT please
|
||||||
|
#[panic_handler]
|
||||||
|
fn panic_handler(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
esp_println::println!("");
|
||||||
|
esp_println::println!("====================== PANIC ======================");
|
||||||
|
|
||||||
|
esp_println::println!("{}", info);
|
||||||
|
|
||||||
|
// cfg_if::cfg_if! {
|
||||||
|
// if #[cfg(not(stack_dump))]
|
||||||
|
// {
|
||||||
|
// println!("");
|
||||||
|
// println!("Backtrace:");
|
||||||
|
// println!("");
|
||||||
|
|
||||||
|
// let backtrace = Backtrace::capture();
|
||||||
|
// #[cfg(target_arch = "riscv32")]
|
||||||
|
// if backtrace.frames().is_empty() {
|
||||||
|
// println!(
|
||||||
|
// "No backtrace available - make sure to force frame-pointers. (see https://crates.io/crates/esp-backtrace)"
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// for frame in backtrace.frames() {
|
||||||
|
// println!("0x{:x}", frame.program_counter());
|
||||||
|
// }
|
||||||
|
// } else {
|
||||||
|
// arch::dump_stack();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
esp_println::println!("");
|
||||||
|
esp_println::println!("");
|
||||||
|
esp_println::println!("");
|
||||||
|
|
||||||
|
// reboot
|
||||||
|
esp_hal::system::software_reset();
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "_gnss")]
|
#[cfg(feature = "_gnss")]
|
||||||
static GNSS_UPDATE: Mutex<RefCell<Option<applogic::GnssFix>>> = Mutex::new(RefCell::new(None));
|
static GNSS_UPDATE: Mutex<RefCell<Option<applogic::GnssFix>>> = Mutex::new(RefCell::new(None));
|
||||||
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
|
static WIFI_RX_QUEUE: Mutex<RefCell<Option<ArrayQueue<Vec<u8>>>>> = Mutex::new(RefCell::new(None));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue