11. Quick Start for Renesas RZ

11.1. Supported Environments

Operating System

Windows: Windows 10 / Windows 11

Linux: Ubuntu 22.04 / Ubuntu 24.04

VS Code version

1.96.0 (minimum)

VS Code can be downloaded and installed from this page https://code.visualstudio.com/.

11.2. Installation

To utilise the Renesas VS Code extensions on Windows, it’s necessary to install “CMake” and “Ninja Build” for project build operations.

You can install “CMake” and “Ninja Build” by downloading their latest installers.

Step 1: Install the latest “CMake” for Windows.

  1. Download the latest version of CMake for Windows.

    https://cmake.org/download/

  2. Install CMake for Windows.

    Important

    You must add the CMake folders to the “Path” environment variable. The Windows Installer of CMake has an option to modify the system’s environment variables and add the CMake folders to the “Path” variable. Please select this option during installation. If you are not using the installer or this option is not selected during installation, please use the following notes to manually add CMake’s bin folder to the Path variable.

Step 2: Install the latest “Ninja Build” for Windows.

  1. Download the latest version of Ninja for Windows.

    https://github.com/ninja-build/ninja/releases/

  2. Extract the downloaded zip file (ninja-win.zip) and place the ninja.exe into a folder.

    (e.g.: C:\Tools\ninja-build\ninja.exe).

Step 3: Configure the “Path” environment variable.

  1. Open the System Environment Variables configuration, and add the following variables:

    1. Add the path of CMake’s bin folder if it is not defined during the CMake installation.

      (e.g. C:\Program Files\CMake\bin).

    2. Add the path of the ninja.exe folder. (e.g. C:\Tools\ninja-build).

    Guide for managing System Environment Variables
    1. Use Windows Search to find and open “Edit the system environment variables

      _images/installation-env-variables1.png
    2. In the “Advanced” tab, click on the “Environment Variables…” button to open the “Environment Variables” dialog.

    3. Select to edit the “Path”.

      _images/installation-env-variables2.png
    4. Add CMake’s bin folder to the “Path” environment variable, then perform the following steps:

    5. Add the path of CMake’s bin folder if it is not defined during the CMake installation. (e.g. C:\Program Files\CMake\bin).

    6. Add the path of the ninja.exe folder. (e.g. C:\Tools\ninja-build).

Alternatively, Windows Prerequisites can be installed with Windows Package Manager Command Line Tool winget (*). Please run the following commands in Windows Command Prompt:

winget install Kitware.CMake
winget install Ninja-build.Ninja

(*) The winget is a command line tool enables users to discover, install, upgrade, remove and configure applications on Windows 10 and Windows 11 computers. This tool is the client interface to the Windows Package Manager service. It is a straightforward process if you want to use winget package manager for CMake and Ninja Build installation. For more information about winget, please visit: https://learn.microsoft.com/en-us/windows/package-manager/winget/

Installing Python 3.10:

  1. Install the 64-bit version of the Python 3.10 into your system.

    https://www.python.org/downloads/

  2. Add the path of the folder the Python 3.10 into the “Path” environment variable.

    Guide to add Python 3.10 folder into the “Path” environment variable
    1. Use Window search to find and open “Edit the system environment variables

      _images/installation-env-variables1.png
    2. In “Advanced” tab, click on “Environment Variables…” button to open “Environment Variables” dialog

    3. Select to edit “Path

      _images/installation-env-variables2.png
    4. Add the path of Python 3.10 folder

      _images/installation-env-variables3-python3.png
    5. Click OK to close the dialog

Installing Emulator Drivers

You may need to download and install additional USB drivers for establishing a proper connection with the emulators and devices. Please install the latest SEGGER J-Link drivers before starting your debug session. Use the following link to download the J-Link drivers suitable for your operating system:

Installing the Dependent Packages:

  • Run the following commands to refresh the package lists, and install the dependent packages:

    sudo apt update
    sudo apt install cmake ninja-build libusb-1.0-0-dev python3.10-dev
    

Installing the Dependent Packages:

  • Run the following commands to refresh the package lists, and install the dependent packages:

    sudo apt update
    sudo apt install cmake ninja-build libusb-1.0-0-dev
    

Installing Python 3.10:

  • Install Python 3.10 libraries for debugging in device families Dialog, RA, RL78, RX and RZ. Python 3.10 is not directly accessible at the default APT repository of Ubuntu 24.04, you can use the 3rd party repository (ppa:deadsnakes/ppa) to install Python 3.10 by following the instructions below:

    sudo add-apt-repository ppa:deadsnakes/ppa
    sudo apt update
    sudo apt install python3.10-dev
    

11.3. Opening a Project

RZ projects which are non-FSP RZ projects created in e 2 studio, can be opened in VS Code by simply opening the project folder, and then developers can use the predefined CMake Build Scripts for RZ provided by the Renesas Build Utilities to build the project.

11.3.1. Opening the project in VSCode

  1. In [Explorer] view, select [Open Folder] button if available. If not, select [File] → [Open Folder…] menu item.

    _images/IDE-54291_11.png _images/IDE-54291_12.png
  2. In [Open Folder] dialog, browse to project folder and click [Select Folder] button.

Besides, there are alternative methods to open a project in VS Code, you can check the alternative methods in “Productivity Tips” section Alternative ways for opening a project in VSCode

11.3.2. Creating CMake Toolchain Scripts and Building the Project

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

  • Create GCC RZ 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:

  • .vscode/settings.json - this file contains the settings for CMake.

  • .vscode/tasks.json - this file contains the build definitions for VSCode.

  • Cross.cmake - this file contains the information about the toolchain to use.

  • CMakeLists.txt - this file contains the information about the building project (which files to build, which options to set etc.).

After generating these files, it is necessary to configure the toolchain information and device specific build settings in these files. The typical approach can be structured into the following steps:

  1. Open the cross.cmake file, and configure the toolchain path.

  2. Get the device specific build settings from e2 Studio by following the instructions below:

    2.1. Open the desired project in e2 studio.

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

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

    2.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

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

11.4. Building the Project

  1. Open the [Command Palette] in VSCode and click [CMake: Delete Cache and Reconfigure].

  2. In the first time of running, a kit selection is shown. Select “[Unspecified]”.

    _images/cmake-toolchain-selection-unspecified.png

    Note

    Missing the selection of the CMake Kit or wrong selection can cause build problems. If you missed the CMake Kit selection or selected a wrong kit, you can re-select the CMake Kit by running “CMake: Select a kit” command from the VSCode Command Palette.

    _images/cmake-toolchain-sak.png
  3. Go to and click [Terminal] => [Run Build Task] from the menu.

    _images/cmake-build-generic-1.png
  4. Build options will be shown, select the [Build Project] option.

    _images/cmake-build-generic-2.png

11.5. Debugging the Project

For debugging, you should create a debug launch configuration if it is not created already.

  1. Go to the [Debug] tab in VSCode and generate a launch configuration for [Renesas GDB Hardware Debugging]. This will generate a sample Launch configuration in the .vscode/launch.json file.

  2. Open the Launch configuration and set the correct parameters for your target device. For example:

     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-hardware",
     9      "request": "launch",
    10      "name": "Renesas GDB Hardware Debugging",
    11      "target": {
    12        "deviceFamily": "RZ",
    13        "device": "R7S910001",
    14        "debuggerType": "SEGGERJLINKARM"
    15      }
    16    }
    17  ]
    18}
    

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.

_images/vscode-debug-launch-generic-1.png

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 contain useful messages during the debug session.

_images/vscode-debug-launch-generic-2.png

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.

_images/vscode-debug-launch-generic-3.png