Renesas
RZ/V AI

2.10

The best solution for
starting your AI applications.

Provided by Renesas Electronics Corporation


To keep you updated,
Watch our GitHub repository
Watch



This project is maintained by renesas-rz

Hosted on GitHub Pages — Theme by orderedlist

Getting Started



This page explains how to start-up the AI SDK on the RZ/V2L Evaluation Board Kit.

Learn more about the RZ/V series.

Supported version: RZ/V2L AI SDK v2.10
Tutorial video Tutorial video is available here. Latest tutorial video is based on RZ/V2L AI SDK version 2.10.
GUI environment AI SDK has a CUI environment and a GUI environment.
For the GUI environment, see AI SDK page.

Step 1: Obtain an evaluation board

The RZ/V2L Evaluation Board Kit (EVK) is the ideal board kit for RZ/V2L evaluation.

Since MIPI camera module is included, you can start evaluating RZ/V2L immediately by building an environment.

Get RZ/V2L EVK
board
Following items are included in the RZ/V2L Evaluation Board Kit.

Equipment Details
RZ/V2L Evaluation Board Evaluation board itself.
MIPI Camera Module Google Coral Camera.
Note that the CMOS sensor (OV5645) in the camera is no longer available, and should not be used for mass production.
Any software support provided is for evaluation purposes only.
MicroUSB to Serial Cable For serial communication between PC and the board.


Step 2: Obtain necessary environment


1. Necessary Equipments

In addition to the RZ/V2L Evaluation Board Kit, please prepare the following equipments.
Note Serial to MicroUSB Cable and MIPI Camera Module (Google Coral camera) is included in RZ/V2L Evaluation Board Kit.
Equipment Details
HDMI Monitor Used to display the graphics.
Micro HDMI Cable Used to connect the HDMI Monitor and the board.
AC adapter Power supply to the board.
USB Cable Type-C Connect AC adapter and the board.
microSD card Must have over 4GB capacity of blank space.
Operating Environment: Transcend USH-I microSD 300S 16GB
Linux PC Used for Setup microSD card and RZ/V2L AI SDK Setup.
Operating Environment: Ubuntu 20.04
SD card reader Used for setting up microSD card.
Windows PC Optional. Used as the serial communication console for eMMC Bootloader.
Operating Environment : Windows 10
USB Hub Used to connect USB Keyboard and USB Mouse.
USB Keyboard Used to type strings on the terminal of board.
USB Mouse Used to operate the mouse on the screen of board.


2. Necessary Software

Please install following software on Ubuntu PC.


Step 3: Obtain RZ/V2L AI SDK

AI SDK provides following packages.

Name Package Details
RZ/V2L AI SDK RTK0EF0160F*SJ.zip Package used for AI development.
RZ/V2L AI SDK Source Code RTK0EF0160F*SJ_linux-src.zip Package used for Linux development.
Please refer to How to Build AI SDK for more details on this package.

For this Getting Started, please download "RZ/V2L AI SDK" from the link below.

Download Link

Once downloaded, please check the Release Note included in the package.

Step 4: Extract RZ/V2L AI SDK package

This step explains how to extract the RZ/V2L AI SDK zip file.

  1. On your Linux PC, make the working directory.
    mkdir -p ai_sdk_work
  2. Register the working directory path to an environment variable.
    export WORK=<path to the working directory>/ai_sdk_work
  3. Move to the working directory.
    cd ${WORK}
  4. Extract RZ/V2L AI SDK zip file under the working directory.
    unzip <Path to the file>/RTK0EF0160F*.zip -d ${WORK}
  5. Check the working directory to confirm the package contents.
    ls ${WORK}/
    • If the above command prints followings, the package is extracted correctly.
      ai_sdk_setup  board_setup  documents  references r11an0752ej*.pdf


Step 5: Setup RZ/V2L AI SDK

This step explains how to setup the RZ/V2L AI SDK environment.

