Skip to content

Commit 97141b9

Browse files
committed
ITM: don't test reserved bits in is_fifo_ready
On ARMv7-M, bits 31:1 of the value read from STIMx are reserved, so comparing them against zero is a bad idea. On ARMv8-M, bit 1 has been repurposed to indicate DISABLED. This means that the is_fifo_ready impl hangs forever when ITM is disabled on a Cortex-M33 (for example). Changed to test only the FIFOREADY bit.
1 parent fc19f3e commit 97141b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/peripheral/itm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ impl Stim {
5555
/// Returns `true` if the stimulus port is ready to accept more data
5656
#[inline]
5757
pub fn is_fifo_ready(&self) -> bool {
58-
unsafe { ptr::read_volatile(self.register.get()) == 1 }
58+
unsafe { ptr::read_volatile(self.register.get()) & 1 == 1 }
5959
}
6060
}

0 commit comments

Comments
 (0)