9. Quick Start for Renesas RISC-V MCU

9.1. Supported Environments

Operating System

Windows: Windows 10 / Windows 11

Linux: Ubuntu 22.04

VS Code version

1.96.0 (minimum)

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

9.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/edit-env-vars-button.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/edit-path-var-windows.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/edit-env-vars-button.png
    2. In “Advanced” tab, click on “Environment Variables…” button to open “Environment Variables” dialog

    3. Select to edit “Path

      _images/edit-path-var-windows.png
    4. Add the path of Python 3.10 folder

      _images/add-python-3-to-env-vars.png
    5. Click OK to close the dialog

Installing the latest RISC-V MCU Smart Configurator (RISC-V MCU SC):

Download and install the latest version of RISC-V MCU Smart Configurator:

Installing Support Files for RISC-V MCU Development:

Install the RISC-V MCU support files from the [Renesas Support Files Manager] by following the instructions in chapter “Managing Support Files”.

Installing “LLVM for Renesas RISC-V MCU” toolchain for RISC-V MCU Project Build:

For RISC-V MCU projects, it is recommended to use “LLVM for Renesas RISC-V MCU” toolchain.

  1. Download and install the latest toolchain:

    https://llvm-gcc-renesas.com/riscv/riscv-download-toolchains

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

    Configuring RENESAS_RISCV_LLVM_TOOLCHAIN_PATH environment variable
    1. Use Window search to find and open “Edit the system environment variables

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

    3. Click to “New…”.

      _images/add-new-sys-env-vars.png
    4. Enter the “RENESAS_RISCV_LLVM_TOOLCHAIN_PATH” to the Variable name field, and click to “Browse Directory…” to select the bin folder of the toolchain. Then click “OK”.

      _images/add-llvm-toolchain-for-riscv.png

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 latest RISC-V MCU Smart Configurator (RISC-V MCU SC):

Download and install the latest version of RISC-V MCU Smart Configurator:

Installing Support Files for RISC-V MCU Development:

Install the RISC-V MCU support files from the [Renesas Support Files Manager] by following the instructions in chapter “Managing Support Files”.

Installing “LLVM for Renesas RISC-V MCU” toolchain for RISC-V MCU Project Build:

For RISC-V MCU projects, it is recommended to use “LLVM for Renesas RISC-V MCU” toolchain.

  1. Download and install the latest toolchain:

    https://llvm-gcc-renesas.com/riscv/riscv-download-toolchains

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

Guide for Configuring RENESAS_RISCV_LLVM_TOOLCHAIN_PATH environment variable

For adding RENESAS_RISCV_LLVM_TOOLCHAIN_PATH variable to environment variables, open .bashrc file in the home folder of the current user, then add the following line:

export RENESAS_RISCV_LLVM_TOOLCHAIN_PATH="<bin folder of the LLVM for Renesas RISC-V MCU Toolchain>"

For instance:

export RENESAS_RISCV_LLVM_TOOLCHAIN_PATH="/home/renesas/toolchains/llvm_19.1.7.202501_riscv-elf/bin"

9.3. Creating a Project

Smart Configurator can be accessed from the VS Code command palette to create a project for the RISC-V MCU device family.

  1. Open [Command Palette] and select [Renesas: Create RISC-V MCU Project with Smart Configurator] from the commands.

    _images/riscv-sc-create-project.png
  2. VSCode will show installed [RISC-V MCU Smart Configurator] list, select a [Smart Configurator] from the list.

    _images/riscv-sc-select-sc.png

    Note

    If an RISC-V MCU Smart Configurator is not detected automatically, the message “No RISC-V MCU Smart Configurator installation found!” will be displayed in VSCode:

    _images/riscv-no-sc-found.png

    Please click “Browse RISC-V MCU SC”, then select the location of the RISC-V MCU Smart Configurator binary (“SmartConfigurator.exe” for Windows). When a select file dialog window appears, the extension will automatically store the location of the RISC-V MCU Smart Configurator for the next use.

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

    _images/riscv-sc-select-workspace.png
  4. Enter [File name], configure your board and device type, select [LLVM for RISC-V Toolchain], and then click [Next].

    _images/riscvsc_riscv_create_project1.png
  5. Choose a [project template] then click [Finish] to complete the project creation steps.

    _images/riscvsc_riscv_create_project2.png
  6. Click [Generate Code] and close [RISC-V MCU Smart Configurator] after generation of the project files completes.

    _images/riscvsc_riscv_create_project3.png

9.4. Building the Project

For building a project, which has been created with RISC-V MCU Smart Configurator, please follow the steps below:

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

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

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

    _images/run_cmake_build.png

TIP: For more information about RISC-V MCU Smart Configurator, click here to visit the RISC-V MCU Smart Configurator page.

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