...
 
Commits (6)
......@@ -3,3 +3,4 @@
.gdb_history
Cargo.lock
target/
*.swp
......@@ -9,7 +9,7 @@
// Minimal runtime / startup for Cortex-M microcontrollers
extern crate cortex_m_rt;
const X_INIT: u32 = 10;
const X_INIT: u32 = 0xFFFF_FFFF;
static mut X: u32 = X_INIT;
static mut Y: u32 = 0;
......@@ -24,28 +24,29 @@ fn main() {
X += 1;
Y = X;
assert!(x == X && X == Y);
}
}
}
}
// 1. run the program in the debugger,
// let the program run for a while and then press pause
// look in the (Local -vscode) Variables view what do you find
// ** your answer here **
// x: 7852532
//
// in the Expressions (WATCH -vscode) view add X and Y
// what do you find
//
// ** your answer here **
// X: 785232
// Y: 785232
// step through one complete iteration of the loop
// and see how the (Local) Variables are updated
// can you foresee what will eventually happen?
// ** place your answer here **
// Yes
//
// commit your answers (bare0_1)
//
// 2. alter the constant X_INIT so that line 22 directly causes the x to wrap
// what happens when x wraps
// ** your answer here **
// Fail and go to exception handler in lib.rs
//
// commit your answers (bare0_2)
//
......