From fa985cb9da6a633080477db21d18181841821bcc Mon Sep 17 00:00:00 2001 From: Grumme2 <agh@live.se> Date: Tue, 31 Mar 2020 16:44:40 +0200 Subject: [PATCH] so i can pull --- Cargo.toml | 2 +- examples/bare1.rs | 3 ++- examples/serial.rs | 12 +++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b8b44a7..3a3532e 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 acd55f5..ce46e5c 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 3b653df..2176ac4 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(); } } } -- GitLab