|
@@ -4,11 +4,12 @@
|
|
|
#![cfg_attr(not(test), no_main)]
|
|
|
|
|
|
// pick a panicking behavior
|
|
|
-#[cfg(not(test))]
|
|
|
-use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
|
|
|
+// #[cfg(not(test))]
|
|
|
+// use panic_halt as _; // you can put a breakpoint on `rust_begin_unwind` to catch panics
|
|
|
// use panic_abort as _; // requires nightly
|
|
|
// use panic_itm as _; // logs messages over ITM; requires ITM support
|
|
|
// use panic_semihosting as _; // logs messages to the host stderr; requires a debugger
|
|
|
+use core::panic::PanicInfo; // custom panic handler
|
|
|
|
|
|
// use cortex_m::asm;
|
|
|
use cortex_m_rt::entry;
|
|
@@ -30,11 +31,20 @@ fn main() -> ! {
|
|
|
let gpioa = &peripherals.GPIOA;
|
|
|
gpioa.odr.modify(|_, w| w.odr0().set_bit());
|
|
|
|
|
|
+ panic!();
|
|
|
+
|
|
|
loop {
|
|
|
// your code goes here
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+#[panic_handler]
|
|
|
+#[cfg(not(test))]
|
|
|
+fn panic(_info: &PanicInfo) -> ! {
|
|
|
+ hprintln!("Panic!").unwrap();
|
|
|
+ loop {}
|
|
|
+}
|
|
|
+
|
|
|
fn add(a: i32, b: i32) -> i32 {
|
|
|
a + b
|
|
|
}
|