From cb845c5dfcd76a84ca67247f58bbc94cf9b0e097 Mon Sep 17 00:00:00 2001
From: Anton <anton.frappe@outlook.com>
Date: Wed, 3 Mar 2021 16:52:14 +0100
Subject: [PATCH] bare2_3

---
 examples/rtic_bare2.rs | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/examples/rtic_bare2.rs b/examples/rtic_bare2.rs
index 0c88115..26ba3d2 100644
--- a/examples/rtic_bare2.rs
+++ b/examples/rtic_bare2.rs
@@ -39,7 +39,7 @@ const APP: () = {
         hprintln!("End {:?}", end).ok();
         hprintln!("Diff {:?}", end.wrapping_sub(start)).ok();
 
-        // wait(100);
+        wait(100);
     }
 };
 
@@ -138,10 +138,16 @@ fn wait(i: u32) {
 //
 //    Dump the generated assembly for the "wait" function.
 //
-//    ** your answer here **
+// => 0x080004a0 <+0>:	push	{r7, lr}
+//    0x080004a2 <+2>:	mov	r7, sp
+//    0x080004a4 <+4>:	nop
+//    0x080004a6 <+6>:	subs	r0, #1
+//    0x080004a8 <+8>:	bne.n	0x80004a4 <rtic_bare2::wait+4>
+//    0x080004aa <+10>:	pop	{r7, pc}
 //
 //    Answer in your own words, why you believe the generated code differs?
 //
-//    ** your answer here **
+//    Now that the function needs to be more generic (it has several uses), the
+//      argument is now stored and used inside r0 instead of initialized inside the function.
 //
 //    Commit your answers (bare2_3)
-- 
GitLab