diff --git a/examples/bare0.rs b/examples/bare0.rs index 80ac35a6250966dbf9a1ef72ea621e742281c0e1..4ab8495d5c9e6e58a2b5df276363987db82548c8 100644 --- a/examples/bare0.rs +++ b/examples/bare0.rs @@ -6,10 +6,12 @@ // build without the Rust standard library #![no_std] +use core::u32; + // Minimal runtime / startup for Cortex-M microcontrollers extern crate cortex_m_rt; -const X_INIT: u32 = 10; +const X_INIT: u32 = u32::MAX; static mut X: u32 = X_INIT; static mut Y: u32 = 0; @@ -52,7 +54,16 @@ fn main() { // // 2. alter the constant X_INIT so that line 22 directly causes the x to wrap // what happens when x wraps -// ** your answer here ** +// +// (gdb) print x +// $1 = 4294967295 +// (gdb) next +// +// Program received signal SIGTRAP, Trace/breakpoint trap. +// cortex_m_rt::default_handler (ef=0x20017e68) at /home/kitzin/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.3.12/src/lib.rs:454 +// 454 asm::bkpt(); +// +// An interrupt is triggered! // // commit your answers (bare0_2) //