microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

Any plans to add support for SWO output? #985

Open josesimoes opened 7 years ago

josesimoes commented 7 years ago

It seems that OpenOCD has added support for ARM SWO trace port. Would be truly awesome if cpptools could add support for this and be able to output that to the debug console!

pieandcakes commented 7 years ago

@robotdad Do you know anything about this?

robotdad commented 7 years ago

@josesimoes do you have an example of how you're using this from the CLI? Are you using ST Link or something else?

josesimoes commented 7 years ago

Hi Mark!

I'm currently using STLink to get the SWO. Unfortunately one can't have both STLink and VSCode connected in the same debug session... I believe OpenOCD outputs this on a separate stream so it might be something as simple as grabbing that and forward it to the VS Code debug window...

0ge commented 6 years ago

It would be nice with support for SEGGER JLink as well. Don't know about OpenOCD, but JLink opens this on a port and you can use telnet to get the output.

JLinkGDBServer -if swd -device devicename
telnet localhost 2333

Of course, this can be done by opening a new terminal in VSC, but it would be nice if it was integrated.

josesimoes commented 6 years ago

Was wondering if this has had any progresses... 😉

AdrianSoundy commented 6 years ago

Any progress on this

pieandcakes commented 6 years ago

I don't have enough experience with OpenOCD or JLink but I assume this would be a major work item and we haven't pursued it from the C++ extension side.

As with anything, our components are open sourced for the extension and MIEngine and welcome community contribution.

0ge commented 6 years ago

I recently found the Cortex-Debug extension, which I’ve found useful. It slows you to read registers (from an SVD file) and says it supports SWO, although I haven’t been able to get it to work.

josesimoes commented 6 years ago

wanted to keep this alive: any progress or plans for looking into this?

pieandcakes commented 6 years ago

We haven't had time to look into this. I'll mark it "help wanted" to see if anyone would like to contribute.

mrx23dot commented 3 months ago

This is very niche, just use a 3rd party tool.

mrx23dot commented 3 months ago

There is this utility image there might also be an addon for it, no need to put this into cpptools, so I vote for no fix and close it.

josesimoes commented 3 months ago

@mrx23dot ST-Link Utility (which I'm aware of and was referred to on a previous comment) has been deprecated by ST a long time ago. The replacement tool doesn't have this feature.

As I've mentioned also in a previous comment, one can't have at the same time a VS Code debug session and a connection to ST Link (or any other tool that uses SWO). Thus the original request to add this feature by tapping into OpenOCD which exposes SWO output.

mrx23dot commented 3 months ago

There is an openocd command to get the stream https://stackoverflow.com/questions/50075076/show-cortex-m4-swo-log-with-openocd

Others said on stackoverflow:

using OpenOCD successfully for SWO capture with an STM32F7 platform: I've had to add gdb events to my .cfg file to force the itm port to initialize and flush consistently ... using the folllowing:

$_TARGETNAME configure -event gdb-detach { itm port 0 off; itm port 1
off; reset; shutdown }
$_TARGETNAME configure -event gdb-attach
{adapter_khz 4000; itm port 0 on; itm port 1 on}

Personally, I try to avoid SWO as much as possible, UART is better if you can afford it.