Skip to content
Snippets Groups Projects
Commit b0f554ff authored by Anton Grahn's avatar Anton Grahn
Browse files

bare1_4

parent dba60c0e
No related branches found
No related tags found
No related merge requests found
......@@ -24,9 +24,9 @@ fn main() -> ! {
cortex_m::asm::bkpt();
// prevent optimization by read-volatile (unsafe)
unsafe {
core::ptr::read_volatile(&x);
}
// unsafe {
// core::ptr::read_volatile(&x);
// }
}
}
......@@ -205,15 +205,28 @@ fn main() -> ! {
// > disassemble
//
// ** your answer here **
//
// Dump of assembler code for function bare1::__cortex_m_rt_main:
// 0x0800040a <+0>: bkpt 0x0000
// => 0x0800040c <+2>: bkpt 0x0000
// 0x0800040e <+4>: b.n 0x800040a <bare1::__cortex_m_rt_main>
// End of assembler dump
//
// How many instructions are in between the two `bkpt` instructions.
//
// ** your answer here **
//
// 0
//
// Where is the local variable stored?
// What happened, and why is Rust + LLVM allowed to do that?
//
// ** your answer here **
//
// 0x0800040e <+4>: b.n 0x800040a <bare1::__cortex_m_rt_main>
//
// In release mode the program is the most optimized
// which means that the compiler can remove instructions that arent necessary
//
//
// commit your answers (bare1_4)
//
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment