From 15de101004764e23c5929413b7a854ec68c82063 Mon Sep 17 00:00:00 2001 From: Anton <anton.frappe@outlook.com> Date: Wed, 3 Mar 2021 16:48:20 +0100 Subject: [PATCH] bare2_2 --- examples/rtic_bare2.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/examples/rtic_bare2.rs b/examples/rtic_bare2.rs index d4dc217..0c88115 100644 --- a/examples/rtic_bare2.rs +++ b/examples/rtic_bare2.rs @@ -109,7 +109,14 @@ fn wait(i: u32) { // // Dump generated assembly for the "wait" function. // -// ** your answer here ** +// => 0x080004a0 <+0>: push {r7, lr} +// 0x080004a2 <+2>: mov r7, sp +// 0x080004a4 <+4>: movw r0, #16960 ; 0x4240 +// 0x080004a8 <+8>: movt r0, #15 +// 0x080004ac <+12>: nop +// 0x080004ae <+14>: subs r0, #1 +// 0x080004b0 <+16>: bne.n 0x80004ac <rtic_bare2::wait+12> +// 0x080004b2 <+18>: pop {r7, pc} // // Under the ARM calling convention, r0.. is used as arguments. // However in this case, we se that r0 is set by the assembly instructions, @@ -119,7 +126,9 @@ fn wait(i: u32) { // // Answer in your own words, how they assign r0 to 1000000. // -// ** your answer here ** +// movt "loads" the immidiate value to the upper part of the word [31:16]. +// movw "loads" the immidiate value to the lower part of the word [15:0]. +// they are then "or":ed together. // // Commit your answers (bare2_2) // -- GitLab