Skip to main content

How to use VSCode as Front-End for TRACE32 - Knowledgebase / TRACE32 PowerView - Lauterbach Support

How to use VSCode as Front-End for TRACE32


To use Visual Studio Code (VSCode) as a frontend for TRACE32, you can utilize the Debug Adapter Protocol (DAP). Although TRACE32 does not natively support DAP, you can set up a proxy to translate between DAP and TRACE32’s Remote API (RCL).  This proxy enables VSCode to function as an effective Front-End for TRACE32, facilitating enhanced debugging capabilities.



Usage

1- You need TRACE32 version Nightly from 2024-07-16 (Build 170887 or later) or starting from the DVD R.2024.09

2- Start TRACE32 with API enabled:

  • By adding this block to the config file:

   
   RCL=NETTCP
   PORT=20000
  • Or using the command line option (TRACE32 version Nightly from 2024-07-19 (Build 171009 or later)):

-–t32-api-rcl=TCP 20000

Example: t32marm.exe -–t32-api-rcl=TCP 20000 -c config.t32

  • Or using the PRACTICE commands (TRACE32 version Nightly from 2024-07-19 (Build 170994 or later)):

SETUP.API.RCL /Interface TCP /Port 20000.

3- Open VSCode

4- Add a configuration in VSCode (Menu → Run → Add Configuration → select empty)

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "dapserver attach",
            "debugServer": 58870,
            "cmm": "~~/demo/arm/compiler/arm/cppdemo.cmm", //optional cmm to be called
           // "trace32Node": localhost, //IP address
            "trace32Port": 20000 //API port
        }
    ]
}

5- Run t32debugadapter.exe in cmd line (can be found under ~~/demo/env/vscode or can be downloaded from our website), or check the Tip below

6- In VSCode, go to RUN AND DEBUG and start the debug of dapserver attach (or just F5)


💡 Tip:

You can automatically start the debug adapter (step 5) by using a preLaunchTask:

launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "type": "node",
            "request": "attach",
            "name": "start debug adapter and attach",
            "preLaunchTask": "start_debug_adapter",
            "debugServer": 58870,
            "cmm": "~~/demo/arm/compiler/arm/cppdemo.cmm",
            // "trace32Node": localhost, //IP address
            "trace32Port": 20000
        }
    ]
}

and tasks.json:

{
    "version": "2.0.0",
    "tasks": [{
        "label": "start_debug_adapter",
        "command": "start C:/T32/demo/env/vscode/bin/windows64/t32debugadapter.exe", // adjust path as needed
        "args": [],
        "type": "shell"
    }]
}


Helpful Unhelpful

9 of 9 people found this page helpful

Comments (14)

Sepehr Bijani
Hello, Since we are using linux environment for debugging and build, could you provide "t32debugadapter" for linux? BR, Sepehr Bijani
Wiem Wala Benayed

The Linux version will be available soon in our website.

For the moment, I will send it via email.


FLAVIO VINCENZO CONDEMI
Can I have the t32debugadapter linux version too?
Wiem Wala Benayed

The Linux and Mac versions are available in our website


FLAVIO VINCENZO CONDEMI
I just checked and I see there is a file in bin/pc_linux64 folder called t32debugadapter. In windows I execute the .exe file (I find it in bin/windows folder). I'm wondering how I can execute this file in Linux. I tried with "source t32debugadapter" command, but I got an error. Do I need to copy and paste the file somewhere else? Thank you in advance
Wiem Wala Benayed

You can simply call it in a terminal with: “ <PATH>/t32debugadapter”


Kyrylo M
Tried to use this configuration and it fails on launch with following error: InitializeRequestArguments.__init__() got an unexpected keyword argument supportsANSIStyling' My Trace32 version is: TRACE32 for ARM Nightly Build (64-bit) Software Version: N.2024.10.000173431 Build: 173431. I got t32debugadapter.exe from https://repo.lauterbach.com/scripts/misc/env~vscode_/misc-env-vscode_20240921000808_all_files.zip
Wiem Wala Benayed

The error ’InitializeRequestArguments.__init__() got an unexpected keyword argument supportsANSIStyling' is now fixed.
Please use the new version ( v0.0.7) of t32debugadapter available in our website.


Bo Mellberg
Hi! I have the following setup: Linux build system, with Lauterbach setup via USB. Debugging works fine using the Trace32 front-end on Ubuntu. VSCode frontend on Windows laptop, connected to the Linux build system using Remote Host over SSH. This allows me to perform developing tasks easily from home as well as in-office, but the debugging still needs to be done on Ubuntu front-end (via Remote Desktop). How can I use VSCode as a debug front-end on my setup? All I can come up with is running the t32tcpusb on the Linux machine and on top of that run the t32debugadapter.exe on the Windows machine.
Wiem Wala Benayed

You can use the parameters "trace32Node" to set the IP address of the Linux machine. In this case TRACE32 can be started in Linux and VSCode + t32debugadapter in windows.

In this case, you may not see the source file as it is located in the Linux machine.


Bo Mellberg
I get "ECONNREFUSED 127.0.0.1:58870" when I try that. { "type": "node", "request": "attach", "name": "dapserver attach", "debugServer": 58870, "trace32Node": "10.142.0.139", "trace32Port": 20000 } trace32 is running on the Linux host with RCL=NETTCP and PORT=20000
Wiem Wala Benayed

Please make sure to use v0.0.8 of t32debugadapter


Bo Mellberg
"Please make sure to use v0.0.8 of t32debugadapter" Where can I find this? I can't even find the old version 0.0.7 anymore.
Kristoffer Martinsson

Add a comment

ID-0
To prove you are a human, please tell us the text you see in the CAPTCHA image