adafruit / Adafruit_Adalink

Python wrapper for Segger's J-Link Commander & STMicro STLink V2 to flash various ARM MCUs
MIT License
125 stars 33 forks source link

Add SWO listener for debug data #4

Closed microbuilder closed 8 years ago

microbuilder commented 9 years ago

WICED and potentially other platforms in the future will use the SWO line on the SWD interface to send debug information (to avoid muddying up the standard printf/STDIO output). By connecting a J-Link, you can see a stream of debug data about the module as it runs.

Segger has a free SWO viewer but it's Windows only. JLinkExe seems to support SWO, though, so it should be possible to capture this using the same mechanism we flash MCUs with today. See Section 3.7 here.

The goal is a new -s --swo-viewer option that starts listening on the SWO line and displays any captured data to the console window to be able to see this debug data on any platform (CTRL+C to quit):

$ adalink stm32f2 --swo-viewer
Looking for a J-Link device ... connected.
Listening for SWO data ...
00:12:34.567 Factory Reset
00:12:34:574 Shutting Down
...
microbuilder commented 9 years ago

Hmm ... maybe the commands aren't exposed in JLinkExe. :/ In any case, I'm just filing this as a future 'Wish List' type item to remind myself down the road.

microbuilder commented 8 years ago

Closing this since there are other tools we can use for this already.