Summary
When jlink.non_interactive is true (the default), pyocd calls disable_dialog_boxes() before open(serial_number_int) in jlink_probe.py. This causes open() to fail with:
No emulator with serial number <SN> found.
even though the probe is visible and pyocd list shows it correctly.
Reproduction
import pylink
j = pylink.JLink()
j.disable_dialog_boxes() # pyocd calls this when jlink.non_interactive=True
j.open(682962484) # fails: No emulator with serial number 682962484 found
Without disable_dialog_boxes():
import pylink
j = pylink.JLink()
j.open(682962484) # succeeds
Environment
- pyocd 0.44.0
- pylink-square 1.7.0
- JLinkARM.dll v9.24.01 (
C:\Program Files\SEGGER\JLink\)
- Probe: Segger J-Link OB-SAM3U128-V2-NordicSem (Nordic nRF52 on-board J-Link)
- Windows 11 Pro 10.0.26200
- Python 3.9.x
Root cause
disable_dialog_boxes() in pylink-square calls a function in JLinkARM.dll that has the side effect of resetting or disabling USB emulator enumeration state, breaking the subsequent EMU_SelectByUSBSN call that open(serial_no) relies on.
Workaround
Add a pyocd.yaml to the project with:
jlink.non_interactive: false
Suggested fix
Reorder the calls in jlink_probe.py so that disable_dialog_boxes() is called after open(), not before. Since disable_dialog_boxes affects UI behavior during the debug session rather than probe discovery, this should be safe:
# jlink_probe.py, open() method
self._link.open(self._serial_number_int) # open first
self._is_open = True
if self.session.options.get('jlink.non_interactive'):
self._link.disable_dialog_boxes() # then suppress dialogs
Summary
When
jlink.non_interactiveistrue(the default), pyocd callsdisable_dialog_boxes()beforeopen(serial_number_int)injlink_probe.py. This causesopen()to fail with:even though the probe is visible and
pyocd listshows it correctly.Reproduction
Without
disable_dialog_boxes():Environment
C:\Program Files\SEGGER\JLink\)Root cause
disable_dialog_boxes()in pylink-square calls a function inJLinkARM.dllthat has the side effect of resetting or disabling USB emulator enumeration state, breaking the subsequentEMU_SelectByUSBSNcall thatopen(serial_no)relies on.Workaround
Add a
pyocd.yamlto the project with:Suggested fix
Reorder the calls in
jlink_probe.pyso thatdisable_dialog_boxes()is called afteropen(), not before. Sincedisable_dialog_boxesaffects UI behavior during the debug session rather than probe discovery, this should be safe: