question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Volunteers needed to test OpenOCD/JLink with SEGGER Real Time Trace (RTT)

See original GitHub issue

Updated: Aug 6, 2021, 7:12 PST SWO text output is now directed to a Terminal and so is output of GDB server (OpenOCD, JLink, etc.). This also enables bidirectional semihosting

I have a branch made for implementing RTT support in VSCode. The branch is called ‘rtt’. There are a few things you need to get started

If you just want to install the extension in its current state see https://github.com/Marus/cortex-debug/releases.

But, if you want to build from sources, clone and compile the extension (make sure you are using the rtt branch. See instructions here

I had to patch OpenOCD due to a race condition I kept running into that is available here (more on that later). Unfortunately, you have to build OpenOCD which is not a trivial task. But the public OpenOCD might work for you https://github.com/haneefdm/openocd

~~You may need to install node so that it is available from the command line. https://nodejs.org/en/download/~~ NodeJS installation is no longer required.

Most of my testing has been on a Mac and some on Windows.

console, binary and 'graphdecoders, very similar to what SWO supports. The text output of the RTT goes into a new Terminal. In VSCode (July 2021 release), you can peel a terminal and dock it in other places. You will have as many consoles as you have channels and they are bi-directional. There is quite a bit of customization. You have to use IntelliSense inlaunch.json` to learn more.

image

Here is a launch.json entry for enabling RTT

            "rttConfig": {
                "enabled": true,
                "address": "auto",
                "decoders": [
                    {
                        "port": 0,     // In RTT lingo, this is the buffer index (or channel)
                        "type": "console",
                    }
                ]
            },

Note: RTT has been enabled only for launch type debug sessions. attach will come soon after launch is working properly.

Technically, you can use VSCode to do all the setup and no decoders. You can then use SEGGERs free RTT tools if that is what you prefer. That method has certain benefits.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:46 (21 by maintainers)

github_iconTop GitHub Comments

1reaction
haneefdmcommented, Oct 8, 2021

Coming today. Now, you can plot RTT data (especially with OpenOCD) just like you could with SWO image The procedure is the same as what is described for SWO. Wherever it says port, it is the same as an RTT channel. We may support the use of channel later or we just get used to it 😃 In the plot above

  • I wrote binary data to RTT channel #1 in FW. You have to initialize channel#1 first. Only Channel#0 is auto initialized. In my example, I was using some random numbers normalized to 16 bits. Data read by Cortex-Debug however is always 32 bits at a time.
  • Configured a decoder to read binary data of type graph.in launch.json. I set the graphId to "ABCD"
                   {
                        "label": "",
                        "port": 1,
                        "type": "graph",
                        "encoding": "unsigned",
                        "graphId": "ABCD",
                        "scale": 0.5
                    }
  • setup graphConfig to create the plot. I used the graphId created above. I used a timespan of 5 seconds
            "graphConfig": [
                {
                    "label": "Graph 1",
                    "timespan": 5,
                    "type": "realtime",
                    "annotate": false,
                    "maximum": 66000,
                    "minimum": 0,
                    "plots": [
                        {
                            "graphId": "ABCD", 
                            "label": "abcd",
                            "color": "#53753c"
                        },
                    ]
                },
            ],

I reused all the wonderful infrastructure that @Marus had already created and hooked it up to the RTT channels. Notice that the plots is an array meaning that you can plot data from multiple graphId.

1reaction
haneefdmcommented, Jul 28, 2021

@bmcdonnell-fb Yes, I know that the virtual terminals are very different from actual channels. The logging tool is an offline tool and does not cooperate with a debug session. Here, I am trying to do all of that with one tool. The existing JLink tools (Viewer, Client & Logger) can be used standalone (or while debugging with Cortex-Debug) as always.

We want the additional channel functionality in the JLinkGDBServer which would be most useful.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Volunteers needed to test OpenOCD/JLink with SEGGER Real Time ...
Volunteers needed to test OpenOCD/JLink with SEGGER Real Time Trace (RTT) ... directed to a Terminal and so is output of GDB server...
Read more >
J-Link RTT – Real Time Transfer - Segger
SEGGER's Real Time Transfer (RTT) is the proven technology for system monitoring and interactive user I/O in embedded applications.
Read more >
RTT Viewer - J-Link Tools - Segger
RTT Viewer – GUI app for using all RTT features in a single application. Available for Windows, macOS and Linux. Learn more at...
Read more >
Debug Probes - J-Link & J-Trace - SEGGER Wiki
J-Trace PRO is an advanced debug probe that supports the advanced tracing features of Arm Cortex cores. It can capture complete instruction traces...
Read more >
J-Link RTT Viewer - SEGGER Wiki
The J-Link RTT Viewer Configuration dialog is used to set all necessary device specifics to successfully connect and read/send RTT data from/to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found