panics.rs 555 B

1234567891011121314151617181920212223242526272829
  1. //! Prints "Hello, world" on the OpenOCD console
  2. #![deny(unsafe_code)]
  3. #![deny(warnings)]
  4. #![no_main]
  5. #![no_std]
  6. extern crate panic_semihosting;
  7. //extern crate panic_itm;
  8. extern crate stm32f1xx_hal;
  9. use cortex_m_semihosting::hprintln;
  10. use cortex_m_rt::{entry, exception, ExceptionFrame};
  11. #[entry]
  12. fn main() -> ! {
  13. hprintln!("Hello, world!").unwrap();
  14. loop {}
  15. }
  16. #[exception]
  17. fn HardFault(ef: &ExceptionFrame) -> ! {
  18. panic!("{:#?}", ef);
  19. }
  20. #[exception]
  21. fn DefaultHandler(irqn: i16) {
  22. panic!("Unhandled exception (IRQn = {})", irqn);
  23. }