14. Advanced Guidelines

14.1. Setup environment and debug multicore CA55 with CR52 using renesas-amalgamator

14.1.1. Overview

Support debug multicore with CA55 and CR52 for R-Car S4 device on VS code.

This item describes how to connect the S4 board to the PC host, install an extension, import the project, configure file launch.json, run and debug.

14.1.2. Connecting S4 board to PC host

We need to connect between board and PC to debug multicore ARM on VSCode as shown in the picture below:

_images/Presentation3.gif

Select the mode for S4 Spider Configuration tool -Renesas as shown below:

_images/Screenshot_114.png

14.1.3. Setup debugger options

  1. Install the Renesas Debug extension to VSCode (please refer to Section 1: Installation).

  2. Import the built CA55 and CR52 projects into VS Code.

  3. In order to debug a project using VS Code and the Renesas Debug extension, a configuration file called launch.json needs to be created.

    1. Select [Run and Debug] view.

      _images/Screenshot_182.png
    2. Select [Create a launch.json file] link.

      _images/Screenshot_183.png
    3. Select [Renesas Amalgamator].

      _images/Screenshot_184.png
    4. A launch.json file will be created inside .vscode folder with some default settings.

    5. In the launch.json file, fill in the following fields.

      .launch.json
       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "renesas-amalgamator",
       9      "request": "launch",
      10      "name": "<display name of the configuration>",
      11      "children": [
      12        {
      13          "name": "<display name of core>",
      14          "debugAdapterRuntime": "node",
      15          "multipleCore": true,
      16          "interfaceName": "CortexR52",
      17          "interfaceType": "GDB",
      18          "arguments": {
      19            "type": "renesas-rcar",
      20            "request": "launch",
      21            "hardwareBreakpoint": true,
      22            "program": "<absolute path to project's executable file (.x, .elf,...)>",
      23            "target": {
      24              "deviceFamily": "RCAR",
      25              "device": "<CPU of the device>",
      26              "debuggerType": "<type of the debugger>"
      27            }
      28          }
      29        },
      30        {
      31          "name": "<display name of core>",
      32          "debugAdapterRuntime": "node",
      33          "multipleCore": true,
      34          "request": "attach",
      35          "arguments": {
      36            "type": "renesas-rcar",
      37            "request": "attach",
      38            "hardwareBreakpoint": true,
      39            "program": "<absolute path to project's executable file (.x, .elf,...)>",
      40            "target": {
      41              "deviceFamily": "RCAR",
      42              "device": "<CPU of the device>",
      43              "debuggerType": "<type of the debugger>",
      44            }
      45          }
      46        }
      47      ]
      48    }
      49  ]
      50}
      

      Example configuration file launch.json:

      .Example: launch.json
       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "renesas-amalgamator",
       9      "request": "launch",
      10      "name": "Debug Multiple",
      11      "children": [
      12        {
      13          //ARM Core CA55
      14          "name": "CA55",
      15          "debugAdapterRuntime": "node",
      16          "multipleCore": true,
      17          "interfaceName": "CortexR52",
      18          "interfaceType": "GDB",
      19          "arguments": {
      20            "type": "renesas-rcar",
      21            "request": "launch",
      22            "hardwareBreakpoint": true,
      23            "program": "${cwd}/CACore_Project/build/release/ca55_loader.elf",
      24            "target": {
      25              "deviceFamily": "RCAR",
      26              "device": "R8A779F0",
      27              "debuggerType": "E2ARM",
      28              "serverParameters": ["-uInteface=", "JTAG", "-w", "0", "-uConnectMode=", "RESET", "-uWorkRamAddress=", "0x0", "-uSyncMode=", "async", "--gdbVersion=", "7.2"]
      29            },
      30          }
      31        },
      32        {
      33          //ARM Core CR52
      34          "name": "CR52",
      35          "debugAdapterRuntime": "node",
      36          "multipleCore": true,
      37          "request": "attach",
      38          "arguments": {
      39            "type": "renesas-rcar",
      40            "request": "attach",
      41            "hardwareBreakpoint": true,
      42            "program": "${cwd}/CRCore_Project/build/release/cr52_loader.elf",
      43            "target": {
      44              "deviceFamily": "RCAR",
      45              "device": "R8A779F0_CR52",
      46              "debuggerType": "E2ARM"
      47            },
      48          }
      49        }
      50      ]
      51    }
      52  ]
      53}
      

