Skip to content

Commit ef74216

Browse files
authored
coresight: cortex-m: always evaluate deferred read of MVFR2 (#1613)
A deferred read of MVFR2 is queued, but the value isn't used unless an FPU is detected. This fix always evaluates the deferred read of this register to prevent the CMSIS-DAP read queue from getting stuck.
1 parent 5f02a94 commit ef74216

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pyocd/coresight/cortex_m.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,13 +516,15 @@ def _check_for_fpu(self) -> None:
516516
self.has_fpu = ((sp_val == self.MVFR0_SINGLE_PRECISION_SUPPORTED) or
517517
(dp_val == self.MVFR0_DOUBLE_PRECISION_SUPPORTED))
518518

519+
# Deferred reads must always be evaluated, to prevent the read queue getting stuck, so read
520+
# this outside the 'if' below even if we don't use it.
521+
mvfr2 = mvfr2_cb()
522+
519523
if self.has_fpu:
520524
self._extensions.append(CortexMExtension.FPU)
521525

522526
# Now check the VFP version by looking for support for the misc FP instructions added in
523527
# FPv5 (VMINNM, VMAXNM, etc).
524-
525-
mvfr2 = mvfr2_cb()
526528
vfp_misc_val = (mvfr2 & CortexM.MVFR2_VFP_MISC_MASK) >> CortexM.MVFR2_VFP_MISC_SHIFT
527529

528530
if dp_val == self.MVFR0_DOUBLE_PRECISION_SUPPORTED:

0 commit comments

Comments
 (0)