diff --git a/examples/bare1.rs b/examples/bare1.rs index 4c548ce90d2292066efc0ddeb8decb398b857e57..18c75d508d5fd8dc96c5adfc59c0ec8c63eb1bcf 100644 --- a/examples/bare1.rs +++ b/examples/bare1.rs @@ -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) //