Skip to content
Snippets Groups Projects
Commit 89f4fe38 authored by Anton's avatar Anton
Browse files

bare3 complete

parent 57ad9388
No related branches found
No related tags found
No related merge requests found
...@@ -10,8 +10,6 @@ ...@@ -10,8 +10,6 @@
#![no_main] #![no_main]
#![no_std] #![no_std]
use core::time::Duration;
use cortex_m_semihosting::hprintln; use cortex_m_semihosting::hprintln;
use panic_semihosting as _; use panic_semihosting as _;
use rtic::cyccnt::Instant; use rtic::cyccnt::Instant;
...@@ -27,10 +25,12 @@ const APP: () = { ...@@ -27,10 +25,12 @@ const APP: () = {
wait(1_000_000); wait(1_000_000);
let end = Instant::now(); let end = Instant::now();
let diff = Instant::elapsed(&start);
// notice all printing outside of the section to measure! // notice all printing outside of the section to measure!
hprintln!("Start {:?}", start).ok(); hprintln!("Start {:?}", start).ok();
hprintln!("End {:?}", end).ok(); hprintln!("End {:?}", end).ok();
let diff = Instant::duration_since(&end,start); //let diff = Instant::duration_since(&end,start);
hprintln!("Diff {:?}", diff.as_cycles()).ok(); hprintln!("Diff {:?}", diff.as_cycles()).ok();
} }
}; };
...@@ -65,7 +65,8 @@ fn wait(i: u32) { ...@@ -65,7 +65,8 @@ fn wait(i: u32) {
// //
// What is the output in the Adapter Output console? // What is the output in the Adapter Output console?
// //
// ** your answer here ** // Start Instant(2694714472)
// End Instant(2698714489)
// //
// As you see line 31 is commented out (we never print the difference). // As you see line 31 is commented out (we never print the difference).
// //
...@@ -79,8 +80,9 @@ fn wait(i: u32) { ...@@ -79,8 +80,9 @@ fn wait(i: u32) {
// //
// What is now the output in the Adapter Output console? // What is now the output in the Adapter Output console?
// //
// Start Instant(2694714472) // Start Instant(2100880231)
// End Instant(2698714489) // End Instant(2104880247)
// Diff 4000016
// //
// Commit your answers (bare3_1) // Commit your answers (bare3_1)
// //
...@@ -101,7 +103,10 @@ fn wait(i: u32) { ...@@ -101,7 +103,10 @@ fn wait(i: u32) {
// //
// What is now the output in the Adapter Output console? // What is now the output in the Adapter Output console?
// //
// ** your answer here ** // Start Instant(2395620599)
// End Instant(2399620615)
// Diff 4000020
// //
// Commit your answers (bare3_3) // Commit your answers (bare3_3)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment