14. Quick Start for Renesas RISC-V MCU

14.1. Supported Environments

Operating System

Windows: Windows 10 / Windows 11

Linux: Ubuntu 22.04

VS Code version

1.102.0 (minimum)

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

14.2. Installation

Please choose your operating system for operating system dependent installation steps.

For the Renesas RISC-V MCU Family, Renesas Platform provides a straightforward installation wizard to install the CMake, Ninja, Python and the Support Files for RISC-V MCU Family. To set up your environment:

  1. Open VS Code.

  2. Navigate to the “Renesas” tab in VS Code. Then, click “Renesas Quick Install” in the “Environment” view.

    _images/renesas-quick-install.png
  3. Click the “Install” button for the “Renesas RISC-V MCU” device family. The Renesas Platform will now check the dependencies required by the Renesas RISC-V MCU Device Family. The Renesas Platform extension will check the local environment and CMake, Ninja, Python and the Support Files for RISC-V MCU Family, then create an installation plan for them if necessary.

    _images/riscv-install.png
  4. When your selection is ready, click the “Start Installations” button. The download and installation process will start automatically.

    _images/riscv-start-installation.png

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

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

After installing the Renesas RISC-V MCU Smart Configurator, you should register the Renesas Smart Configurator installation in VS Code. In order to register the Renesas RISC-V MCU Smart Configurator, perform the following steps:

  1. Click to “Manage Smart Configurators” and check the Renesas RISC-V MCU Smart Configurators. Use the “Register SC” button to register the Smart Configurator manually by selecting the path of the Smart Configurator.

    _images/riscv-sc.png
  2. Once it is registered, the Smart Configurator will be visible in the Renesas RISC-V MCU Smart Configurators list.

    _images/riscv-sc-registered.png

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

    Note

    LLVM for Renesas RISC-V MCU toolchain should be installed to a path that does not contain spaces or special characters.

  2. Add “LLVM for Renesas RISC-V MCU” toolchain to Renesas Platform

    Registering LLVM for Renesas RISC-V MCU toolchain in Renesas Platform
    1. Open VS Code

    2. Navigate to the “Renesas” tab in VS Code and click “Manage Build Tools”.

    3. Click the “Register Toolchain” button in the Build Toolchains table header.

    4. In the folder selection dialog, navigate to the root folder of the LLVM for Renesas RISC-V MCU toolchain (not the bin folder).

    5. Select the folder and complete the toolchain registration.

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

For the Renesas RISC-V MCU Family, Renesas Platform provides a straightforward installation wizard to install the CMake, Ninja, Python and the Support Files for RISC-V MCU Family. To set up your environment:

  1. Open VS Code.

  2. Navigate to the “Renesas” tab in VS Code. Then, click “Renesas Quick Install” in the “Environment” view.

    _images/renesas-quick-install.png
  3. Click the “Install” button for the “Renesas RISC-V MCU” device family. The Renesas Platform will now check the dependencies required by the Renesas RISC-V MCU Device Family. The Renesas Platform extension will check the local environment and CMake, Ninja, Python and the Support Files for RISC-V MCU Family, then create an installation plan for them if necessary.

    _images/riscv-install.png
  4. When your selection is ready, click the “Start Installations” button. The download and installation process will start automatically.

    _images/riscv-start-installation.png

Most of the installations will be performed automatically, some installations may require manual interaction.

  • During the “Python 3.10” installation, the terminal wizard will appear for manual interaction. The terminal will show the execution plan and ask for confirmation before continuing. During the installation, it requires administrative rights to execute the installation, thus a password could be needed during the installation. Please make sure that the current user has “sudo” permissions and enter the password.

    _images/common-installation-terminal-attention.png

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

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

After installing the Renesas RISC-V MCU Smart Configurator, you should register the Renesas Smart Configurator installation in VS Code. In order to register the Renesas RISC-V MCU Smart Configurator, perform the following steps:

  1. Click to “Manage Smart Configurators” and check the Renesas RISC-V MCU Smart Configurators. Use the “Register SC” button to register the Smart Configurator manually by selecting the path of the Smart Configurator.

    _images/riscv-sc.png
  2. Once it is registered, the Smart Configurator will be visible in the Renesas RISC-V MCU Smart Configurators list.

    _images/riscv-sc-registered.png

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"

14.3. Creating a Project

For RISC-V MCU family projects, Smart Configurator can be accessed via the “Create Project” view in the “Renesas” tab. Please use the following instructions to create and build a project for RISC-V MCU device family.

  1. Navigate to “Renesas” and click [Create Renesas RISC-V MCU project] from the commands.

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

    _images/pick-sc1.png
  3. Select a [Folder] to create the project.

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

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

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

    _images/sc-step31.png

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

14.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-start5.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-start6.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-start7.png

14.6. GDB Server launch parameters for RISC-V devices

Reference for common parameters: All common server parameters, including default settings and options applicable to Renesas device families, are documented in the GDB Server Parameters section. The specific parameters of the RISC-V devices are described below.

14.6.1. Connection Settings

14.6.1.2. Clock

Option

Details

-uClockSrc=

Description: Select the Main Clock Source.
Default Values: 0
Emulator: E2, E2LITE
Available Values: 0: Internal, 1: External
Example: "serverParameters": { "-uClockSrc=": 0 }

-uInputClock=

Description: Specify External frequency in MHz.
Default Values: None
Emulator: E2, E2LITE
Available Values: Between 0.001 to 99.999
Example: "serverParameters": { "-uInputClock=": 16.00 }

-uAllowClockSourceInternal=

Description: Specify whether or not to allow manipulation of the main clock source by debugger when internal flash memory is rewritten.
Default Values: 1
Emulator: E2, E2LITE
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uAllowClockSourceInternal=": 1 }

14.6.1.3. Connection with Target Board

Option

Details

-sn=

Description: Specify the emulator serial number to be connected.
Default Values: Auto (Emulator will be selected automatically.)
Emulator: E2, E2LITE
Available Values: Emulator information with format: <emulator type>:<serial number>
Example: "serverParameters": { "-sn=": "e2:_9es002310c" }

-uInteface=

Description: Specifies the connection type to be used by the emulator when communicating with the CPU on target system.
Default Values: cJTAG
Emulator: E2, E2LITE
Available Values: 0: Fixed as cJTAG
Example: "serverParameters": { "-uInteface=": "cJTAG" }

-uIfSpeed=

Description: Specifies the speed.
Default Values: auto
Emulator: E2, E2LITE
Available Values: Auto, Enter a value (integer value).
Example: "serverParameters": { "-uIfSpeed=": "auto" } or "serverParameters": { "-uIfSpeed=": 1000 }

14.6.1.4. Interface

Option

Details

-uInteface=

Description: Select the target interface type.
Default Value: cJTAG
Emulator: SEGGERJLINKRISCV
Available Values: cJTAG, JTAG
Example: "serverParameters": { "-uInteface=": "cJTAG" }

-uIfSpeed=

Description: Set the JTAG interface speed.
Default Value: Auto
Emulator: SEGGERJLINKRISCV
Available Values: Auto, Adaptive, Enter a value (integer value)
Example: "serverParameters": { "-uIfSpeed=": "auto" } or "serverParameters": { "-uIfSpeed=": "adaptive" } or "serverParameters": { "-uIfSpeed=": 4000 }

14.6.1.5. Power

Option

Details

-w

Description: Specify whether to power the target from the emulator (MAX 200mA) and the power source.
Default Value: 0
Emulator: E2, E2LITE
Available Values: 0, 1, 2
Example: "serverParameters": { "-w": 1 }
Note: Value 2 is only supported for the E2 emulator.

-z

Description: Specify the supply voltage (V) provided to the target board. The value is adjusted to one decimal place (e.g., 3.56 → 3.6).
Default Value: 33 (3.3 V)
Emulator: E2, E2LITE
Available Values: 16–55 (corresponding to 1.6 V–5.5 V)
Example:
"serverParameters": { "-z": 16 } for 1.6 V,
"serverParameters": { "-z": 33 } for 3.3 V,
"serverParameters": { "-z": 50 } for 5.0 V
Note: E2LITE emulator only supports 3.3 V. Only the E2 emulator allows specifying an arbitrary voltage from 1.6 V to 5.5 V.

14.6.1.6. Connection

Option

Details

-uInitRegisters=

