Important

Please also refer to Configure C/C++ debugging in Visual Studio Code documents for descriptions of launch.json.

3.1. Configuring the launch configuration

In order to start debuging a project using VS Code and the Renesas Debug extension, a configuration file called "launch.json" needs to be created. Please follow the instructions below to create the launch configuration:

Note
RA Smart Configurator is automatically creating the launch.json file while generating the project files. If you already generated the project using RA Smart Configurator, then you can skip to section 3.2. Starting the debug session.
  1. Select [Run and Debug] view.

    vscode debug start1
  2. Select [create a launch.json file] link.

    vscode debug start2
  3. Select one of the Renesas debuggers from the options menu:

    1. Renasas Amalgamator: For running the debug session on R-Car S4 devices with ARM/G4MH, CA55 and CR52 cores.

    2. Renesas GDB Hardware Target: For running the debug session on RA, RH850, RL78, RX or RZ device families.

    3. Renesas GDB Simulator Target: For running the debug session on RL78 or RX device family simulators.

    4. Renesas RCAR Linux Target: For running the debug session on R-Car family devices which are running Linux operating system.

    5. Renesas RCAR Target: For running the debug session on R-Car family devices.

    vscode debug start3
  4. VS Code will generate "launch.json" file will be created inside ".vscode" folder with some default settings.

    vscode debug start4
  5. The minimum configuration of the launch configuration is shown below:

    launch.json format
    {
        // 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": "<type>",
                "request": "launch",
                "name": "<display name of the configuration>",
                "target": {
                    "deviceFamily": "<device family (RA, RCAR, RH850, RL78, RX or RZ)>",
                    "device": "<device code>",
                    "debuggerType": "<debugger type (type of the simulator or emulator)>"
                }
            }
        ]
    }
Note
Different Renesas debuggers supports different device families and emulator/simulator types. Please check the section 4.1.3. Debuggers, Device Families and Emulator/Simulator Types in launch.json for more details.

3.1.1. Renesas Amalgamator

Renesas Amalgamator (renesas-amalgamator) type supports debugging session for R-Car S4 devices with ARM/G4MH, CA55 and CR52 cores. Please refer to the advanced guidelines for more details:

3.1.2. Renesas GDB Hardware Target

Renesas GDB Hardware Target (renesas-hardware) type is enabling the emulator debugging for hardware devices with RA, RH850, RL78, RX or RZ device family Renesas MCU’s. For Renesas GDB Hardware Target, an example launch configuration shown below:

Example launch.json for "Renesas GDB Hardware Target" for RA device family
{
  // 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": "renesas-hardware",
      "request": "launch",
      "name": "Renesas GDB Hardware Debugging",
      "target": {
        "deviceFamily": "RA",
        "device": "R5F51101",
        "debuggerType": "SEGGERJLINKARM"
      }
    }
  ]
}

Renesas GDB Hardware Target (renesas-hardware) supports variety of device families and hardware debug emulators. Supported device families and debug emulator type listed below:

Debugger

type

target.deviceFamily

target.debuggerType

Renesas GDB Hardware Target

renesas-hardware

RA

E2

E2LITE

SEGGERJLINKARM

RH850

E1

E2

RL78

E1

E2

E2LITE

EZ

IECUBE

RX

E1

E2

E20

E2LITE

EZ

SEGGERJLINKRX

RZ

SEGGERJLINKARM

3.1.3. Renesas GDB Simulator Target

Renesas GDB Simulator Target (renesas-simulator) type is enabling debugging operation for RL78 and RX device family simulators in developer machine. Here is an example launch configuration for using simulator for an RX device family project:

launch.json example for project build with GCC toolchain
{
  // 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": "renesas-simulator",
      "request": "launch",
      "name": "Renesas GDB Simulator Debugging",
      "target": {
        "deviceFamily": "RX",
        "device": "R5F51101",
        "debuggerType": "SIMULATOR"
      }
    }
  ]
}

Renesas GDB Simulator Target (renesas-simulator) supports simulators for RL78 and RX device families.

Debugger

type

target.deviceFamily

target.debuggerType

Renesas GDB Simulator Target

renesas-simulator

RL78

SIMULATOR

RX

SIMULATOR

3.1.4. Renesas RCAR Linux Target

