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

bare1_4

parent dba60c0e
Branches
No related tags found
No related merge requests found
...@@ -24,9 +24,9 @@ fn main() -> ! { ...@@ -24,9 +24,9 @@ fn main() -> ! {
cortex_m::asm::bkpt(); cortex_m::asm::bkpt();
// prevent optimization by read-volatile (unsafe) // prevent optimization by read-volatile (unsafe)
unsafe { // unsafe {
core::ptr::read_volatile(&x); // core::ptr::read_volatile(&x);
} // }
} }
} }
...@@ -205,15 +205,28 @@ fn main() -> ! { ...@@ -205,15 +205,28 @@ fn main() -> ! {
// > disassemble // > disassemble
// //
// ** your answer here ** // ** 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. // How many instructions are in between the two `bkpt` instructions.
// //
// ** your answer here ** // ** your answer here **
// // 0
//
// Where is the local variable stored? // Where is the local variable stored?
// What happened, and why is Rust + LLVM allowed to do that? // What happened, and why is Rust + LLVM allowed to do that?
// //
// ** your answer here ** // ** 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) // commit your answers (bare1_4)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment