pyocd / pyocd/pyOCD

Failure to load J-Link driver after upgrading from 0.27.3 to 0.28.0 (or above)

Open
#1,188 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

dependency
Dominant language
Python
Stars
1.5k
Forks
560
Avg merge
1h 41m
Merged PRs (30d)
3

Description

Hi,

We are encountering the following exception when upgrading to 0.28.0 or above:

15:34:42  [2021-07-20T13:34:42.862Z] Traceback (most recent call last):
15:34:42  [2021-07-20T13:34:42.862Z]   File "bin/automator/Automator.py", line 478, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     PluginMgr.init(settings)
15:34:42  [2021-07-20T13:34:42.862Z]   File "/opt/jenkins_workspace/workspace/General/linklayer_integrator_pipeline@3/bin/automator/PluginMgr.py", line 36, in init
15:34:42  [2021-07-20T13:34:42.862Z]     eval("__import__(\"{}\")".format(plugin))
15:34:42  [2021-07-20T13:34:42.862Z]   File "<string>", line 1, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]   File "/opt/jenkins_workspace/workspace/General/linklayer_integrator_pipeline@3/bin/automator/Plugins/ConnectionSwd/ConnectionSwd.py", line 14, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from pyocd.board.mbed_board import MbedBoard
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/__init__.py", line 21, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from . import gdbserver
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/gdbserver/__init__.py", line 17, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from .gdbserver import GDBServer
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/gdbserver/gdbserver.py", line 49, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from ..commands.commander import ToolExitException
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/commands/commander.py", line 22, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from ..core.helpers import ConnectHelper
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/core/helpers.py", line 19, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     from ..probe.aggregator import DebugProbeAggregator
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/probe/aggregator.py", line 84, in <module>
15:34:42  [2021-07-20T13:34:42.862Z]     load_plugin_classes_of_type('pyocd.probe', PROBE_CLASSES, DebugProbe)
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/core/plugin.py", line 95, in load_plugin_classes_of_type
15:34:42  [2021-07-20T13:34:42.862Z]     if plugin.should_load():
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/probe/jlink_probe.py", line 370, in should_load
15:34:42  [2021-07-20T13:34:42.862Z]     return JLinkProbe._get_jlink() is not None
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pyocd/probe/jlink_probe.py", line 54, in _get_jlink
15:34:42  [2021-07-20T13:34:42.862Z]     warn=TRACE.warn,
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pylink/jlink.py", line 292, in __init__
15:34:42  [2021-07-20T13:34:42.862Z]     lib = library.Library()
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pylink/library.py", line 261, in __init__
15:34:42  [2021-07-20T13:34:42.862Z]     self.load_default()
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pylink/library.py", line 299, in load_default
15:34:42  [2021-07-20T13:34:42.862Z]     return self.load(path)
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/site-packages/pylink/library.py", line 353, in load
15:34:42  [2021-07-20T13:34:42.862Z]     self._lib = ctypes.cdll.LoadLibrary(tf.name)
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/ctypes/__init__.py", line 426, in LoadLibrary
15:34:42  [2021-07-20T13:34:42.862Z]     return self._dlltype(name)
15:34:42  [2021-07-20T13:34:42.862Z]   File "/usr/local/lib/python3.6/ctypes/__init__.py", line 348, in __init__
15:34:42  [2021-07-20T13:34:42.862Z]     self._handle = _dlopen(self._name, mode)
15:34:42  [2021-07-20T13:34:42.862Z] OSError: /tmp/tmpd06y3kfm.so: failed to map segment from shared object

Looking at the release notes, I see that in 0.28.0, gdbserver has significant changes. Is there something we need to take care of when upgrading to this version? Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the upgrade failure through bin/automator/Plugins/ConnectionSwd/ConnectionSwd.py and trace the import path into pyocd/probe/jlink_probe.py and pylink/library.py. Investigate the reported shared-object loading error and compare behavior between 0.27.3 and 0.28.0 or later. Done means the J-Link driver loads successfully after upgrading without the reported OSError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.