Skip to content
Snippets Groups Projects
Commit 01babc95 authored by Emil Kitti's avatar Emil Kitti
Browse files

bare1_3

parent 7878cbdc
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ fn main() { ...@@ -27,7 +27,7 @@ fn main() {
// to prevent returning // to prevent returning
loop { loop {
// cortex_m::asm::nop(); cortex_m::asm::nop();
// cortex_m::asm::bkpt(); // cortex_m::asm::bkpt();
} }
} }
...@@ -54,14 +54,64 @@ fn main() { ...@@ -54,14 +54,64 @@ fn main() {
// what is shown in the Dissasmbly view, what instruction is executing // what is shown in the Dissasmbly view, what instruction is executing
// (if you are NOT under eclipse, then give the command in gdb console // (if you are NOT under eclipse, then give the command in gdb console
// (gdb) disassemble // (gdb) disassemble
// ** your answer here ** // Dump of assembler code for function bare1::main:
// 0x08000f64 <+0>: push {r7, lr}
// 0x08000f66 <+2>: mov r7, sp
// 0x08000f68 <+4>: sub sp, #48 ; 0x30
// 0x08000f6a <+6>: movw r0, #15472 ; 0x3c70 <------ for itm
// 0x08000f6e <+10>: movt r0, #2048 ; 0x800
// 0x08000f72 <+14>: ldr r0, [r0, #0]
// 0x08000f74 <+16>: bl 0x80004d6 <<bare_metal::Peripheral<T>>::get>
// 0x08000f78 <+20>: str r0, [sp, #8]
// 0x08000f7a <+22>: b.n 0x8000f7c <bare1::main+24>
// 0x08000f7c <+24>: b.n 0x8000f7e <bare1::main+26>
// 0x08000f7e <+26>: movw r1, #15488 ; 0x3c80
// 0x08000f82 <+30>: movt r1, #2048 ; 0x800
// 0x08000f86 <+34>: movs r2, #17
// 0x08000f88 <+36>: ldr r0, [sp, #8]
// 0x08000f8a <+38>: bl 0x80021a4 <cortex_m::itm::write_str>
// 0x08000f8e <+42>: b.n 0x8000f90 <bare1::main+44>
// 0x08000f90 <+44>: add r0, sp, #16
// 0x08000f92 <+46>: bl 0x80012f2 <cortex_m_semihosting::hio::hstdout> <--- semihosting
// 0x08000f96 <+50>: b.n 0x8000f98 <bare1::main+52>
// 0x08000f98 <+52>: add r0, sp, #16
// 0x08000f9a <+54>: bl 0x80008d6 <<core::result::Result<T, E>>::unwrap>
// 0x08000f9e <+58>: str r0, [sp, #12]
// 0x08000fa0 <+60>: b.n 0x8000fa2 <bare1::main+62>
// 0x08000fa2 <+62>: mov r0, sp
// 0x08000fa4 <+64>: movs r1, #0
// 0x08000fa6 <+66>: str r1, [r0, #0]
// 0x08000fa8 <+68>: movw r1, #15548 ; 0x3cbc
// 0x08000fac <+72>: movt r1, #2048 ; 0x800
// 0x08000fb0 <+76>: movw r3, #15556 ; 0x3cc4
// 0x08000fb4 <+80>: movt r3, #2048 ; 0x800
// 0x08000fb8 <+84>: add r0, sp, #24
// 0x08000fba <+86>: movs r2, #1
// 0x08000fbc <+88>: bl 0x8000b22 <core::fmt::Arguments::new_v1>
// 0x08000fc0 <+92>: b.n 0x8000fc2 <bare1::main+94>
// 0x08000fc2 <+94>: add r0, sp, #12
// 0x08000fc4 <+96>: add r1, sp, #24
// 0x08000fc6 <+98>: bl 0x8000a6a <core::fmt::Write::write_fmt>
// 0x08000fca <+102>: str r0, [sp, #4]
// 0x08000fcc <+104>: b.n 0x8000fce <bare1::main+106>
// 0x08000fce <+106>: ldr r0, [sp, #4]
// 0x08000fd0 <+108>: and.w r0, r0, #1
// 0x08000fd4 <+112>: bl 0x800088c <<core::result::Result<T, E>>::unwrap>
// 0x08000fd8 <+116>: b.n 0x8000fda <bare1::main+118>
// 0x08000fda <+118>: b.n 0x8000fdc <bare1::main+120>
// => 0x08000fdc <+120>: b.n 0x8000fdc <bare1::main+120>
//
// All instructions are executed!
// //
// commit your answers (bare1_2) // commit your answers (bare1_2)
// //
// 3. now remove the comment line 30. // 3. now remove the comment line 30.
// rebuild and debug, pause the program. // rebuild and debug, pause the program.
// what is shown in the Dissasmbly view, what instruction is executing // what is shown in the Dissasmbly view, what instruction is executing
// ** your answer here ** //
// 0x08000fdc <+120>: nop
//
// Line 30 creates a nop instruction
// //
// commit your answers (bare1_3) // commit your answers (bare1_3)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment