Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coresight: adiv5 discovery: increment invalid AP count on exception #1593

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions pyocd/coresight/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,24 @@ def _find_aps(self):
return

ap_list = []
apsel = 0
invalid_count = 0
while apsel < self.MAX_APSEL:
for apsel in range(self.MAX_APSEL):
try:
isValid = AccessPort.probe(self.dp, apsel)
if isValid:
ap_list.append(apsel)
invalid_count = 0
elif not self.session.options.get('scan_all_aps'):
else:
invalid_count += 1
if invalid_count == self.session.options.get('adi.v5.max_invalid_ap_count'):
break
except exceptions.Error as e:
LOG.error("Error probing AP#%d: %s", apsel, e,
exc_info=self.session.log_tracebacks)
apsel += 1
invalid_count += 1

# Stop scanning if we've seen a maximum number of invalid APs, unless `scan_all_aps` is set.
if not self.session.options.get('scan_all_aps') \
and invalid_count >= self.session.options.get('adi.v5.max_invalid_ap_count'):
break

# Update the AP list once we know it's complete.
self.dp.valid_aps = ap_list
Expand Down