[mbedmicro/pyOCD] Question: why the get_probe_with_id() in pyocd/probe/cmsis_dap_probe.py doesn't return None? (#617)

0 views
Skip to first unread message

Ivan Ivanyuk

unread,
Apr 15, 2019, 9:40:01 AM4/15/19
to mbedmicro/pyOCD, Subscribed

I don't fully understand the usage of the DebugProbeAggregator.get_probe_with_id(board_id), for example, in the test/automated_test.py:164.
As it is now, when I have only st-link probes connected and override the target in the pyocd.yaml, get_probe_with_id() still returns the CMSISDAPProbe probe even if it found no interface and has no probe with such id.
Shouldn't it return None in that case?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

Chris Reed

unread,
Apr 15, 2019, 10:59:16 AM4/15/19
to mbedmicro/pyOCD, Subscribed

It sounds like there might be a bug. If no CMSIS-DAP probe is connected, it definitely should not be returning a CMSISDAPProbe instance. Could you provide some more detail, like the list of connected probes and the exact output of get_probe_with_id()? I just want to make sure I'm understanding the problem fully. Thanks!

Ivan Ivanyuk

unread,
Apr 16, 2019, 5:34:02 AM4/16/19
to mbedmicro/pyOCD, Subscribed

Examples of the output:

## => Board Name | Unique ID
-- -- ----------------------
 0 => STM32 STLinkV2-1 | 066AFF393430533457055540
 1 => STM32 STLinkV2 | 53FF6D067865495422580467
>>> from pyocd.probe.aggregator import DebugProbeAggregator
>>> probe = DebugProbeAggregator.get_probe_with_id('53FF6D067865495422580467')
>>> print(probe)
<CMSISDAPProbe@19d76eabdd8  >
>>> print(probe.unique_id)
53FF6D067865495422580467

For me, these lines are the one I don't understand - here and here.
Why if no interface is found pyOCD still creates some objects?

Chris Reed

unread,
Apr 16, 2019, 5:21:29 PM4/16/19
to mbedmicro/pyOCD, Subscribed

This is definitely a bug.

The code in DAPAccessCMSISDAP.__init__() is mostly correct. The constructor should only be called if it is known that a device exists. But it does need to handle the case where the device has disappeared between first identifying it and calling the constructor.

The primary bug here is in CMSISDAPProbe.get_probe_with_id(), as you have discovered.

Thanks for reporting this! I'll fix it right away.

Chris Reed

unread,
Apr 18, 2019, 7:51:10 PM4/18/19
to mbedmicro/pyOCD, Subscribed

Closed #617 via #621.

Reply all
Reply to author
Forward
0 new messages