Skip to content
Snippets Groups Projects
Commit 78976718 authored by Emil Kitti's avatar Emil Kitti
Browse files

bare0_2

parent 3e239743
No related branches found
No related tags found
No related merge requests found
...@@ -6,10 +6,12 @@ ...@@ -6,10 +6,12 @@
// build without the Rust standard library // build without the Rust standard library
#![no_std] #![no_std]
use core::u32;
// Minimal runtime / startup for Cortex-M microcontrollers // Minimal runtime / startup for Cortex-M microcontrollers
extern crate cortex_m_rt; extern crate cortex_m_rt;
const X_INIT: u32 = 10; const X_INIT: u32 = u32::MAX;
static mut X: u32 = X_INIT; static mut X: u32 = X_INIT;
static mut Y: u32 = 0; static mut Y: u32 = 0;
...@@ -52,7 +54,16 @@ fn main() { ...@@ -52,7 +54,16 @@ fn main() {
// //
// 2. alter the constant X_INIT so that line 22 directly causes the x to wrap // 2. alter the constant X_INIT so that line 22 directly causes the x to wrap
// what happens when x wraps // 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) // commit your answers (bare0_2)
// //
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment