From c71806c9118223bbea7aef99aee3e9e5f508d4cf Mon Sep 17 00:00:00 2001 From: sheepwall <a.sve@live.se> Date: Thu, 28 Feb 2019 21:07:25 +0100 Subject: [PATCH] bare1_2 --- examples/bare1.rs | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/examples/bare1.rs b/examples/bare1.rs index 2bf9442..e495ce6 100644 --- a/examples/bare1.rs +++ b/examples/bare1.rs @@ -24,13 +24,13 @@ fn main() -> ! { // `x` is not used in any meaningful way. let mut _x = 0; - let mut p = Peripherals::take().unwrap(); - let stim = &mut p.ITM.stim[0]; + // let mut p = Peripherals::take().unwrap(); + // let stim = &mut p.ITM.stim[0]; loop { - hprintln!("{}", _x).unwrap(); + // hprintln!("{}", _x).unwrap(); _x += 1; - iprintln!(stim, "{}", _x); + // iprintln!(stim, "{}", _x); // cortex_m::asm::nop(); // cortex_m::asm::bkpt(); _x -= 1; @@ -81,7 +81,40 @@ fn main() -> ! { // What is the output of: // (gdb) disassemble // -// ** your answer here ** +// disassemble +// {"token":41,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}} +// Dump of assembler code for function main: +// 0x08000400 <+0>: sub sp, #16 +// 0x08000402 <+2>: movs r0, #0 +// 0x08000404 <+4>: str r0, [sp, #12] +// 0x08000406 <+6>: b.n 0x8000408 <main+8> +// => 0x08000408 <+8>: ldr r0, [sp, #12] +// 0x0800040a <+10>: adds r1, r0, #1 +// 0x0800040c <+12>: mov r2, r1 +// 0x0800040e <+14>: cmp r1, r0 +// 0x08000410 <+16>: str r2, [sp, #8] +// 0x08000412 <+18>: bvs.n 0x800042c <main+44> +// 0x08000414 <+20>: b.n 0x8000416 <main+22> +// 0x08000416 <+22>: ldr r0, [sp, #8] +// 0x08000418 <+24>: str r0, [sp, #12] +// 0x0800041a <+26>: ldr r1, [sp, #12] +// 0x0800041c <+28>: subs r2, r1, #1 +// 0x0800041e <+30>: cmp r1, #1 +// 0x08000420 <+32>: str r2, [sp, #4] +// 0x08000422 <+34>: bvs.n 0x800043a <main+58> +// 0x08000424 <+36>: b.n 0x8000426 <main+38> +// 0x08000426 <+38>: ldr r0, [sp, #4] +// 0x08000428 <+40>: str r0, [sp, #12] +// 0x0800042a <+42>: b.n 0x8000408 <main+8> +// 0x0800042c <+44>: movw r0, #2268 ; 0x8dc +// 0x08000430 <+48>: movt r0, #2048 ; 0x800 +// 0x08000434 <+52>: bl 0x800045c <panic> +// 0x08000438 <+56>: udf #254 ; 0xfe +// 0x0800043a <+58>: movw r0, #2340 ; 0x924 +// 0x0800043e <+62>: movt r0, #2048 ; 0x800 +// 0x08000442 <+66>: bl 0x800045c <panic> +// 0x08000446 <+70>: udf #254 ; 0xfe +// End of assembler dump. // // Commit your answers (bare1_2) // -- GitLab