platformio / platformio/platformio-core

Support viewing SWO data

Open
#4,069 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugging feature
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

What kind of issue is this?

  • Question.
    This issue tracker is not the place for questions. If you want to ask how to do something,
    or to understand why something isn't working the way you expect it to,
    use Community Forums or Premium Support

  • PlatformIO IDE.
    All issues related to PlatformIO IDE should be reported to appropriate repository:
    PlatformIO IDE for Atom or
    PlatformIO IDE for VSCode

  • Development Platform or Board.
    All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms
    should be reported to appropriate repository related to your hardware
    https://github.com/topics/platformio-platform

  • Feature Request.
    Start by telling us what problem you’re trying to solve. Often a solution
    already exists! Don’t send pull requests to implement new features without first getting our
    support. Sometimes we leave features out on purpose to keep the project small.

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system: Win 10 x64

PlatformIO Version (platformio --version): version 5.2.1b2

Description of problem

Per https://community.platformio.org/t/viewing-swo-output-within-pio/13853.

PlatformIO currently has no built-in facilities to view printf() output sent via the SWO (single-wire-output) pin present in many ARM-type microcontrollers.

SWO (using the "SWO" pin) is a different technique to SWD semihosting (uses SWDIO + SWDCLK pins), thus this issue is not a duplicate of #3516 .

Steps to Reproduce
  1. Create firmware that uses the SWO output (e.g., STM32Cube firmware using the ITM_SendChar() function to send data)
  2. Upload firmware
  3. View SWO output normally via the e.g. ST-Link Utility

grafik

  1. Search for the option to view SWO output within PlatformIO (e.g., via "Monitor" task)
Actual Results

The "Monitor" task cannot be configured to view SWO output. No other button for "show me SWO output" exists.

Expected Results

PlatformIO is capable of viewing SWO output out-of-the-box.

If problems with PlatformIO Build System:

N/A

Additional info

By using OpenOCD to read SWO output and forward it to a TCL server (it cannot output it in stdout by default) and using a SWO decoder script (https://github.com/robertlong13/SWO-Parser) that connects to OpenOCD's TCL server, one can view the SWO output.

The repo https://github.com/maxgerhardt/pio-swo-demo demonstratess that and implements a "SWO Viewer" task that acts like a serial monitior, just for SWO data.

t

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 reviewing the linked pio-swo-demo, SWO-Parser, and the OpenOCD/TCL-server approach described in the issue. Then locate PlatformIO's Monitor task and determine how SWO data could be viewed within PlatformIO. Done means PlatformIO can view SWO output out-of-the-box, with the required workflow and supported configuration defined.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools, embedded-iot
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.