Skip to content

Commit c83d3e3

Browse files
committed
helper: add delay if debug probe was connected during execution
1 parent bd673c1 commit c83d3e3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pyocd/core/helpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf8 -*-
22
# pyOCD debugger
3-
# Copyright (c) 2018-2019 Arm Limited
3+
# Copyright (c) 2018-2019,2025 Arm Limited
44
# Copyright (c) 2021-2022 Chris Reed
55
# SPDX-License-Identifier: Apache-2.0
66
#
@@ -90,6 +90,7 @@ def get_all_connected_probes(
9090
will be returned.
9191
"""
9292
printedMessage = False
93+
waitedForProbe = False
9394
while True:
9495
allProbes = DebugProbeAggregator.get_all_connected_probes(unique_id=unique_id)
9596
sortedProbes = sorted(allProbes, key=lambda probe:probe.description + probe.unique_id)
@@ -107,8 +108,14 @@ def get_all_connected_probes(
107108
print(colorama.Fore.YELLOW + msg + colorama.Style.RESET_ALL)
108109
printedMessage = True
109110
sleep(0.01)
111+
waitedForProbe = True
110112
assert len(sortedProbes) == 0
111113

114+
if waitedForProbe:
115+
# Wait for the debug probe to be fully initialized.
116+
# This is necessary for some debug probes that take a while to be ready.
117+
sleep(2)
118+
112119
return sortedProbes
113120

114121
@staticmethod

0 commit comments

Comments
 (0)