update the minimal example
This commit is contained in:
@@ -15,14 +15,6 @@
|
|||||||
//! define a panicking behavior is to link to a [panic handler crate][0]
|
//! define a panicking behavior is to link to a [panic handler crate][0]
|
||||||
//!
|
//!
|
||||||
//! [0]: https://crates.io/keywords/panic-impl
|
//! [0]: https://crates.io/keywords/panic-impl
|
||||||
//!
|
|
||||||
//! - Define the `HardFault` handler using the [`exception!`] macro. This handler (function) is
|
|
||||||
//! called when a hard fault exception is raised by the hardware.
|
|
||||||
//!
|
|
||||||
//! [`exception!`]: https://docs.rs/cortex-m-rt/~0.5/cortex_m_rt/macro..html
|
|
||||||
//!
|
|
||||||
//! - Define a default handler using the [`exception!`] macro. This function will be used to handle
|
|
||||||
//! all interrupts and exceptions which have not been assigned a specific handler.
|
|
||||||
|
|
||||||
#![no_main] // <- IMPORTANT!
|
#![no_main] // <- IMPORTANT!
|
||||||
#![no_std]
|
#![no_std]
|
||||||
@@ -47,17 +39,3 @@ fn main() -> ! {
|
|||||||
asm::bkpt();
|
asm::bkpt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// define the hard fault handler
|
|
||||||
exception!(HardFault, hard_fault);
|
|
||||||
|
|
||||||
fn hard_fault(ef: &ExceptionFrame) -> ! {
|
|
||||||
panic!("HardFault at {:#?}", ef);
|
|
||||||
}
|
|
||||||
|
|
||||||
// define the default exception handler
|
|
||||||
exception!(*, default_handler);
|
|
||||||
|
|
||||||
fn default_handler(irqn: i16) {
|
|
||||||
panic!("Unhandled exception (IRQn = {})", irqn);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user