14.1.4. Start debugging

  1. After setting up debugger options, a debug session can be started by selecting the created configuration and click [Start Debugging] button in [Run and Debug] view, or press [F5].

    _images/IDE-79461.png
  2. Waiting for the program to launch and debug successfully.

    _images/image2022-12-6_10-54-17.png
  3. Displaying variables, watch expression, call stack… are supported in VS Code:

    1. Select [View] -> [Open View…]

      _images/image2022-12-6_10-55-33.png
    2. Select the Views to be displayed on the window.

      _images/image2022-12-6_10-56-17.png

14.2. Setup environment and debug project ARM & G4MH using renesas-amalgamator

14.2.1. Overview

Support multiple different (ARM/G4MH) cores for R-Car S4 device on VS code.

This item describes how to debug (Project ARM+G4MH).

14.2.2. Connecting S4 board to PC host

We need to connect between board and PC to debug ARM and G4MH on VSCode as shown in the picture below:

_images/Presentation2.gif

Select the mode for S4 Spider Configuration tool -Renesas as shown below:

_images/spider_configuration.png

14.2.3. Setup debugger options

  1. Install the Renesas Debug extension to VSCode (please refer to Section 1: Installation).

  2. Import the built G4MH and CR52 projects into VS Code.

  3. In order to debug a project using VS Code and the Renesas Debug extension, a configuration file called launch.json needs to be created.

    1. Select [Run and Debug] view.

      _images/Screenshot_182.png
    2. Select [Create a launch.json file] link.

      _images/Screenshot_183.png
    3. Select [Renesas Amalgamator].

      _images/Screenshot_184.png
    4. A launch.json file will be created inside .vscode folder with some default settings.

    5. In the launch.json file, fill in the following fields

      .launch.json
       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "renesas-amalgamator",
       9      "request": "launch",
      10      "name": "<display name of the configuration>",
      11      "children": [
      12        {
      13          //RH850 Core G4MH
      14          "name": "<display name of core>",
      15          "debugAdapterRuntime": "node",
      16          "arguments": {
      17            "type": "renesas-rcar",
      18            "request": "launch",
      19            "program": "<absolute path to project's executable file (.x, .elf,...)>",
      20            "target": {
      21              "deviceFamily": "RCAR",
      22              "device": "<CPU of the device>",
      23              "debuggerType": "<type of the debugger>"
      24            }
      25          }
      26        },
      27        {
      28          //Core Arm (CA/CR)
      29          "name": "<display name of core>",
      30          "debugAdapterRuntime": "node",
      31          "arguments": {
      32            "type": "renesas-rcar",
      33            "request": "launch",
      34            "program": "<absolute path to project's executable file (.x, .elf,...)>",
      35            "target": {
      36              "deviceFamily": "RCAR",
      37              "device": "<CPU of the device>",
      38              "debuggerType": "<type of the debugger>"
      39            }
      40          }
      41        }
      42      ]
      43    }
      44  ]
      45}
      

      Example configuration file launch.json:

      .Example: launch.json
       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "renesas-amalgamator",
       9      "request": "launch",
      10      "name": "Debug Multiple",
      11      "children": [
      12        {
      13          //RH850 Core G4MH
      14          "name": "G4MH",
      15          "debugAdapterRuntime": "node",
      16          "arguments": {
      17            "type": "renesas-rcar",
      18            "request": "launch",
      19            "program": "${cwd}/G4MH/HardwareDebug/G4MH_Debug.x",
      20            "target": {
      21              "deviceFamily": "RCAR",
      22              "device": "R8A779F0",
      23              "debuggerType": "E2RH850",
      24              "serverParameters": ["-ulpdType=","15","-uJTagClockFreq=","Default","-setOptJtagLpd=","-uocdID=","0000000000000000000000000000000000000000000000000000000000000000","-ucustomerID=","0000000000000000000000000000000000000000000000000000000000000000","-uneedAuthentication=","0","-uWorkRamAddress=","0x0","-uTraceEnable=","PE0|PE1","-uTraceClock=","PE0|400|PE1|400","-uUseSyncTrace=","1","-uSyncTraceStandard=","0","-uTraceCore=","PE0","--gdbVersion=","7.2"]
      25            },
      26          }
      27        },
      28        {
      29          //Core Arm (CA/CR)
      30          "name": "ARM",
      31          "debugAdapterRuntime": "node",
      32          "arguments": {
      33            "type": "renesas-rcar",
      34            "request": "launch",
      35            "program": "${cwd}/BAREMETAL_CR52/Debug/MR_BAREMETAL_CR52.axf",
      36            "target": {
      37                "deviceFamily": "RCAR",
      38                "debuggerType": "E2RARM",
      39                "device": "R8A779F0_CR52",
      40                "serverParameters": ["-uInteface=", "JTAG", "-w", "0", "-uWorkRamAddress=", "0x0", "--gdbVersion=", "7.2"]
      41            },
      42          }
      43        }
      44      ]
      45    }
      46  ]
      47}
      

