From 8a306528067173f92a90e7a90c8c1e76eedead39 Mon Sep 17 00:00:00 2001
From: "henthe-5@student.ltu.se" <henthe-5@student.ltu.se>
Date: Tue, 19 Feb 2019 15:46:02 +0100
Subject: [PATCH] bare1_2 wo prints

---
 Cargo.toml        |   4 +-
 examples/bare1.rs | 169 +++++++++++-----------------------------------
 2 files changed, 40 insertions(+), 133 deletions(-)

diff --git a/Cargo.toml b/Cargo.toml
index f650756..fd63391 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,13 +34,13 @@ features = ["inline-asm"] # <- currently requires nightly compiler
 # alloc-cortex-m = "0.3.5"
 
 [dependencies.stm32f4]
-version = "0.5.0"
+version = "0.6.0"
 features = ["stm32f413", "rt"]
 optional = true
 
 [dependencies.stm32f4xx-hal]
 git = "https://github.com/stm32-rs/stm32f4xx-hal.git"
-version = "0.2.8"
+version = "0.3.0"
 features = ["stm32f413", "rt"]
 optional = true
 
diff --git a/examples/bare1.rs b/examples/bare1.rs
index cc1407f..2a59bd1 100644
--- a/examples/bare1.rs
+++ b/examples/bare1.rs
@@ -22,16 +22,16 @@ fn main() -> ! {
     // Prepend by `x` by _ to avoid warning (never used).
     // The compiler is smart enough to figure out that
     // `x` is not used in any menaningful way.
-    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];
 
     let mut _x = 0;
     loop {
         _x += 1;
-        cortex_m::asm::nop();
-        iprintln!(stim, "{}",_x);
-        hprintln!("{}", _x).unwrap();
-        cortex_m::asm::bkpt();
+        //cortex_m::asm::nop();
+        //iprintln!(stim, "{}",_x);
+        //hprintln!("{}", _x).unwrap();
+        //cortex_m::asm::bkpt();
         _x -= 1;
     }
 }
