blob: 2f100a209ca66904cbbedc875a3a0dabaae04745 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
//! How to override the hard fault exception handler and the default exception handler
#![deny(unsafe_code)]
#![deny(warnings)]
#![no_main]
#![no_std]
extern crate cortex_m;
#[macro_use(entry, exception)]
extern crate cortex_m_rt as rt;
extern crate panic_semihosting;
use cortex_m::asm;
use rt::ExceptionFrame;
// the program entry point
entry!(main);
fn main() -> ! {
loop {}
}
exception!(*, default_handler);
fn default_handler(_irqn: i16) {
asm::bkpt();
}
exception!(HardFault, hard_fault);
fn hard_fault(_ef: &ExceptionFrame) -> ! {
asm::bkpt();
loop {}
}
|