diff --git a/examples/rtic_bare4.rs b/examples/rtic_bare4.rs index f9f2fe77571cf05ffdf06a0cbc8a6772d166a889..28e5e2e10a6d03be8982873b5aeedd218fa79222 100644 --- a/examples/rtic_bare4.rs +++ b/examples/rtic_bare4.rs @@ -36,8 +36,8 @@ use address::*; // Here we have low level access to a bit in a register #[inline(always)] fn read_u32(addr: u32) -> u32 { - unsafe { core::ptr::read_volatile(addr as *const _) } - // core::ptr::read_volatile(addr as *const _) + // unsafe { core::ptr::read_volatile(addr as *const _) } + core::ptr::read_volatile(addr as *const _) } // Here we have low level access to a bit in a register @@ -102,12 +102,13 @@ const APP: () = { // // What was the error message and explain why. // -// ** your answer here ** +// error[E0133]: call to unsafe function is unsafe and requires unsafe function or block +// I guess this is because you cant make sure that the adress is valid. // // Digging a bit deeper, why do you think `read_volatile` is declared `unsafe`. // (https://doc.rust-lang.org/core/ptr/fn.read_volatile.html, for some food for thought ) // -// ** your answer here ** +// Because you can get undefined behaviour // // Commit your answers (bare4_2) //