Skip to content
Snippets Groups Projects
Commit 3b4a1cd9 authored by Henrik Theolin's avatar Henrik Theolin
Browse files

bare1_7

parent 5aad58aa
No related branches found
No related tags found
No related merge requests found
......@@ -16,6 +16,8 @@ use cortex_m_rt::entry;
use cortex_m::{iprintln, Peripherals};
use cortex_m_semihosting::hprintln;
use core::num::Wrapping;
#[entry]
#[inline(never)]
fn main() -> ! {
......@@ -25,14 +27,15 @@ fn main() -> ! {
//let mut p = Peripherals::take().unwrap();
//let stim = &mut p.ITM.stim[0];
let mut _x = 0;
let mut _x = Wrapping(0u32);
let one = Wrapping(1u32);
loop {
_x += 1;
_x += one;
cortex_m::asm::nop();
//iprintln!(stim, "{}",_x);
//hprintln!("{}", _x).unwrap();
cortex_m::asm::bkpt();
_x -= 1;
_x -= one;
}
}
......@@ -283,11 +286,39 @@ fn main() -> ! {
//
// What is now the disassembly of the code in dev mode?
//
// ** your answer here **
// **
// Dump of assembler code for function main:
// 0x080004e4 <+0>: sub sp, #8
// 0x080004e6 <+2>: movs r0, #0
// 0x080004e8 <+4>: str r0, [sp, #0]
// 0x080004ea <+6>: movs r0, #1
// 0x080004ec <+8>: str r0, [sp, #4]
// 0x080004ee <+10>: b.n 0x80004f0 <main+12>
// 0x080004f0 <+12>: ldr r1, [sp, #4]
// 0x080004f2 <+14>: mov r0, sp
// 0x080004f4 <+16>: bl 0x8000490 <core::num::wrapping::_$LT$impl$u20$core..ops..arith..AddAssign$u20$for$u20$core..num..Wrapping$LT$u32$GT$$GT$::add_assign::hbb56dbef6bcfa964>
// 0x080004f8 <+20>: b.n 0x80004fa <main+22>
// 0x080004fa <+22>: bl 0x80004e0 <cortex_m::asm::nop::h0ac7b7a3f33f2667>
// 0x080004fe <+26>: b.n 0x8000500 <main+28>
// => 0x08000500 <+28>: bkpt 0x0000
// 0x08000502 <+30>: b.n 0x8000504 <main+32>
// 0x08000504 <+32>: ldr r1, [sp, #4]
// 0x08000506 <+34>: mov r0, sp
// 0x08000508 <+36>: bl 0x80004b8 <core::num::wrapping::_$LT$impl$u20$core..ops..arith..SubAssign$u20$for$u20$core..num..Wrapping$LT$u32$GT$$GT$::sub_assign::hcf06b8f89372a809>
// 0x0800050c <+40>: b.n 0x800050e <main+42>
// 0x0800050e <+42>: b.n 0x80004f0 <main+12>
// End of assembler dump.
// **
//
// What is now the disassembly of the code in release mode?
//
// ** your answer here **
// **
// Dump of assembler code for function main:
// 0x08000400 <+0>: nop
// => 0x08000402 <+2>: bkpt 0x0000
// 0x08000404 <+4>: b.n 0x8000400 <main>
// End of assembler dump.
// **
//
// commit your answers (bare1_7)
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment