Crates.io | imxrt-uart-panic |
lib.rs | imxrt-uart-panic |
version | 0.2.0 |
source | src |
created_at | 2023-11-03 22:58:53.536815 |
updated_at | 2024-06-23 19:25:17.653392 |
description | Panic handler for i.MX RT that reports to UART. |
homepage | |
repository | https://github.com/imxrt-rs/imxrt-uart-panic |
max_upload_size | |
id | 1024734 |
size | 40,348 |
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.
- 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.