14.2.4. Start debugging

In the select box RUN AND DEBUG (ctrl+shift+D) select “Debug Multiple” option then click [Start Debugging] (F5) button.

_images/Screenshot_34.png

Waiting for program to launch and debug successfully.

_images/Screenshot_35.png

14.3. Setup environment and debug multi-core ARM device R-Car S4 (CA55: CPU0 to CPU7)

14.3.1. Overview

Support debug multicore with CA55 (CPU0 -> CPU7) for R-Car S4 device on VS code.

This item describes how to connect the S4 board to the PC host, install an extension, import the project, configure file launch.json, run and debug.

14.3.2. Connecting S4 board to PC host

We need to connect between board and PC to debug multicore ARM on VSCode as shown in the picture below:

_images/Presentation3.gif

Select the mode for S4 Spider Configuration tool -Renesas as shown below:

_images/Screenshot_114.png

14.3.3. Setup debugger options

  1. Install the Renesas Debug extension to VSCode. (Refer to section <<2.1 Setup VS Code,2.1 Setup VS Code>>)

  2. Import the built CA55 projects into VS Code.

  3. In order to debug a project using VS Code and the Renesas Debug extension, a configuration file called launch.json needs to be created.

    1. Select [Run and Debug] view.

    2. Select [Create a launch.json file] link.

    3. Select [Renesas R-Car Debugging].

    4. A launch.json file will be created inside .vscode folder with some default settings.

    5. In the launch.json file, fill in the following fields.

      .launch.json
       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "renesas-rcar",
       9      "request": "launch",
      10      "name": "<display name of the configuration>",
      11      "program": "<absolute path to project's executable file (.x, .elf,...)>",
      12      "target": {
      13        "debuggerType": "<type of the debugger>",
      14        "device": "<CPU of the device>",
      15        "deviceFamily": "RCAR",
      16      }
      17    }
      18  ]
      19}
      

      Example configuration file launch.json:

      .Example: launch.json
       1{
       2    // Use IntelliSense to learn about possible attributes.
       3    // Hover to view descriptions of existing attributes.
       4    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5    "version": "0.2.0",
       6    "configurations": [
       7      {
       8        "type": "renesas-rcar",
       9        "request": "launch",
      10        "name": "RCAR Multicore CA55",
      11        "program": "${cwd}/Debug/MR_BAREMETAL_CA55.axf",
      12        "target": {
      13          "deviceFamily": "RCAR",
      14          "device": "R8A779F0_CA55",
      15          "debuggerType": "E2ARM",
      16          "serverParameters": ["-uInteface=", "JTAG", "-w", "0", "-uConnectMode=", "RESET", "-uWorkRamAddress=", "0x0", "-uSyncMode=", "async", "--gdbVersion=", "7.2"]
      17        },
      18      },
      19    ]
      20}
      