@@ -74,131 +74,38 @@ fn main() -> ! {
 //    What is the output of:
 //    (gdb) disassemble
 //
-//    ** 
-//    Dump of assembler code for function main:
-//    0x0800057c <+0>:	sub	sp, #144	; 0x90
-//    0x0800057e <+2>:	bl	0x8000400 <cortex_m::peripheral::Peripherals::take::h5f8938ec826175e0>
-//    0x08000582 <+6>:	str	r0, [sp, #48]	; 0x30
-//    0x08000584 <+8>:	b.n	0x8000586 <main+10>
-//    0x08000586 <+10>:	ldr	r0, [sp, #48]	; 0x30
-//    0x08000588 <+12>:	and.w	r0, r0, #1
-//    0x0800058c <+16>:	bl	0x800045a <_$LT$core..option..Option$LT$T$GT$$GT$::unwrap::he5564b08dcd7de32>
-//    0x08000590 <+20>:	b.n	0x8000592 <main+22>
-//    0x08000592 <+22>:	add	r0, sp, #52	; 0x34
-//    0x08000594 <+24>:	bl	0x80015b0 <_$LT$cortex_m..peripheral..ITM$u20$as$u20$core..ops..deref..DerefMut$GT$::deref_mut::h436d538b07ed6804>
-//    0x08000598 <+28>:	str	r0, [sp, #44]	; 0x2c
-//    0x0800059a <+30>:	b.n	0x800059c <main+32>
-//    0x0800059c <+32>:	b.n	0x800059e <main+34>
-//    0x0800059e <+34>:	ldr	r0, [sp, #44]	; 0x2c
-//    0x080005a0 <+36>:	str	r0, [sp, #56]	; 0x38
-//    0x080005a2 <+38>:	movs	r1, #0
-//    0x080005a4 <+40>:	str	r1, [sp, #60]	; 0x3c
-//    0x080005a6 <+42>:	b.n	0x80005a8 <main+44>
-//    0x080005a8 <+44>:	ldr	r0, [sp, #60]	; 0x3c
-//    0x080005aa <+46>:	adds	r1, r0, #1
-//    0x080005ac <+48>:	mov	r2, r1
-//    0x080005ae <+50>:	cmp	r1, r0
-//    0x080005b0 <+52>:	str	r2, [sp, #40]	; 0x28
-//    0x080005b2 <+54>:	bvs.n	0x8000696 <main+282>
-//    0x080005b4 <+56>:	b.n	0x80005b6 <main+58>
-//    0x080005b6 <+58>:	ldr	r0, [sp, #40]	; 0x28
-//    0x080005b8 <+60>:	str	r0, [sp, #60]	; 0x3c
-//    0x080005ba <+62>:	bl	0x80006b2 <cortex_m::asm::nop::ha910cafc4e93814b>
-//    0x080005be <+66>:	b.n	0x80005c0 <main+68>
-//    0x080005c0 <+68>:	ldr	r0, [sp, #56]	; 0x38
-//    0x080005c2 <+70>:	add	r1, sp, #60	; 0x3c
-//    0x080005c4 <+72>:	str	r1, [sp, #96]	; 0x60
-//    0x080005c6 <+74>:	ldr	r1, [sp, #96]	; 0x60
-//    0x080005c8 <+76>:	str	r1, [sp, #100]	; 0x64
-//    0x080005ca <+78>:	ldr	r1, [sp, #100]	; 0x64
-//    0x080005cc <+80>:	movw	r2, #13575	; 0x3507
-//    0x080005d0 <+84>:	movt	r2, #2048	; 0x800
-//    0x080005d4 <+88>:	str	r0, [sp, #36]	; 0x24
-//    0x080005d6 <+90>:	mov	r0, r1
-//    0x080005d8 <+92>:	mov	r1, r2
-//    0x080005da <+94>:	bl	0x8000860 <core::fmt::ArgumentV1::new::h3963445ae2f1fda1>
-//    0x080005de <+98>:	str	r0, [sp, #32]
-//    0x080005e0 <+100>:	str	r1, [sp, #28]
-//    0x080005e2 <+102>:	b.n	0x80005e4 <main+104>
-//    0x080005e4 <+104>:	ldr	r0, [sp, #32]
-//    0x080005e6 <+106>:	str	r0, [sp, #88]	; 0x58
-//    0x080005e8 <+108>:	ldr	r1, [sp, #28]
-//    0x080005ea <+110>:	str	r1, [sp, #92]	; 0x5c
-//    0x080005ec <+112>:	mov	r2, sp
-//    0x080005ee <+114>:	movs	r3, #1
-//    0x080005f0 <+116>:	str	r3, [r2, #8]
-//    0x080005f2 <+118>:	movw	r12, #15080	; 0x3ae8
-//    0x080005f6 <+122>:	movt	r12, #2048	; 0x800
-//    0x080005fa <+126>:	str.w	r12, [r2, #4]
-//    0x080005fe <+130>:	str	r3, [r2, #0]
-//    0x08000600 <+132>:	movw	r1, #15064	; 0x3ad8
-//    0x08000604 <+136>:	movt	r1, #2048	; 0x800
-//    0x08000608 <+140>:	add	r0, sp, #64	; 0x40
-//    0x0800060a <+142>:	movs	r2, #2
-//    0x0800060c <+144>:	add	r3, sp, #88	; 0x58
-//    0x0800060e <+146>:	bl	0x80004ce <core::fmt::Arguments::new_v1_formatted::h83e34eaceb446e91>
-//    0x08000612 <+150>:	b.n	0x8000614 <main+152>
-//    0x08000614 <+152>:	add	r1, sp, #64	; 0x40
-//    0x08000616 <+154>:	ldr	r0, [sp, #36]	; 0x24
-//    0x08000618 <+156>:	bl	0x8001d60 <cortex_m::itm::write_fmt::hfe4aca70d68c892e>
-//    0x0800061c <+160>:	b.n	0x800061e <main+162>
-//    0x0800061e <+162>:	add	r0, sp, #60	; 0x3c
-//    0x08000620 <+164>:	str	r0, [sp, #136]	; 0x88
-//    0x08000622 <+166>:	ldr	r0, [sp, #136]	; 0x88
-//    0x08000624 <+168>:	str	r0, [sp, #140]	; 0x8c
-//    0x08000626 <+170>:	ldr	r0, [sp, #140]	; 0x8c
-//    0x08000628 <+172>:	movw	r1, #13575	; 0x3507
-//    0x0800062c <+176>:	movt	r1, #2048	; 0x800
-//    0x08000630 <+180>:	bl	0x8000860 <core::fmt::ArgumentV1::new::h3963445ae2f1fda1>
-//    0x08000634 <+184>:	str	r0, [sp, #24]
-//    0x08000636 <+186>:	str	r1, [sp, #20]
-//    0x08000638 <+188>:	b.n	0x800063a <main+190>
-//    0x0800063a <+190>:	ldr	r0, [sp, #24]
-//    0x0800063c <+192>:	str	r0, [sp, #128]	; 0x80
-//    0x0800063e <+194>:	ldr	r1, [sp, #20]
-//    0x08000640 <+196>:	str	r1, [sp, #132]	; 0x84
-//    0x08000642 <+198>:	mov	r2, sp
-//    0x08000644 <+200>:	movs	r3, #1
-//    0x08000646 <+202>:	str	r3, [r2, #8]
-//    0x08000648 <+204>:	movw	r12, #15080	; 0x3ae8
-//    0x0800064c <+208>:	movt	r12, #2048	; 0x800
-//    0x08000650 <+212>:	str.w	r12, [r2, #4]
-//    0x08000654 <+216>:	str	r3, [r2, #0]
-//    0x08000656 <+218>:	movw	r1, #15064	; 0x3ad8
-//    0x0800065a <+222>:	movt	r1, #2048	; 0x800
-//    0x0800065e <+226>:	add	r0, sp, #104	; 0x68
-//    0x08000660 <+228>:	movs	r2, #2
-//    0x08000662 <+230>:	add	r3, sp, #128	; 0x80
-//    0x08000664 <+232>:	bl	0x80004ce <core::fmt::Arguments::new_v1_formatted::h83e34eaceb446e91>
-//    0x08000668 <+236>:	b.n	0x800066a <main+238>
-//    0x0800066a <+238>:	add	r0, sp, #104	; 0x68
-//    0x0800066c <+240>:	bl	0x8000892 <cortex_m_semihosting::export::hstdout_fmt::hdf00f420736a038e>
-//    0x08000670 <+244>:	str	r0, [sp, #16]
-//    0x08000672 <+246>:	b.n	0x8000674 <main+248>
-//    0x08000674 <+248>:	ldr	r0, [sp, #16]
-//    0x08000676 <+250>:	and.w	r0, r0, #1
-//    0x0800067a <+254>:	bl	0x80006f0 <_$LT$core..result..Result$LT$T$C$$u20$E$GT$$GT$::unwrap::h17631d6f06522c12>
-//    0x0800067e <+258>:	b.n	0x8000680 <main+260>
-// => 0x08000680 <+260>:	bkpt	0x0000
-//    0x08000682 <+262>:	b.n	0x8000684 <main+264>
-//    0x08000684 <+264>:	ldr	r0, [sp, #60]	; 0x3c
-//    0x08000686 <+266>:	subs	r1, r0, #1
-//    0x08000688 <+268>:	cmp	r0, #1
-//    0x0800068a <+270>:	str	r1, [sp, #12]
-//    0x0800068c <+272>:	bvs.n	0x80006a4 <main+296>
-//    0x0800068e <+274>:	b.n	0x8000690 <main+276>
-//    0x08000690 <+276>:	ldr	r0, [sp, #12]
-//    0x08000692 <+278>:	str	r0, [sp, #60]	; 0x3c
-//    0x08000694 <+280>:	b.n	0x80005a8 <main+44>
-//    0x08000696 <+282>:	movw	r0, #15036	; 0x3abc
-//    0x0800069a <+286>:	movt	r0, #2048	; 0x800
-//    0x0800069e <+290>:	bl	0x800297c <core::panicking::panic::h4c45e71f0f614f08>
-//    0x080006a2 <+294>:	udf	#254	; 0xfe
-//    0x080006a4 <+296>:	movw	r0, #15156	; 0x3b34
-//    0x080006a8 <+300>:	movt	r0, #2048	; 0x800
-//    0x080006ac <+304>:	bl	0x800297c <core::panicking::panic::h4c45e71f0f614f08>
-//    0x080006b0 <+308>:	udf	#254	; 0xfe
-//    End of assembler dump.
+//    ** 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, #1964	; 0x7ac
+//    0x08000430 <+48>:	movt	r0, #2048	; 0x800
+//    0x08000434 <+52>:	bl	0x800045c <core::panicking::panic::h4c45e71f0f614f08>
+//    0x08000438 <+56>:	udf	#254	; 0xfe
+//    0x0800043a <+58>:	movw	r0, #2036	; 0x7f4
+//    0x0800043e <+62>:	movt	r0, #2048	; 0x800
+//    0x08000442 <+66>:	bl	0x800045c <core::panicking::panic::h4c45e71f0f614f08>
+//    0x08000446 <+70>:	udf	#254	; 0xfe
+// End of assembler dump.
 //    **
 //
 //    Commit your answers (bare1_2)
-- 
GitLab