Skip to main content
Graduate II
April 14, 2020
Solved

Windows command line tool for SWD viewing

  • April 14, 2020
  • 3 replies
  • 2276 views

Stupid newbie question: apologies if I've missed this but I'm looking for a Windows command-line tool to capture SWO output from the target, i.e one that connects to the target, sets the appropriate register bits to configure SWO output etc., takes a configuration item for a frequency value and then streams the SWO line output from the target to stdout or a named file.

To be clear, I don't want a GUI tool, this is for running under automation where there is no GUI possibility, I just need my debug printf()s sent to a file. I know the ST-LINK utility can do it in GUI form but the command-line version doesn't seem to be able to do the viewing part.

Thanks in advance for your help.

    This topic has been closed for replies.
    Best answer by Rob Meades

    FYI, for anyone else that finds this, the answer was that, buried in the STM32Cube IDE installation folders, is a copy of OpenOCD plus configuration files for all the ST chips, so all one has to do is:

    openocd –f stlink.cfg –f stm32f4.cfg -c init -c "itm port 0 on" -c "tpiu config internal temp.dat uart off 168000000 2000000" -c "reset init" -c resume

    …to pipe the ITM output to a file named temp.dat and then run this Python script, modified slightly to assume it has sync from the outset (sync bytes don't seem to appear in the stream) and Bob's your sister's brother, so to speak.

    3 replies

    Graduate II
    April 30, 2020

    I take it there's no such thing? Strange, it seems like an awfully basic tool to be missing.

    Graduate II
    May 1, 2020

    Have a look at orbuculum https://github.com/orbcode/orbuculum

    Graduate II
    May 1, 2020

    Oooo, it says "orbdump: A utility for dumping raw SWO data to a sfile for post-processing." Looks like just what I need! Thanks very much indeed for pointing this out.

    Graduate II
    June 18, 2020

    Finally got around to looking at this and, unfortunately, orbuculum's Makefile requires Cygwin to build on Windows and depends on a selection of libraries some of which I can't find in the Cygwin list. Anyone have any other ideas? Is there no simple Windows .exe out there? It can't be this difficult...?

    Rob MeadesAuthorAnswer
    Graduate II
    June 26, 2020

    FYI, for anyone else that finds this, the answer was that, buried in the STM32Cube IDE installation folders, is a copy of OpenOCD plus configuration files for all the ST chips, so all one has to do is:

    openocd –f stlink.cfg –f stm32f4.cfg -c init -c "itm port 0 on" -c "tpiu config internal temp.dat uart off 168000000 2000000" -c "reset init" -c resume

    …to pipe the ITM output to a file named temp.dat and then run this Python script, modified slightly to assume it has sync from the outset (sync bytes don't seem to appear in the stream) and Bob's your sister's brother, so to speak.