14.3.4. Start debugging

After setting up debugger options, a debug session can be started by selecting the created configuration and click [Start Debugging] button in [Run and Debug] view, or press [F5].

_images/multicore_ca55.png

Waiting for the program to launch and debug successfully.

_images/IDE-61715_6.png

14.4. Setup environment and debug multi-core G4MH device R-Car S4 or device RH850

14.4.1. Overview

Support debug multicore with multi-core G4MH for R-Car S4 device (PE0, PE1) or device RH850 (PE0,PE1,PE2,PE3) on VS code.

This item describes how to connect the S4 board or RH850 board to the PC host, install an extension, import the project, configure file launch.json, run and debug.

14.4.2. Connecting S4 board to PC host

We need to connect between board and PC to debug multicore ARM on VSCode.

Select the mode for S4 Spider Configuration tool -Renesas if debug with R-Car S4 device.

14.4.3. Setup debugger options

  1. Install the Renesas Debug extension to VSCode. (Refer to section <<2.1 Setup VS Code,2.1 Setup VS Code>>)

  2. Import the built CA55 projects into VS Code.

  3. In order to debug a project using VS Code and the Renesas Debug extension, a configuration file called launch.json needs to be created.

    1. Select [Run and Debug] view.

    2. Select [Create a launch.json file] link.

    3. Select [Renesas R-Car Debugging].

    4. A launch.json file will be created inside .vscode folder with some default settings.

    5. In the launch.json file, fill in the following fields.

      Format of .launch.json:

       1{
       2  // Use IntelliSense to learn about possible attributes.
       3  // Hover to view descriptions of existing attributes.
       4  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
       5  "version": "0.2.0",
       6  "configurations": [
       7    {
       8      "type": "<type>",
       9      "request": "launch",
      10      "name": "<display name of the configuration>",
      11      "program": "<absolute path to project's executable file (.x, .elf,...)>",
      12      "target": {
      13        "deviceFamily": "<the device family name Eg.RCAR>",
      14        "device": "<CPU of the device>",
      15        "debuggerType": "<debugger type (type of the simulator or emulator)>"
      16      }
      17    }
      18  ]
      19}
      

      Sample configurations for launch.json file:

      Sample: launch.json for multi-core G4MH for R-Car S4 device (PE0, PE1)
      {
        // 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
        "configurations": [
          {
            "name": "G4MH",
            "type": "renesas-rcar",
            "request": "launch",
            "hardwareBreakpoint": true,
            "program": "${cwd}/HardwareDebug/G4MH_Debug.x",
            "target": {
              "deviceFamily": "RCAR",
              "device": "R8A779F0",
              "debuggerType": "E2RH850",
              "serverParameters": ["-ulpdType=","15","-uJTagClockFreq=","Default","-setOptJtagLpd=","-uocdID=","0000000000000000000000000000000000000000000000000000000000000000","-ucustomerID=","0000000000000000000000000000000000000000000000000000000000000000","-uneedAuthentication=","0","-uWorkRamAddress=","0x0","-uTraceEnable=","PE0|PE1","-uTraceClock=","PE0|400|PE1|400","-uUseSyncTrace=","1","-uSyncTraceStandard=","0","-uTraceCore=","PE0","--gdbVersion=","7.2"]
            }
          }
        ]
      }
      
      Sample: launch.json for multi-core device RH850 (PE0, PE1, PE2, PE3)
      {
        // 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
        "configurations": [
          {
            "name": "RH850",
            "type": "renesas-rcar",
            "request": "launch",
            "hardwareBreakpoint": true,
            "program": "${cwd}/HardwareDebug/Project_RH850.x",
            "target": {
              "deviceFamily": "RH850",
              "device": "R7F702Z19A",
              "debuggerType": "E2",
              "serverParameters": ["-ulpdType=", "15","-setOptJtagLpd=", "0", "-w", "1", "-usupplyVoltage=", "0", "-uocdID=", "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"]
            }
          }
        ]
      }
      

