Skip to content

Commit

Permalink
Add panic example for testing defmt panic logging setup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevswims committed Feb 12, 2023
1 parent 2694506 commit aecab39
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/panic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#![no_main]
#![no_std]

use defmt_rtt as _;

use panic_probe as _;

use stm32g4 as _;

use defmt::Format;

#[defmt::panic_handler]
fn panic() -> ! {
cortex_m::asm::udf()
}

pub fn exit() -> ! {
loop {
cortex_m::asm::bkpt();
}
}

#[cortex_m_rt::entry]
fn main() -> ! {
defmt::info!("main");

panic!("Something bad");
// defmt::panic!()
}

0 comments on commit aecab39

Please sign in to comment.