Description: Specify whether registers should be initialized on connection.
Default Value: 0
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uInitRegisters=": 0 }

-uResetBeginConnection=

Description: Specify whether the CPU should be reset at the start of connection.
Default Value: 1
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uResetBeginConnection=": 0 }

-uNoReset=

Description: Specify whether the CPU should be reset at the end of connection.
Default Value: 0
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uNoReset=": 1 }

-uResetBefDownload=

Description: Specify whether an additional reset should be applied before the module is downloaded.
Default Value: 0
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uResetBefDownload=": 1 }

-uResetPreRun=

Description: Specify whether an additional reset should be applied after the module is downloaded.
Default Value: 1
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uResetPreRun=": 1 }

-uIdCodeBytes=

Description: Specify the ID code to unlock the device (if one has been set previously to protect connection).
Default Values: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
Emulator: E2, E2LITE, SEGGERJLINKRISCV
Available Values: 32 hex digits
Example: "serverParameters": { "-uIdCodeBytes=": "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" }

-uLowPower=

Description: Specify if the program uses low power consumption mode or not.
Default Values: 1
Emulator: E2, E2LITE
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uLowPower=": 1 }

14.6.2. Debug Tool Settings

14.6.2.1. General Debug

Option

Details

-uresetOnReload=

Description: Select whether to reset the program after downloaded.
Default Values: 1
Emulator: E2, E2LITE, SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uresetOnReload=": 1 }

14.6.2.2. Break

Option

Details

-uFlashBp=

Description: Specify whether to use software breakpoints to flash memory or not.
Default Values: 0
Emulator: E2, E2LITE, SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uFlashBp=": 0 }

-uSimulation=

Description: Specify if Instruction Set simulation should be used when setting breakpoints in Flash.
Default Values: 0
Emulator: SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uSimulation=": 0 }

14.6.2.3. Flash

Option

Details

-uWorkRamAddress=

Description: Specify the first address of the working RAM area for debugger firmware.
Default Values: None
Emulator: E2, E2LITE
Available Values: Internal RAM area
Example: "serverParameters": { "-uWorkRamAddress=": "0x0" }

-ueraseRomOnDownload=

Description: Specify whether or not to erase the flash ROM (program ROM) before a download.
Default Values: 0
Emulator: E2, E2LITE
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-ueraseRomOnDownload=": 0 }

-ueraseDataRomOnDownload=

Description: Specify whether or not to erase the data flash ROM before a download.
Default Values: 0
Emulator: E2, E2LITE
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-ueraseDataRomOnDownload=": 0 }

-ucfiFlashWorkStart=

Description: Specify the start address of the Working RAM area.
Default Values: None
Emulator: SEGGERJLINKRISCV
Available Values: Internal RAM area
Example: "serverParameters": { "-ucfiFlashWorkStart=": "0x0" }

-ucfiFlashWorkEnd=

Description: Specify the end address of the Working RAM area.
Default Values: None
Emulator: SEGGERJLINKRISCV
Available Values: Internal RAM area
Example: "serverParameters": { "-ucfiFlashWorkEnd=": "0x0" }

14.6.2.4. System

Option

Details

-uProgReWriteIRom=

Description: Specify whether or not the program being debugged rewrites the internal program ROM.
Default Values: 0
Emulator: E2, E2LITE, SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uProgReWriteIRom=": 0 }

-uProgReWriteDFlash=

Description: Specify whether or not to debug a program that involves rewriting the internal data flash.
Default Values: 0
Emulator: E2, E2LITE
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uProgReWriteDFlash=": 0 }

-uAllowCachingFlash=

Description: If this setting is enabled the debugger will cache the contents of flash to increase read speed
Default Values: 0
Emulator: SEGGERJLINKRISCV
Available Values: 0: Yes, 1: No
Example: "serverParameters": { "-uAllowCachingFlash=": 0 }

14.6.2.5. Time Measurement

Option

Details

-uTimeMeasurementEnable=

Description: Specify whether or not display the measurement result of run-break on the status bar. Emulator will measure the time with 100us unit.
Default Values: 1
Emulator: E2, E2LITE, SEGGERJLINKRISCV
Available Values: 0: No, 1: Yes
Example: "serverParameters": { "-uTimeMeasurementEnable=": 1 }