Note Make sure that you have installed Docker on your Linux PC.
  1. On your Linux PC, move to the working directory.
    cd ${WORK}/ai_sdk_setup
  2. Build docker image.
    docker build -t rzv2l_ai_sdk_image --build-arg SDK="/opt/poky/3.1.21" --build-arg PRODUCT="V2L" .
  3. Create new directory to be mounted on Docker container.
    mkdir ${WORK}/ai_sdk_setup/data
  4. Create docker container.
    Here, rzv2l_ai_sdk_container is a name of docker container, which can be changed by user.
    docker run -it --name rzv2l_ai_sdk_container -v $(pwd)/data:/drp-ai_tvm/data rzv2l_ai_sdk_image
    The local $(pwd)/data is mounted to /drp-ai_tvm/data on the Docker container by the above command option.
    For example, you can use this directory to copy files created on the Docker container to your local environment.

    docker

  5. In docker container, run the following command to copy libtvm_runtime.so, which is the necessary file for the board, to host machine.
    cp /drp-ai_tvm/obj/build_runtime/V2L/libtvm_runtime.so /drp-ai_tvm/data
  6. To exit docker, run following commands.
    exit
  7. To start the docker container rzv2l_ai_sdk_container again, run the following command.
    docker start -i rzv2l_ai_sdk_container


You have finished the RZ/V2L AI SDK environment setup.
You are ready to build the AI applications!

Step 6: Build RZ/V2L AI Application

This step explains how to build AI application.

AI Applications are provided in the GitHub repository.
To access the application, please see AI Applications.

Note The link in AI Applications page guides you to the latest GitHub repository.
Please be aware that latest AI Application requires latest AI SDK.


Application directory has the following structure.

Directory Details
exe Execution environment required when running application on the board.
src Application Source Code.
Other directory Optional: Extra files that may be required other than above.
Makefile Optional: Configuration to build the application.
It may be included in the src directory.
README.md Optional: Documentation of the application.


Note Following procedures are for users who would like to build the application from the source code.
If you would like to run the application as quickly as possible, you can skip this step and proceed to the next step (Step 7: Deploy RZ/V2L AI Application) since pre-build application binary is provided.

Building instructions.

In AI Applications, there are two types of applications.



Step 7: Deploy RZ/V2L AI Application

This section explains how to deploy the AI Application to the RZ/V2L Evaluation Board Kit.
To boot the board, bootloader and other Linux necessary files are required.
There are two types of bootloader available on RZ/V2L AI SDK.

Other necessary files, i.e. Linux kernel and root filesystem, are stored on microSD card.
You can use Linux PC to format the microSD card and expand the kernel and the root filesystem using SD card reader.
docker

Preparation

Click the button This step contains both eSD and eMMC Bootloader explanation.
Please click the button below to update the explanation according to your bootloader interface.
eSD Bootloader eMMC Bootloader
For eSD eSD explanation will be shown in this style if you click "eSD Bootloader" button above.
For eMMC eMMC explanation will be shown in this style if you click "eMMC Bootloader" button above.

1. Setup RZ/V2L Evaluation Board Kit

