pyocd / pyocd/pyOCD

SWO never flushes if target doesn't send timestamps.

Open
#831 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Currently, the SWO parser buffers all events until a timestamp is received: https://github.com/mbedmicro/pyOCD/blob/ee63c7b64b313bad65dfa9871b7acb55fdda055d/pyocd/trace/swo.py#L116-L132

In my current project, I'm just sending printf debugging data over ITM port 0, and I want to receive it from Python. However, it seems no timestamps are being sent, so the data is never flushed, and gets buffered forever.

I'm not sure whether I want these timestamps or not, or what's the best way to enable them (from the firmware or from pyOCD?). Either way, shouldn't pyOCD offer an API to read raw SWO data, and process timestamps in a higher-level layer? (SWV, not SWO?)

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 in pyocd/trace/swo.py around lines 116-132 and trace how ITM port 0 data is buffered until a timestamp arrives. Determine the intended behavior for targets that emit no timestamps, then add coverage for that case and verify that SWO data can be consumed without remaining buffered indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.