Note
Please note that Renesas RCAR Linux Target requires e2 Studio for R-Car installation for using the support files. Please install the latest e2 Studio for R-Car for debugging with Renesas RCAR Linux Target.

Renesas RCAR Linux Target (renesas-rcar-linux) type is enabling debugging operation for Renesas R-Car family Linux devices. Renesas RCAR Linux Target is using SSH connection to connect target device, automatically creating a SSH Tunnel between the target device and the developer machine during the debug session.

The following configuration contains a sample definition for Renesas RCAR Linux Target, where the board accepts username/password authentication method for SSH connection:

launch.json example for Renesas RCAR Linux project
{
  // 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": "renesas-rcar-linux",
      "request": "launch",
      "name": "Renesas RCAR Linux Debugging",
      "program": "${workspaceFolder}/build/rcar.debug.V3H2/helloworld_sample_app_v3h2_d",
      "target": {
        "deviceFamily": "RCAR",
        "device": "V3H2",
        "debuggerType": "RCAR_PROXY",
        "supportFolder": "C:/Users/john.doe/.eclipse/com.renesas.platform_1560647701/DebugComp/RCar",
        "ssh": {
          "host": "192.168.10.10",
          "user": "root",
          "password": "the-password",
        }
      }
    }
  ]
}
Important
Developers need to define the path of the support files folder with target.supportFolder property in launch configuration. This is the DebugComp/RCar folder of the support files folder of e2 Studio for R-Car installation.

Renesas RCAR Linux Target also supports RSA private key authentication method. The following configuration shows how to pass the private key information to the debug session.

launch.json example for Renesas RCAR Linux project with private key authentication
{
  // 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": "renesas-rcar-linux",
      "request": "launch",
      "name": "Renesas RCAR Linux Debugging",
      "program": "${workspaceFolder}/build/rcar.debug.V3H2/helloworld_sample_app_v3h2_d",
      "target": {
        "deviceFamily": "RCAR",
        "device": "V3H2",
        "debuggerType": "RCAR_PROXY",
        "supportFolder": "C:/Users/john.doe/.eclipse/com.renesas.platform_1560647701/DebugComp/RCar",
        "ssh": {
          "host": "192.168.10.10",
          "user": "root",
          "privateKeyPath": "C:/Users/john.doe/.ssh/id_rsa"
        }
      }
    }
  ]
}

Renesas RCAR Linux Target (renesas-rcar-linux) supports the following configuration:

Debugger

type

target.deviceFamily

target.debuggerType

Renesas RCAR Linux Target

renesas-rcar-linux

RCAR

RCAR_PROXY

3.1.5. Renesas RCAR Target

Renesas RCAR Target (renesas-rcar) type is enabling debugging operation for R-Car devices. Here is an example launch configuration for using simulator for an R-Car device family project:

launch.json example for project build with GCC toolchain
{
  // 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": "renesas-rcar",
      "request": "launch",
      "name": "RCAR",
      "program": "${cwd}/Debug/MR_BAREMETAL_CA55.axf",
      "target": {
        "deviceFamily": "RCAR",
        "device": "R8A779F0_CA55",
        "debuggerType": "E2ARM"
      }
    }
  ]
}

Renesas RCAR Target (renesas-rcar) supports the following configurations:

Debugger

type

target.deviceFamily

target.debuggerType

Renesas RCAR Target

renesas-rcar

RCAR

E2ARM, E2RH850, IE850ARH850, LAUTERBACHT32

RH850

E1, E2, IE850ARH850

3.2. Starting the debug session

After setting up the launch configuration, a debug session can be started by selecting the created configuration and clicking the [Start Debugging] button in the [Run and Debug] tab, or pressing [F5] from the keyboard.

vscode debug start5

When VS Code starts the debug session, common debug control flow functions like resume, suspend, step into, step over, step out, restart, terminate debug session can be performed via the debug flow control buttons. Also, the [Debug Console] view will contains useful messages during the debug session.

vscode debug start6

During the debug session, details about the local variables, device registers, call stack, watched variables, states of the peripherals can be accessed at the primary sidebar of VS Code in the [Run and Debug] tab.

vscode debug start7

< 2. Creating and Building a Project

4. Productivity Tips, Advanced Guidelines, Troubleshooting and Common Issues >