For eSD microSD card contains bootloaders, the Linux kernel and root filesystem to boot-up the board.
You can use Linux PC to format the microSD card and expand the kernel and the root filesystem using SD card reader.
Note This step is required only when starting the AI SDK or when using the new version of AI SDK.
If you have already setup the microSD card with the latest bootloader, Linux kernel, Linux device tree file and root filesystem, skip this step and proceed to the next procedure (2. Deploy Application to the Board).
For eMMC microSD card contains the Linux kernel and root filesystem to boot-up the board.
You can use Linux PC to format the microSD card and expand the kernel and the root filesystem using SD card reader.
Bootloaders must be written in eMMC on the board. You can use Windows PC to write the bootloaders on eMMC.
Note This step is required only when starting the AI SDK or when using the new version of AI SDK.
If you have already setup the microSD card and the bootloader written in eMMC on the board, skip this step and proceed to the next procedure (2. Deploy Application to the Board).
  1. Format SD card
  2. Create the following partitions on microSD card according to Appendix: A2. Format SD card.
    For eSD
    Type/Number Size Type of Filesystem Contents
    Primary #1 500MB (minimum 128MB) Ext4 Linux kernel
    Device tree
    Primary #2 All remaining Ext4 Root filesystem
    For eMMC
    Type/Number Size Type of Filesystem Contents
    Primary #1 500MB (minimum 128MB) FAT32 Linux kernel
    Device tree
    Primary #2 All remaining Ext4 Root filesystem

  3. Write the Linux files to SD card
  4. For eSD At first, run the below command to decompress ${WORK}/board_setup/eSD.zip.
    cd ${WORK}/board_setup
    unzip eSD.zip
    Following three files are necessary, which must be placed on each partitions on microSD card.
    They are in the ${WORK}/board_setup/eSD directory.

    File Description microSD card partition
    Image-smarc-rzv2l.bin Linux kernel image
    (The boot program)
    Partition 1
    Image-r9a07g054l2-smarc.dtb Linux device tree file
    (The configuration file for booting)
    Partition 1
    core-image-weston-smarc-rzv2l.tar.bz2 Linux Root filesystem Partition 2
    Follow the instruction below to prepare the microSD card.
    Warning Here, we use "/dev/sdb" as microSD card device name.
    1. Check if the two partitions are created successfully by running df command.
      df -h
      Filesystem 	Size		Used	Avail	Use %	Mounted on	
      …		…		…	…	…	…
      /dev/sdb1		…		…	…	…	…	
      /dev/sdb2		…		…	…	…	…	
      Warning Device name of microSD card, /dev/sdb may differ depending on your environment.

    2. Run the following commands to setup the partition 1.
      sudo mkdir -p /mnt/sd
      sudo mount /dev/sdb1 /mnt/sd
      sudo cp $WORK/board_setup/eSD/Image-smarc-rzv2l.bin /mnt/sd
      sudo cp $WORK/board_setup/eSD/Image-r9a07g054l2-smarc.dtb /mnt/sd
      sync
      sudo umount /mnt/sd
      Warning Change /dev/sdb to your microSD card device name.
    3. Run the following commands to setup the partition 2, which is the root filesystem of the board.
      sudo mount /dev/sdb2 /mnt/sd
      sudo tar xfj $WORK/board_setup/eSD/core-image-weston-smarc-rzv2l.tar.bz2 -C /mnt/sd
      sudo cp $WORK/ai_sdk_setup/data/libtvm_runtime.so /mnt/sd/usr/lib64
      sync
      sudo umount /mnt/sd
      Warning Change /dev/sdb to your microSD card device name.
    For eMMC Following three files are necessary, which must be placed on each partitions on microSD card.
    They are in the ${WORK}/board_setup/eMMC directory.

    File Description microSD card partition
    Image-smarc-rzv2l.bin Linux kernel image
    (The boot program)
    Partition 1
    Image-r9a07g054l2-smarc.dtb Linux device tree file
    (The configuration file for booting)
    Partition 1
    core-image-weston-smarc-rzv2l.tar.bz2 Linux Root filesystem Partition 2
    1. Run the below command to decompress ${WORK}/board_setup/eMMC.zip.
      cd ${WORK}/board_setup
      unzip eMMC.zip
    2. Insert the microSD card to Linux PC.

    3. Check if the two partitions are created successfully by running df command.
      df -h
      Filesystem 	Size		Used	Avail	Use %	Mounted on	
      …		…		…	…	…	…
      /dev/sdb1		…		…	…	…	…	
      /dev/sdb2		…		…	…	…	…	
      Warning Device name of microSD card, /dev/sdb, may differ depending on your environment.

    4. Run the following commands to setup the partition 1.
      sudo mkdir -p /mnt/sd
      sudo mount /dev/sdb1 /mnt/sd
      sudo cp $WORK/board_setup/eMMC/Image-smarc-rzv2l.bin /mnt/sd
      sudo cp $WORK/board_setup/eMMC/Image-r9a07g054l2-smarc.dtb /mnt/sd
      sync
      sudo umount /mnt/sd
      Warning Change /dev/sdb, to your microSD card device name.

    5. Run the following commands to setup the partition 2, which is the root filesystem of the board.
      sudo mount /dev/sdb2 /mnt/sd
      sudo tar xfj $WORK/board_setup/eMMC/core-image-weston-smarc-rzv2l.tar.bz2 -C /mnt/sd
      sudo cp $WORK/ai_sdk_setup/data/libtvm_runtime.so /mnt/sd/usr/lib64
      sync
      sudo umount /mnt/sd
      Warning Change /dev/sdb, to your microSD card device name.

      Note If you would like to eject the microSD card, please run following command and remove the microSD card from Linux PC.
      sudo eject /dev/sdb
      Warning Change /dev/sdb to your microSD card device name.
  5. Write the bootloaders to SD card Write the bootloaders to eMMC
  6. For eSD Before booting up the board, you must write the latest bootloaders to microSD card.
    This procedures needs to be done only once as long as you use the same version of AI SDK.

    There are three files in ${WORK}/board_setup/eSD/bootloader to boot up the board.
    • bl2_bp_esd-smarc-rzv2l_pmic.bin
    • bl2_bp-smarc-rzv2l_pmic.srec
    • fip-smarc-rzv2l_pmic.srec

    Run the following commands to write these files to the microSD card to boot for eSD.
    cd ${WORK}/board_setup/eSD/bootloader
    sudo dd if=bl2_bp_esd-smarc-rzv2l_pmic.bin of=/dev/sdb seek=1 count=1
    sudo dd if=bl2-smarc-rzv2l_pmic.bin of=/dev/sdb seek=8
    sudo dd if=fip-smarc-rzv2l_pmic.bin of=/dev/sdb seek=128
    sync
    Warning Change /dev/sdb, to your microSD card device name.

    Note If you would like to eject the microSD card, please run following command and remove the microSD card from Linux PC.
    sudo eject /dev/sdb
    Warning Change /dev/sdb to your microSD card device name.
    For eMMC Please write the bootloaders to eMMC on the board according to Appendix: A1.Setup for eMMC Bootloader.


