pyocd / pyocd/pyOCD

serial now required in 0.29.0?

Open
#1,076 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

My probe firmware does not provide a serial descriptor string, and pyOCD 0.28.x worked fine. 0.29.0 seems to require it now:

0000542:CRITICAL:__main__:uncaught exception: 'NoneType' object is not subscriptable
Traceback (most recent call last):
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/__main__.py", line 401, in run
    self._COMMANDS[self._args.cmd](self)
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/__main__.py", line 807, in do_commander
    PyOCDCommander(self._args, cmds).run()
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/commands/commander.py", line 65, in run
    if not self.connect():
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/commands/commander.py", line 166, in connect
    unique_id=self.args.unique_id,
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/core/helpers.py", line 138, in choose_probe
    allProbes = ConnectHelper.get_all_connected_probes(blocking=blocking, unique_id=unique_id)
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/core/helpers.py", line 83, in get_all_connected_probes
    sortedProbes = sorted(allProbes, key=lambda probe:probe.description + probe.unique_id)
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/core/helpers.py", line 83, in <lambda>
    sortedProbes = sorted(allProbes, key=lambda probe:probe.description + probe.unique_id)
  File "/home/ralphd/.local/lib/python3.6/site-packages/pyocd/probe/cmsis_dap_probe.py", line 99, in description
    board_id = self.unique_id[0:4]
TypeError: 'NoneType' object is not subscriptable

After modifying my probe firmware to provide a serial descriptor, pyocd 0.29.0 works.

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 with pyocd/core/helpers.py, where probes are sorted, and pyocd/probe/cmsis_dap_probe.py, where description accesses unique_id. Reproduce with a probe lacking a serial descriptor and trace the None value through the listing path. Done means pyocd 0.29.0 no longer crashes and can use such a probe without a serial descriptor.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, devtools, embedded-iot
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.