//! Disables the JTAG ports to give access to pb3, pb4 and PA15 #![deny(unsafe_code)] #![deny(warnings)] #![no_main] #![no_std] extern crate cortex_m_rt as rt; extern crate panic_semihosting; extern crate stm32f1xx_hal as hal; use hal::prelude::*; use hal::stm32f103xx; use rt::{entry, exception, ExceptionFrame}; #[entry] fn main() -> ! { let p = stm32f103xx::Peripherals::take().unwrap(); let mut rcc = p.RCC.constrain(); let mut gpiob = p.GPIOB.split(&mut rcc.apb2); let mut afio = p.AFIO.constrain(&mut rcc.apb2); afio.mapr.disable_jtag(); gpiob.pb4.into_push_pull_output(&mut gpiob.crl).set_low(); loop {} } #[exception] fn HardFault(ef: &ExceptionFrame) -> ! { panic!("{:#?}", ef); } #[exception] fn DefaultHandler(irqn: i16) { panic!("Unhandled exception (IRQn = {})", irqn); }