2. Deploy Application to the Board

This section explains how to copy the application binary created in Step 6 to the board.
Users are expected to have finished the instructions in Setup RZ/V2L Evaluation Board Kit in Step 7-1.

  1. Insert the microSD card to Linux PC.

  2. Run the following command to mount the partition 2, which contains the root filesystem.
    sudo mount /dev/sdb2 /mnt/sd
    Warning Change /dev/sdb to your microSD card device name.
  3. Create the application directory on root filesystem.
    sudo mkdir /mnt/sd/home/root/tvm
    Note Directory name tvm can be determined by user.
  4. Copy the necessary files in execution environment.
    Select the appropriate option below based on the application type explained in Building instructions in Step 6.

    Option 1. <Application 1>

    Check the README.md document provided in application directory and follow the instruction in the chapter called "Application: Deploy Stage" (or similar) to deploy the application.

    Example:
    In Object Detection application, follow the instruction in here to find files to be copied.

    Use the following command to copy the files to root filesystem.

    sudo cp $WORK/ai_sdk_setup/data/<Path to target file>/<filename> /mnt/sd/home/root/tvm 

    Option 2. <Application 2>

    Run the following command to copy the whole repository to the root filesystem.

    sudo cp $WORK/ai_sdk_setup/data/<Path to repository>/RZV2L_AiLibrary /mnt/sd/home/root/tvm -r
  5. Run the following command to sync the data with memory.
    sync 
  6. Run the following command to unmount the partition 2.
    sudo umount /mnt/sd
  7. Eject the microSD card by running the following command and remove the microSD card from Linux PC.
    sudo eject /dev/sdb
    Warning Change /dev/sdb to your microSD card device name.


3. Boot RZ/V2L Evaluation Board Kit

This section explains how to boot the RZ/V2L Evaluation Board Kit.

eSD Bootloader eMMC Bootloader


Follow the instruction below to boot the board.

For eSD
  1. Insert the microSD card to the Board.
    Note Use the microSD card slot CN3 as shown in the figure.

  2. Change SW1 and SW11 setting as shown in the figure.

  3. Connect the USB mouse and USB keyboard via USB hub.

  4. Connect the Google Coral camera to the Board.

  5. Connect the HDMI monitor to the Board.

  6. Connect the power cable to the Board.

  7. Press power button for 1 second to turn on the board.
boot
  1. After the boot-up, following screen will be displayed on HDMI monitor.
wayland
  1. Click the icon at the top-left corner to open the terminal.
wayland
For eMMC
Note After bootloader is written and U-boot setting is changed, terminal emulator is no longer needed.
Users can detach the serial port connection.
  1. Insert the microSD card to the Board.
    Note Use the microSD card slot CN10 as shown in the figure.

  2. Change SW1 and SW11 setting as shown in the figure.

  3. Connect the USB mouse and USB keyboard via USB hub.

  4. Connect the Google Coral camera to the Board.

  5. Connect the HDMI monitor to the Board.

  6. Connect the power cable to the Board.

  7. Press power button for 1 second to turn on the board.
boot
  1. After the boot-up, following screen will be displayed on HDMI monitor.
wayland
  1. Click the icon at the top-left corner to open the terminal.
wayland



Step 8: Run RZ/V2L AI Application

Document of applications on GitHub has the instructions to run the application.

Example:
For Object Detection application, follow the instruction here to run the application.
If you have successfully run the application, you will see following window on HDMI screen.

object_detection


Note To shutdown the board safely, please refer to A3. Shutdown RZ/V2L Evaluation Board Kit



This is the end of Getting Started.

You have experienced the AI Application development procedures.
Next step is to change the application to create your own AI Application.
You can use the applications listed in AI Applications to expand your ideas!

If you would like to customize Yocto Linux or develop your own board, please change and build the AI SDK Source Code based on your environment.
For how to build the AI SDK Source Code, please refer to How to Build AI SDK.