RZ/V2L SMARC Board by Renesas

From Renesas.info
Revision as of 17:16, 20 March 2023 by Seebe (talk | contribs) (move demos all in one section)
image 2022-10-31 201234042.png

General Information

Sharing of RZ/G2L Board Documentation

RZ/V2L Boot Loaders Warning

⚠️ Warning.

The pre-loaded bootloaders (u-boot and ARM Trusted Firmware) on the RZ/V2L Evaluation Kit (SMARC board) are not up to date with the current BSP. It is strongly recommended that the bootloaders generated when building the BSP described in the Startup Guide document that is distributed with the BSP Package.

Known issues with pre-loaded loaders.

  • DRP Demos will prematurely exit.
  • ISP Demos will prematurely exit.
  • RZV2L Multi-OS CM33 Debug fails connection

Available Demos

Prebuilt Demo Images

rzv2l-drp-ai-usb-camera-http-demo.png

DRP-AI Demos

The RZV2L DRP-AI Demos can be found here.




Getting Started

1. Software BSP Components

Up to 5 packages are used to build the BSP.

Please download from the Official RZ/V2L Website. Please look in the "Software Downloads" section.

Links to all the downloads can be found on the πŸ“¦ RZ/V2 Linux BSP on this site. Please refer to the sections that support RZ/V2L.

Copy all ZIP file to a Linux PC.

The evaluation versions contain a time limitation that stops the software after a few hours.

  • RZ/V Verified Linux Package: RTK0EF0045Z0024AZJ-<version>.zip.
  • RZ MPU Graphics Library Evaluation Version: RTK0EF0045Z13001ZJ-<version>_EN.zip
  • RZ MPU Video Codec Library Evaluation Version: RTK0EF0045Z15001ZJ-<version>_EN.zip
  • RZ/V2L DRP-AI Support Package: r11an0549ej<version>-rzv2l-drpai-sp.zip
  • RZ/V2L ISP Support Package ("Simple ISP" by DRP-AI): r11an0561ej<version>-rzv2l-isp-sp.zip.

(*): Refer to DRP-AI Demos section for changes to the DRP-AI package that could effect you application.


2. Build Environment

  • To build the BSP, you will need a Linux PC running Ubuntu 20.04. Only this Host OS version was tested.
  • You can use a Linux PC (recommended) or a Virtual Machine. If using a Virtual Machine, 200GB of hard drive space is recommended.


3. Build the BSP

  • ⚠️ The complete build environment created by 'Linux BSP package' + 'DRP-AI Support package' + 'ISP Support package' must be combined into the same directory.
  • Use the directory name "rzv_vlp_v3.0.0"
  • Detailed instructions for setup and building are located in the Release Note documents included in each ZIP package for "Linux BSP" and "DRP-AI Support".
  • ⚠️ You must first follow the Linux BSP Release Note instructions Section 3.1, but stop πŸ›‘ before the 'bitbake' command.
    • Then, follow DRP-AI Support 'Release Note' (r11an0549ej<version>-rzv2l-drpai-sp.pdf) Sections 3.1 and 3.2, but stop πŸ›‘ before the 'bitbake' command.
    • Finally Follow the ISP Support 'Release Note' ( r11an0561ej<version>-rzv2l-isp-sp.pdf) Section 2.0.
  • A summary of the instructions located in the Release Notes are below. Simply Copy/Paste the commands.
Simple build instructions for BSP v3.0,2   
These instructions are a summary of what is explained in the package Release Notes.
export WORK_DIR=$PWD/rzv2l_bsp_v3.00 export SRC_DIR=../ mkdir $WORK_DIR

### Extract the BSP Linux package
cd $WORK_DIR 
unzip $SRC_DIR/RTK0EF0045Z0024AZJ-v3.0.2.zip
tar -xf ./RTK0EF0045Z0024AZJ-v3.0.2/rzv_bsp_v3.0.2.tar.gz

### Copy/Move the 'RZV2L Graphics Library v1.4' Zip file (RTK0EF0045Z13001ZJ-v1.4_EN.zip) under the BSP directory.
cd $WORK_DIR
unzip $SRC_DIR/RTK0EF0045Z13001ZJ-v1.4_EN.zip
tar zxvf RTK0EF0045Z13001ZJ-v1.4_EN/meta-rz-features.tar.gz

### Copy/Move the 'RZV2L Video Codec Library v1.0.1' Zip file (RTK0EF0045Z15001ZJ-v1.0.1_EN_forV2L_EN.zip) under the BSP directory.
cd $WORK_DIR
unzip $SRC_DIR/RTK0EF0045Z15001ZJ-v1.0.1_EN.zip
tar zxvf RTK0EF0045Z15001ZJ-v1.0.1_EN/meta-rz-features.tar.gz

### Copy/Move the DRP Support archive file ( r11an0549ej0730-rzv2l-drpai-sp.zip ) 
### Extract the 'DRP-AI Driver Support' package file (meta-rz-features.tar.gz) under the rzv2l_drpai-driver directory.
unzip $SRC_DIR/r11an0549ej0730-rzv2l-drpai-sp.zip -d drp
tar -xvf drp/rzv2l_drpai-driver/meta-rz-features.tar.gz

### Copy/Move the ISP Support archive file ( r11an0561ej0121-rzv2l-isp-sp.zip ) 
### Extract the ISP Support Package (meta-rz-features.tar.gz ).
cd $WORK_DIR
unzip $SRC_DIR/r11an0561ej0121-rzv2l-isp-sp.zip -d isp
tar -zxvf isp/r11an0561ej0121-rzv2l-isp-sp/meta-rz-features.tar.gz
 
### Set up the Yocto Environment and copy a default configuration
cd $WORK_DIR
source poky/oe-init-build-env
cp ../meta-renesas/docs/template/conf/smarc-rzv2l/*.conf ./conf/
### Build
bitbake core-image-weston
bitbake core-image-weston -c populate_sdk

Verification

After the above script is run there will be a new folder call meta-rz-features. This will include, among others sub-folders for the MALI GPU, Video Codec, DRP, and ISP.

 
    β”œβ”€β”€ classesmeta-rz-features
    β”œβ”€β”€ conf
    β”œβ”€β”€ docs
    β”œβ”€β”€ include
    β”œβ”€β”€ Readme.md
    β”œβ”€β”€ recipes-bsp
    β”œβ”€β”€ recipes-codec
    β”œβ”€β”€ recipes-drpai
    β”œβ”€β”€ recipes-example
    β”œβ”€β”€ recipes-graphics
    β”œβ”€β”€ recipes-isp
    └── recipes-kernel

RZV2L Multi-OS Support

To add Multi-OS Support follow the instructions RZV2L Cortex-M33 Multi-OS Package.


4. Prepare an SD Card

  • The evaluation boards can be booted from SD Cards. The SD card must be formatted and loaded using a Linux PC. A helpful script has been created (usb_sd_partition) that you can run on your Linux PC.
  • Insert your micro SD card into a USB-SD-Card reader and then plug into a Linux PC.
  • Use the commands below to download the formatting script and run. Please select your card and choose the default settings.
$ wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/usb_sd_partition/usb_sd_partition.sh
$ chmod +x usb_sd_partition.sh
$ ./usb_sd_partition.sh
  • Use the commands below to copy the files you build with the BSP to the SD card. Start in the base of your Yocto BSP.
# Change to the Yocto output directory that contains the files
$ cd build/tmp/deploy/images/smarc-rzv2l

# Copy the Linux kernel and Device Tree to partition 1
$ sudo cp -v Image /media/$USER/RZ_FAT
$ sudo cp -v r9a07g054l2-smarc.dtb /media/$USER/RZ_FAT

# Copy and expand the Root File System to partition 2
$ sudo tar -xvf core-image-weston-smarc-rzv2l.tar.gz   -C /media/$USER/RZ_ext
    (or if NOT using graphics)
$ sudo tar -xvf core-image-minimal-smarc-rzv2l.tar.gz   -C /media/$USER/RZ_ext

# Make sure all files are finished writing before removing the USB card reader from the PC
$ sync
  • Safely remove your USB card reader by right clicking on the drive icon (either RZ_FAT or RZ_ext) in Ubuntu and selecting "Eject"

5. Power the Board and Connect to the Serial Port

  • Supply power the board using the USB-C connection on the carrier board labeled "Power Input"
  • On the carrier board, press the red button in order to turn on power to the board. The green LED labeled "Carrier PWR On" will be lit when power is on.
  • Now that the board is powered, plug a USB micro cable into the carrier board to the USB connector labeled "SER 3 UART". Use a serial terminal program to interact as you board. With a Linux PC, we recommend using "putty" (connects to /dev/USB0), and with a Windows PC we recommend "TeraTerm" that connects to COMx. The baud rate of the Serial connection is 115200 bps.
  • Press the blue reset button, and then "u-boot" will start. Within 3 seconds, press the space bar on your keyboard in order to stop the auto-boot sequence.


6. Switch settings for the CPU SOM board.

  • The SOM board contains a eMMC Flash device and a Micro SD Card socket. On the SOM board, you can only use one or the other because they are both connected to the same peripheral channel on the RZ/V2L.
  • Set the switches on the SOM board to what you want to use.
  • ⚠️ u-boot environment variables are always stored in eMMC Flash (not SPI flash). This means if you change switch SW1-2 to OFF on the SOM board, you cannot access saved u-boot environments variables and you will always get the message "*** Warning - MMC init failed, using default environment"
  • Note that the SD Card slot on the Carrier board will always work regardless of the setting of SW1-2 because it uses a separate peripheral channel on the RZ/V2L.
  • On the SOM (CPU) board, there is a little switch (SW1) near the SD card socket.
SOM board uses SD Card socket                 SOM board uses eMMC Flash (recommended)
SW1-1 = ON/OFF(JTAG)                          SW1-1 = ON/OFF(JTAG)
SW1-2 = ON                                    SW1-2 = OFF
      +-----+                                       +-----+
      | ON  |                                       | ON  |
      | = = |                                       | =   |
      |     |                                       |   = |
      | 1 2 |                                       | 1 2 |
      +-----+                                       +-----+


7. Boot the Board

Choose option 7-1 or 7-2 or 7-3 below.
Option 7-1 is recommended.


7-1. Boot the Board using SD Card on Carrier Board (Recommended)

  • Insert the SD card into the socket on Carrier Board.
β”Œβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”
β”‚     β”‚ SOM β”‚     β”‚
β”‚     β””β”€β”€β”€β”€β”€β”˜     β”‚
β”‚  Carrier Board  β”‚
β”‚     β”Œβ”€β”         β”‚
β””β”€β”€β”€β”€β”€β”΄β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       ↑
 SD Card Socket
  • Press the blue reset button, and then "u-boot" will start. Within 3 seconds, press the space bar on your keyboard in order to stop the auto-boot sequence.
  • At the u-boot prompt ( => ), enter the following commands to boot the board:
   # Create command macros and save them:
=> setenv sd_boot1 'mmc dev 1 ; fatload mmc 1:1 0x48080000 Image ; fatload mmc 1:1 0x48000000 r9a07g054l2-smarc.dtb'
=> setenv sd_boot2 'setenv bootargs 'root=/dev/mmcblk1p2 rootwait' ; booti 0x48080000 - 0x48000000'
=> setenv bootcmd 'run sd_boot1 sd_boot2'
=> saveenv

   # Reset the board and it will automatically boot

7-2. Boot the Board using eMMC Flash on SOM Board (Advanced)

  • Set switch SW1-2 = OFF
  • The boot loader (u-boot) by default will try to boot from eMMC after 3 seconds.
  • Press the blue reset button and wait.

7-3. Boot the Board using SD Card on SOM Board (eMMC Flash disabled) (Advanced)

  • Set switch SW1-2 = ON
  • Insert the SD card into the socket on SMARC SOM CPU board (not the carrier board).
  • Press the blue reset button, and then "u-boot" will start. Within 3 seconds, press the space bar on your keyboard in order to stop the auto-boot sequence.
  • Note that you will get this message every time "*** Warning - MMC init failed, using default environment" because u-boot environment variables are stored in eMMC Flash (that you disabled)
  • At the u-boot prompt ( => ), enter the following commands to boot the board:
  # Manually enter the following commands to boot
=> mmc dev 0 ; fatload mmc 0:1 0x48080000 Image ; fatload mmc 0:1 0x48000000 /r9a07g054l2-smarc.dtb
=> setenv bootargs 'root=/dev/mmcblk0p2 rootwait' ; booti 0x48080000 - 0x48000000


8. Linux Login

  • The login will be "root" (no password is needed)

RZV2L ISP Demos

Requirements
  • Linux BSP SDK : The SDK must include the DRP-AI and ISP packages. Refer to Linux BSP Release Note instructions (r01an6221ej<version>-rzv2l-linux.pdf) Section 6.
  • RZV2L DRP-AI Sample Application : ( rzv2l_drpai-sample-application_ver5.00.tar.gz )
  • Power : A powered hub or PC may not provide sufficient power. A USB Power Block is suggested.
Build ISP Monitoring Application

Detailed instructions for setup and building are located in the Application Note Revision documents in "Simple ISP Sample Application Note Revision" package.

  • ⚠️ You must first follow the Simple ISP Sample Application Note Revision instructions (r11an0563ej<version>-rzv2l-simple-isp.pdf) Section 2.0 and 2.6
Simple build instructions for ISP Monitioring Application     

These instructions are a summary of what is explained in the package Release Notes.

export ISP_FILE=r11an0561ej0100-rzv2l-isp-sp.zip

# Step 1. Extract the ISP package and ISP sample application files. Enter the ISP Montitoring source directory.
unzip $ISP_FILE -d isp_work
cd isp_work
tar zxvf rzv2l_isp-sample-application_ver1.00.tar.gz
cd app_isp_monitoring/src

# Step 2. Start the SDK
source /opt/poky/3.1.5/environment-setup-aarch64-poky-linux

# Step 3. Build the source with make
make
Build ISP Tiny YoloV2 Application

Detailed instructions for setup and building are located in the Application Note Revision documents in "Simple ISP Sample Application Note Revision" package.

  • ⚠️ You must first follow the Simple ISP Sample Application Note Revision instructions (r11an0563ej<version>-rzv2l-simple-isp.pdf) Section 2.0 and 2.7

This build requires the DRP-AI Tiny Yolo V2 Cam source is needed for this build ( /rzv2l_drpai-sample-application/app_tinyyolov2_cam/src ).

This build requires the DRP-AI Tiny Yolo V2 Cam directory "tinyyolov2_cam" is needed for this build ( /rzv2l_drpai-sample-application/app_tinyyolov2_cam/exe ).

Simple build instructions for ISP Tiny Yolo V2 Application        

These instructions are a summary of what is explained in the package Release Notes.

mkdir drp-ai-supporrt
export DRP_WORKDIR=$PWD/drp-ai-support

mkdir isp-support
export ISP_	WORKDIR=$PWD/isp-support

export APP_WORKDIR=$PWD

# Step 1. Extract the DRP Appicatiion Code to $DRP_WORK
unzip r11an0549ej0500-rzv2l-drpai-sp.zip -d $DRP_WORK
cd $DRP_WORK/rzv2l_drpai-sample-application/
tar -xvf rzv2l_drpai-sample-application_ver5.00.tar.gz -C .
cd $APP_WORKDIR

# Step 2. Extract the ISP Application Code to $ISP_WORK
unzip r11an0561ej0100-rzv2l-isp-sp.zip -d $ISP_WORK
cd $ISP_WORK
tar -xvf rzv2l_isp-sample-application_ver1.00.tar.gz -C .
cd $APP_WORKDIR


# Step 3. Copy TinyYoloV2 source code to ISP TinyYoloV2 application source directory
cp -r drp-ai-support/rzv2l_drpai-sample-application/app_tinyyolov2_cam/src/ ./isp-support/app_tinyyolov2_cam/src/

# Step 4. Apply Patch
cd $ISP_WORKDIR/app_tinyyolov2_cam/src/
patch -p 1 < rzv2l_app_tinyyolov2_cam_usb2mipi.patch

# Step 5. Setup SDK
source /opt/poky/3.1.5/environment-setup-aarch64-poky-linux

# Step . Build Source
make

RZV2L Cortex-M33 Multi-OS Package

Instructions for RZV Cortex-M33 Multi-OS Package is located below.

Cortex-M33 Multi-OS Package Support

Enable eMMcC Flash

The instructions to enable the RZV2L to boot from eMMC Flash at on the RZG2L Page here

Program On-Board eMMC Flash

The instructions to enable the RZV2L to load the Linux kernel, DTB, and Filesystem RZG2L Page here

Fix rngd bug that randomly keeps all CPUs busy after startup

RZ MPUs do not have a hardware random number generation module (/dev/hwrng), but that's the default setting for the systemd rngd service.

With that, rngd occupies the CPU resources to build up entropies during start-up.

Randomly, this process does not end properly and slows down the entire system significantly.

But if an available pseudorandom number generator is selected, rngd finishes properly always.

The following modification is sufficient:

Before you build the BSP, modify

poky/meta/recipes-support/rng-tools/rng-tools/default

from

   EXTRA_ARGS="-r /dev/hwrng"

to

   EXTRA_ARGS="-r /dev/urandom -x jitter"

However, normally you do not want to modify the original recipe but instead create a new one to override the old one.

  1. Create a new folder: mkdir - p meta-renesas/recipes-rzg2l/recipes-support/rng-tools
  2. Change dir: cd meta-renesas/recipes-rzg2l/recipes-support/rng-tools
  3. Create a new file in that folder: vi rng-tools_%.bbappend
  4. Edit the file just created and add these lines: FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:" SRC_URI += "file://default"(1)
  5. Create another folder: mkdir -p rng-tools
  6. Add a file vi default
  7. Add the new content into it: EXTRA_ARGS="-r /dev/urandom -x jitter"
  8. Rebuild the image with the new package: bitbake core-image-weston

(1) Note that this is the new Yocto syntax. For older versions of Yocto you may need to replace : (colon) with _ (underscore): so FILESEXTRAPATHS_prepend.

Alternatively, you can modify the

/etc/default/rng-tools

file in the current target rootfs accordingly.

DRP-AI Driver Version 7.00

This version to the DRP-AI Reserve Area has changed from 0x70000000 to 0x80000000, because of this older versions of the DRP-AI Implementation Source code will fail with the following errors.

[ERROR] Failed to run DRPAI_ASSIGN : errno=22

[ERROR] Failed to run load_data_to_mem : resnet50_cam/drp_desc.bin

[ERROR] Failed to load DRPAI Data

This is due to the generated DRP Translator files map to the older address. Please use the DRP Translator version 1.70 when generating the DRP files and use the latest sample code included in the DRP-AI package version 7.0.