···88unsafe impl critical_section::Impl for EepyCs {
99 unsafe fn acquire() -> bool {
1010 let mut state: usize;
1111- syscall!(
1212- SyscallNumber::CriticalSection,
1313- out state in CsSyscall::Acquire,
1414- );
1111+ unsafe {
1212+ syscall!(
1313+ SyscallNumber::CriticalSection,
1414+ out state in CsSyscall::Acquire,
1515+ );
1616+ }
1517 state != 0
1618 }
17191820 unsafe fn release(state: bool) {
1919- syscall!(
2020- SyscallNumber::CriticalSection,
2121- in CsSyscall::Release,
2222- in state,
2323- );
2121+ unsafe {
2222+ syscall!(
2323+ SyscallNumber::CriticalSection,
2424+ in CsSyscall::Release,
2525+ in state,
2626+ );
2727+ }
2428 }
2529}
+3-3
eepy/src/flash.rs
···30303131 unsafe {
3232 let start_ptr: *mut u32 = XIP_BASE.add(start_addr as usize).cast_mut().cast();
3333- let words = len / 4;
3434- for _ in 0..words {
3535- start_ptr.add(words as usize).write_volatile(0);
3333+ let words = len / size_of::<u32>() as u32;
3434+ for word in 0..words {
3535+ start_ptr.add(word as usize).write_volatile(0);
3636 }
3737 }
3838}