Skip to content

Commit

Permalink
coresight: cortex-m: always evaluate deferred read of MVFR2 (#1613)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
flit authored Sep 25, 2023
1 parent 5f02a94 commit ef74216
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pyocd/coresight/cortex_m.py
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,15 @@ def _check_for_fpu(self) -> None:
self.has_fpu = ((sp_val == self.MVFR0_SINGLE_PRECISION_SUPPORTED) or
(dp_val == self.MVFR0_DOUBLE_PRECISION_SUPPORTED))

# Deferred reads must always be evaluated, to prevent the read queue getting stuck, so read
# this outside the 'if' below even if we don't use it.
mvfr2 = mvfr2_cb()

if self.has_fpu:
self._extensions.append(CortexMExtension.FPU)

# Now check the VFP version by looking for support for the misc FP instructions added in
# FPv5 (VMINNM, VMAXNM, etc).

mvfr2 = mvfr2_cb()
vfp_misc_val = (mvfr2 & CortexM.MVFR2_VFP_MISC_MASK) >> CortexM.MVFR2_VFP_MISC_SHIFT

if dp_val == self.MVFR0_DOUBLE_PRECISION_SUPPORTED:
Expand Down

0 comments on commit ef74216

Please sign in to comment.