#panic-handler #imxrt #panic #error-message

no-std imxrt-uart-panic

Panic handler for i.MX RT that reports to UART

4 releases

0.2.0 Jun 23, 2024
0.1.2 Nov 8, 2023
0.1.1 Nov 3, 2023
0.1.0 Nov 3, 2023

#1679 in Embedded development

Download history 6/week @ 2024-09-10 3/week @ 2024-09-17 10/week @ 2024-09-24 1/week @ 2024-10-01

211 downloads per month
Used in teensy4-selfrebootor

MIT/Apache

14KB
79 lines

imxrt-uart-panic

Crates.io Crates.io License Build Status docs.rs

This crate provides a UART based panic handler for i.MX RT.

Upon panic, it resets the given UART peripheral and writes an error message to it.

Usage Example

- examples are intended for the Teensy 4.0, Teensy 4.1 or Teensy MicroMod board -

#![no_std]
#![no_main]

use teensy4_bsp as bsp;

use bsp::pins::common::{P0, P1};
imxrt_uart_panic::register!(LPUART6, P1, P0, 115200);

#[bsp::rt::entry]
fn main() -> ! {
    panic!("Foo!");
}
panicked at examples\minimal.rs:11:5:
Foo!

Additionally, one can provide a custom panic action, such as teensy4_panic::sos, that will be executed after printing to UART:

#![no_std]
#![no_main]

use teensy4_bsp as bsp;

use bsp::pins::common::{P0, P1};
imxrt_uart_panic::register!(LPUART6, P1, P0, 115200, teensy4_panic::sos);

#[bsp::rt::entry]
fn main() -> ! {
    panic!("Foo!");
}

This crate is fully compatible with other previous usages of the given UART peripheral, although it might abort transmissions that are already in progress.

Dependencies

~26MB
~722K SLoC