From 8f7b9457d74a6f8c6aac1c504464b8b09c9af7ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Edvin=20=C3=85kerfeldt?= <Edvin Ã…kerfeldt>
Date: Thu, 3 Dec 2020 18:06:59 +0100
Subject: [PATCH] timing_resources, Q6-Q13 done

---
 examples/timing_resources.rs | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/examples/timing_resources.rs b/examples/timing_resources.rs
index dd5abe4..3d89b14 100644
--- a/examples/timing_resources.rs
+++ b/examples/timing_resources.rs
@@ -40,9 +40,9 @@ const APP: () = {
         rtic::pend(stm32f411::Interrupt::EXTI0);
         asm::bkpt();
         cx.resources.shared.lock(|shared| {
-            // asm::bkpt();
+            asm::bkpt();
             *shared += 1;
-            // asm::bkpt();
+            asm::bkpt();
         });
         asm::bkpt();
     }
@@ -168,6 +168,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // (gdb) x 0xe0001004
 //
 // [Your answer here]
+/*
+37 cycles
+*/
 //
 // You should have a total execution time in the range of 30-40 cycles.
 //
@@ -175,6 +178,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // `exti0` was safe without locking the resource.
 //
 // [Your answer here]
+/*
+It was safe because exti0 had the highest priority of the tasks accessing the resource.
+*/
 //
 // In `exti1` we also access `shared` but this time through a lock.
 //
@@ -204,10 +210,16 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // (gdb) x 0xe0001004
 //
 // [Your answer here]
+/*
+52 cycles
+*/
 //
 // Calculate the total time (in cycles), for this section of code.
 //
 // [Your answer here]
+/*
+52 - 37 = 15 cycles
+*/
 //
 // You should get a value around 15 cycles.
 //
@@ -248,6 +260,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // (gdb) x 0xe0001004
 //
 // [Your answer here]
+/*
+40 cycles
+*/
 //
 // (gdb) c
 //
@@ -258,6 +273,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // (gdb) x 0xe0001004
 //
 // [Your answer here]
+/*
+50 cycles
+*/
 //
 // From a real-time perspective the critical section infers
 // blocking (of higher priority tasks).
@@ -265,6 +283,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // How many clock cycles is the blocking?
 //
 // [Your answer here]
+/*
+10 cycles
+*/
 //
 // Finally continue out of the closure.
 //
@@ -275,6 +296,9 @@ Yes, but very minimal. The only thing that needs to be infered is the changing o
 // (gdb) x 0xe0001004
 //
 // [Your answer here]
+/*
+52 cycles
+*/
 //
 // This is the total execution time of:
 //
-- 
GitLab