12. Quick Start for Renesas RZ/N

12.1. Supported Environments

Operating System

Windows: Windows 10 / Windows 11

VS Code version

1.96.0 (minimum)

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

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

Setting up a build environment with MinGW over MSYS2 for Windows

R-Car and RZ/N families require MinGW Makefiles in the development environment on Windows. Please, install CMake and MSYS2 packages.

Step 1: Install the latest CMake version 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 notes at step 3 to manually add CMake’s bin folder to the Path variable.

Step 2: Install and configure the latest MSYS2 package.

  1. Download the latest version of the MSYS2 package.

    https://www.msys2.org/

  2. Install the MSYS2 package. The MSYS2 package will automatically install the MinGW environment.

  3. Use Windows Search to find and open [MSYS2 MINGW64] terminal.

  4. Install the make package for MinGW64 using pacman package manager.

    pacman -S mingw-w64-x86_64-make
    
  5. Check if make package is installed correctly.

    mingw32-make --version
    

    See also

    make package is a 32-bit package. You can install it by using “MSYS2 MINGW32” terminal instead of “MSYS2 MINGW64” terminal. If you are using “MSYS2 MINGW32” then run the following command for the installation:

    pacman -S mingw-w64-i686-make
    

    Also, please make sure you include the correct folder for the Path environment variable in the next step (e.g. C:\msys64\mingw32\bin).

Step 3: Configure the Path environment variable.

  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 the path of CMake’s bin folder if it is not defined during the CMake installation.

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

  5. Add the path of the MSYS2 and MinGW bin folders.

    (e.g. C:\msys64\usr\bin, C:\msys64\mingw64\bin)

Installing the latest RZ/N Smart Configurator:

Download and install the latest version of RZ/N Smart Configurator:

Installing the “Arm GNU Toolchain” toolchains for RZ/N Development

For installing “Arm GNU Toolchain”:

  1. Download and install the latest toolchain:

    https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads

  2. Add the bin folder of the toolchain as “ARM_GCC_TOOLCHAIN_PATH” to the environment variables.

    Guide for Configuring ARM_GCC_TOOLCHAIN_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. Click to “New…”.

      _images/installation-env-variables-nv.png
    4. Enter the “ARM_GCC_TOOLCHAIN_PATH” to the Variable name field, and click to “Browse Directory…” to select the bin folder of the toolchain. Then click “OK”.

      _images/installation-env-variables-arm-gcc.png

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:

12.3. Creating a Project

Smart Configurator could be directly used from VS Code command palette for creating a project for RZ/N device family.

  1. Open [Command Palette] and select [Renesas: Create RZ/N Project with Smart Configurator] from the commands.

    _images/rasc_rzn_cp_create_project.png
  2. VSCode will show installed [RZ/N Smart Configurator] list, select a [Smart Configurator] from the list.

    _images/rasc_rzn_cp_create_select_rasc.png

    Note

    If an RZ/N Smart Configurator is not detected automatically, the message “No RZ/N Smart Configurator installation found!” will be displayed in VSCode:

    _images/rasc_rzn_cp_no_rasc_found.png

    Please click on “Browse RZ/N SC”, then select the location of the RZ/N Smart Configurator binary (rasc.exe), when the select file dialog window appears. The extension will automatically register the location of the RZ/N Smart Configurator for the next use.

  3. Select a [Folder] to create the project.

    _images/rasc_rzn_cp_create_select_folder.png
  4. In the project name and location selection, Click [Next].

    _images/rasc_rzn_create_project1.png
  5. Configure your board and device type, and configure the project as CMake project, then click [Next].

    _images/rasc_rzn_create_project2.png
  6. Continue without RTOS selection and click [Next].

    _images/rasc_rzn_create_project3.png
  7. Choose one of the project templates then click [Finish] to complete the project creation steps.

    _images/rasc_rzn_create_project4.png
  8. Close [RZ/N Smart Configurator] after generation of the project files completed.

    _images/rasc_rzn_create_project5.png
  9. Open [Config.cmake] file and set [CMAKE_FIND_ROOT_PATH] variable with the path of toolchain’s bin folder. E.g.

    _images/rasc_rzn_create_project6.png

Config.cmake:

# Configuration file for user settings
# This file should include the path for toolchain and other settings that user would like to override.
# Example toolchain path definitions
set(CMAKE_FIND_ROOT_PATH "D:/Toolchains/GCC/gcc-arm-none-eabi-9-2019-q4-major-win32/bin")

12.4. Building the Project

For building a project, which has been created with RZ/N Smart Configurator, please follow the steps below:

  1. In the VS Code Command Palette, run the “CMake: Delete Cache and Reconfigure” command.

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

    _images/rasc_rzn_build_project2.png
  3. Then, run “CMake: Build” command.

    _images/rasc_rzn_build_project3.png
  4. By default, executable file (<project name>.elf) can be found in “build/CMakeFiles/<project name>.elf.dir/” folder.

TIP: For more information about RZ/N Smart Configurator, click here to visit RZ/N Smart Configurator page.

12.5. Debugging the Project

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