14.5. Create and build G4MH project on R-Car SDK

14.5.1. Create G4MH Project

  1. From the menu bar select [File] > [New] > [Renesas C/C++ Project] > [Renesas R-Car]

    _images/Screenshot_56.png
  2. Select R-Car project template [Renesas CC-RH C Executable Project], then click [Next] button

    _images/Screenshot_60.png
  3. Input the project name then click [Next] button.

    _images/Screenshot_61.png
  4. In New Renesas CC-RH Executable Project select Create Hardware Debug Configuration [E2 (RH850)], then click [Finish] button

    _images/Screenshot_62.png
  5. Projects will be created.

    _images/Screenshot_63.png

14.5.2. Build Project G4MH

  1. Right-click on the project and select [Build Project]

    _images/Screenshot_64.png
  2. Or can click on the [Build ]icon on the toolbar.

    _images/Screenshot_65.png
  3. Project after built.

    _images/Screenshot_66.png

14.6. Build CVEngine project on R-Car SDK

14.6.1. Create Project

  1. From the menu bar select File > Import…

    _images/Screenshot_67.png
  2. Select Dialog Import “Existing Projects into Workspace”, then click Next button

    _images/Screenshot_68.png
  3. Select Dialog Import “Select archive file” > Select Browse… > Select the project you want to build in your directory, then click Finish button.

    _images/Screenshot_70.png
  4. Project after imported

    _images/Screenshot_71.png

14.6.2. Build Project

  1. Right-click on the project and select “Clean Project

    _images/Screenshot_73.png
  2. Check Toolchain Configuration: From the menu bar select File > Window > Preferences

    _images/Screenshot_75.png
  3. Select Launch Configuration (the name of the project is imported), and Launch Target “V4H DevBoard” on the toolbar.

    _images/Screenshot_77.png
  4. Select “Edit” icon of Launch Target “V4H DevBoard” on the toolbar, then select Target Device “Development board / SoC” and IMP Debug Level “CVe (Shader debugging)”, then click Finish button.

    _images/Screenshot_79.png
  5. Right-click on the project and select “Build Project

    _images/Screenshot_76.png
  6. Project after built

    _images/Screenshot_80.png

14.7. How to specify device specific parameters in CMake scripts

Note

The following instructions are applicable for non Smart Configurator projects. The projects generated by the Smart Configurators will already have the correct build scripts, including device specific parameters for the target device.

Renesas Build Utilities extension provides predefined scripts to build Renesas C/C++ projects. The predefined build scripts can be accessed by opening the [Command Palette] and typing “Create” to filter the commands. The extension provides the following commands:

  • Create CC-RH project files

  • Create CC-RL project files

  • Create CC-RX project files

  • Create GCC RL78 project files

  • Create GCC RX project files

  • Create GCC RZ project files

  • Create LLVM for RL78 project files

  • Create RCar CMake (Development board / SoC) project files

  • Create RCar CMake (Instruction Set Simulators) project files

_images/vscode-create-project-files-menu.png

The commands will generate the VS Code settings files, as well as the CMake script files cross.cmake and CMakeLists.txt files. These files are predefined and need to be tuned for the target devices. To get the correct parameters, we are going to use e2 Studio and find the device specific values for the compiler and the linker.

The typical approach can be structured into the following steps:

  1. Open the desired project in e2 studio.

  2. Go to [Project] => [Properties] menu.

  3. In the project properties windows, navigate to [C/C++ Build] => [Settings] section.

  4. In the “Tool Settings” tab, check the “Common”, “Compiler”, “Assembler”, “Linker” sections. Depending on the target device get the values of the device specific parameters. The following parameters are the most common device specific parameters:

    • -isa

    • -cpu

    • -fpu (generally either -fpu or -nofpu)

    • -rom

    • -start

  5. Now, open the project in VSCode, navigate to CMakeLists.txt and configure the device specific parameters in the CMake script.