diff --git a/Cargo.toml b/Cargo.toml index b8b44a74c9c9b041410584e11092041e88e7f244..3a3532ef17d3fc7c78563661fc58d8b80f2c5aeb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ nb = "0.1.2" [dependencies.cortex-m] version = "0.6.2" -# features = ["inline-asm"] # <- currently requires nightly compiler + features = ["inline-asm"] # <- currently requires nightly compiler [dependencies.cortex-m-rt] version = "0.6.12" diff --git a/examples/bare1.rs b/examples/bare1.rs index acd55f503ad2c9baaaf2fe255cd237a4d67b363e..ce46e5ca1167f739d5ab4589ef0b9b241848fcb9 100644 --- a/examples/bare1.rs +++ b/examples/bare1.rs @@ -59,7 +59,8 @@ fn main() -> ! { // What happens when you continue (second iteration of the loop)? // // ** your answer here ** -// +// The program panics "panicked at 'attempt to add with overflow', examples/bare1.rs:23:9 " + // What is the `ITM` output. // // ** your answer here ** diff --git a/examples/serial.rs b/examples/serial.rs index 3b653dfd74ca9712096778891b5dad09931d0495..2176ac4cb51f16dfe1145618b1710d32da5a0638 100644 --- a/examples/serial.rs +++ b/examples/serial.rs @@ -8,7 +8,6 @@ //! buffer may overflow. #![deny(unsafe_code)] -#![deny(warnings)] #![no_main] #![no_std] @@ -20,12 +19,11 @@ extern crate stm32f4xx_hal as hal; use crate::hal::prelude::*; use crate::hal::serial::{config::Config, Serial}; -use cortex_m::iprintln; - +use cortex_m_semihosting::hprintln; #[entry] fn main() -> ! { let mut c = hal::stm32::CorePeripherals::take().unwrap(); - let stim = &mut c.ITM.stim[0]; + //let stim = &mut c.ITM.stim[0]; let p = hal::stm32::Peripherals::take().unwrap(); @@ -51,13 +49,13 @@ fn main() -> ! { let (mut tx, mut rx) = serial.split(); loop { - match block!(rx.read()) { + match rx.read() { Ok(byte) => { - iprintln!(stim, "Ok {:?}", byte); + hprintln!("Ok {:?}", byte).unwrap(); let _ = tx.write(byte); } Err(err) => { - iprintln!(stim, "Error {:?}", err); + hprintln!( "Error {:?}", err).unwrap(); } } }