panics.rs 524 B

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