diff --git a/examples/rtt_timing.rs b/examples/rtt_timing.rs index 52fc758af8adc932a820fae97052468f838100c1..9fe4aa61092a1c3e9207297fb67f9f9ec80324e1 100644 --- a/examples/rtt_timing.rs +++ b/examples/rtt_timing.rs @@ -1,42 +1,28 @@ //! examples/rtt_timing.rs -// #![deny(unsafe_code)] +#![deny(unsafe_code)] #![deny(warnings)] #![no_main] #![no_std] use cortex_m::{asm, peripheral::DWT}; -use panic_rtt_target as _; -use rtt_target::{rprintln, rtt_init_print}; +use panic_halt as _; +//use panic_rtt_target as _; use stm32f4; #[rtic::app(device = stm32f4)] const APP: () = { #[init] fn init(mut cx: init::Context) { - rtt_init_print!(); - rprintln!("init"); - // Initialize (enable) the monotonic timer (CYCCNT) cx.core.DCB.enable_trace(); cx.core.DWT.enable_cycle_counter(); - rprintln!("start timed_loop"); - unsafe { - cx.core.DWT.cyccnt.write(0); - } - let (start, end) = timed_loop(); - rprintln!( - "start {}, end {}, diff {}", - start, - end, - end.wrapping_sub(start) - ); + let (_start, _end) = timed_loop(); } #[idle] fn idle(_cx: idle::Context) -> ! { - rprintln!("idle"); loop { continue; } @@ -392,6 +378,11 @@ fn timed_loop() -> (u32, u32) { // > cargo size --example rtt_timing --release --features nightly // // [Your answer here] +// +// Compiling app v0.1.0 (/home/niklas/Desktop/D7020E/rtic_f4xx_nucleo) +// Finished release [optimized + debuginfo] target(s) in 0.63s +// text data bss dec hex filename +// 660 0 0 660 294 rtt_timing // // I was able to get down to: // > cargo size --example rtt_timing --release --features nightly