RZ/V2L SMARC Board by Renesas

From Renesas.info
Revision as of 00:34, 23 March 2022 by Zkmike (talk | contribs) (fixed boot script)

<img height="200" style="float:right" src=renesas_rzg2l_carrier.jpg> ← RZ-V

General Information

Sharing of RZ/G2L Board Documentation

RZV2L and RZG2L Boot Loaders

Warning the pre-loaded bootloaders (Uboot and ARM Trusted Zone loader) on the RZV2L and RZG2L 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 Getting Started section of this page, are installed on the SMARC board. For instruction on how to install the loaders please refer to the RZ/G2L Group and RZ/V2L SMARC EVK Startup Guide section 2.2 Startup Procedure found on the RZV2L or RZG2L product page.

Known issues with pre-loaded loaders.

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

Getting Started

1. Software BSP Components
Up to 5 packages are used to build the BSP.

Please download from the Official RZ/V2L Website :

  • Linux BSP package: r01an6221ej<version>-rzv2l-linux.zip. Unzip the contents and copy to a Linux PC.
  • Mali Graphic Library package (*): RTK0EF0045Z13001ZJ-v<version>_EN.zip to enable graphs. Copy the ZIP file to a Linux PC.
  • Video Codec Library package (*): RTK0EF0045Z15001ZJ-v<version>_EN.zip. Unzip the contents and copy to a Linux PC.
  • DRP-AI Support package: r11an0549ej<version>-rzv2l-drpai-sp.zip. Unzip the contents and copy to a Linux PC.
  • RZ/V2L ISP Support package ("Simple ISP" by DRP-AI): r11an0561ej<version>-rzv2l-isp-sp.zip. Unzip the contents and copy to a Linux PC.


(*): The "Mali Graphics Library package" and the "Video codec Library package" are currently available as "evaluation version" only.

As the name indicates, the evaluation version should be used for evaluation purposes only. It contains a time limitation that stops the software after a few hours.

For unlimited runtime, please switch to the "production version".

As these are not available for download yet, please request them from your Renesas representative.


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.


3. Build the BSP

  • The complete build environment created by "Linux BSP package" + "DRP-AI Support package" (combine into the same directory).
  • Detailed instructions for setup and building are located in the Release Note documents in each "Linux BSP" and "DRP-AI Support" package.
    • ⚠️ You must first follow the Linux BSP Release Note instructions (r01an6221ej<version>-rzv2l-linux.pdf) Section 3.1 (1),(2),(3),(4),(5)
    • Then follow DRP-AI Support Release Note (r11an0549ej<version>-rzv2l-drpai-sp.pdf) Sections 3.1 and 3.2
    • 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 v1.00        

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

export WORK_DIR=$PWD/rzv2l_bsp_v1.00
mkdir $WORK_DIR
### Extract the BSP Linux package
cd $WORK_DIR 
unzip ../r01an6221ej0100-rzv2l-linux.zip
tar -xf ./r01an6221ej0100-rzv2l-linux/rzv2l_bsp_v100.tar.gz -C .
### Please modify the following file $WORK_DIR/meta-rzv/recipes-bsp/u-boot/u-boot_2020.10.bb
### Replace SRCREV = "35a832d08bddaf64b3dccbf364732ac7f8dfb647" with
### with    SRCREV = "c12017179a8ca11d38486f1ace08d52a489056d0" 
### to avoid a failing "saveenv" command within the u-boot console
### this will be fixed in one of the next BSPs
sed -i -e 's|35a832d08bddaf64b3dccbf364732ac7f8dfb647|c12017179a8ca11d38486f1ace08d52a489056d0|g' $WORK_DIR/meta-rzv/recipes-bsp/u-boot/u-boot_2020.10.bb
### Copy/Move the 'Mali Graphics library' Zip file (RTK0EF0045Z13001ZJ-v0.51_forV2L_EN.zip) under the BSP directory.
cd $WORK_DIR
unzip ../RTK0EF0045Z13001ZJ-v0.8_EN.zip 
tar -zxvf RTK0EF0045Z13001ZJ-v0.8_EN/meta-rz-features.tar.gz .

### Copy/Move the 'MRZG2L Codec Library v0.4' Zip file (RTK0EF0045Z13001ZJ-v0.51_forV2L_EN.zip) under the BSP directory.
cd $WORK_DIR
tar -xf ../RTK0EF0045Z15001ZJ-v0.51_EN.zip
tar zxvf RTK0EF0045Z15001ZJ-v0.51_EN/meta-rz-features.tar.gz

### Copy/Move the DRP Support archive file ( rr11an0549ej0500-rzv2l-drpai-sp.zip ) 
### Extract the 'DRP-AI Driver Support' package file (rzv2l_meta-drpai_ver0.90.tar.gz) under the BSP directory.
### After exacting using the command below, this will add a new directory "meta-drpai" and file "rzv2l-drpai-conf.patch"
cd $WORK_DIR
unzip ../r11an0549ej0500-rzv2l-drpai-sp.zip -d drp
tar -xvf ../drp/rzv2l_meta-drpai_ver5.00.tar.gz

### Copy/Move the ISP Support archive file ( r11an0561ej0100-rzv2l-isp-sp.zip ) 
### Extract the ISP Support Package ( rzv2l_meta-isp_ver1.00.tar.gz ) nder the BSP directory.
### After exacting using the command below, this will add a new directory "meta-isp" and file "rzv2l-isp-conf.patch"
cd $WORK_DIR
unzip ../r11an0561ej0100-rzv2l-isp-sp.zip 
tar -zxvf ./rzv2l_meta-isp_ver1.00.tar.gz

### Set up the Yocto Environment and copy a default configuration
cd $WORK_DIR
source poky/oe-init-build-env
cp ../meta-rzv/docs/template/conf/smarc-rzv2l/*.conf ./conf/


### Apply the patch from the 'DRP-AI Support' package
### (the current directory should still be the 'build' directory)
cd $WORK_DIR/build
patch -p2 < ../rzv2l-drpai-conf.patch
### Apply Simple ISP Patch
patch -p2 < ../rzv2l-isp-conf.patch

### Build
bitbake core-image-weston
bitbake core-image-weston -c populate_sdk


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)

Sample and Demo Code

Programming Boot Loaders into SPI Flash

  • The RZ/V2L board come pre-programmed with the boot loaders in SPI Flash. Normally, they should not need to be updated.
  • However, if you wish to update them, please refer to the document RZV2L_SMARC_EVK_Start-up_Guide_rev0.8.pdf for instruction.
  • ⚠️ The RZ/V2L BSP v0.8 will build the bootloader binaries (bl2_bp-smarc-rzv2l.srec, fip-smarc-rzv2l.srec). However, the 'Flash Writer' binary that is needed for programming as described in the Start-up Guide is only provided as binary at this time. Please download them below:

Convert RZ/G2L BSP to RZ/V2L BSP

  • Some users have started with a RZ/G2L BSP and board and would like to migrate to RZ/VL2.
  • Since the RZ/V2L and RZ/G2L devices are very similar, the BSP software is almost the same.
  • Below are some ways you can convert the RZ/G2L BSP to build software for the RZ/V2L board.

Method #1: Build RZ/V2L files when selecting RZ/G2L in Yocto

  • The Yocto build environment for the RZ/V2L is almost same as the RZ/G2L. However, you will need to modify some files in Yocto in order to be able to build files for the RZ/V2L SMARC board.
  • These patches are only for the RZ/G2L BSP v1.3
  • File:0001-rzg2l-common-add-v2l-dtb.patch
    • This patch will include the RZ/V2L Device Tree as part of the build.
  • File:0002-bin file-overwrite-G2L-for-V2L.patch
    • This patch will build files for the RZ/V2L board even when MACHINE is set to "smarc-rzg2l"
  • After applying these patches, just build Yocto for G2L SMARC (smarc-rzg2l) as normal.


Method #2: Build Outside of Yocto

  • Some software components of the BSP are very easy to build outside of Yocto, and a Yocto environment is not needed. These are ARM Trusted Firmware, u-boot and Flash Writer. These software components can be built completely independent of Yocto.
  • In general, the same Root File System (rootfs) of a Linux system can be used on many different boards. For example, the rootfs of the RZ/V2L board is almost identical to the rootfs of the RZ/G2L, and you can swap them. Of course, the applications loaded into each might be different, but booting is always possible.
  • The Linux kernel also does not require Yocto to be built, however, some output files such as kernel modules will need to be copied to the root file systems that Yocto builds.
  • Build scripts are available to built BSP software components outside of Yocto. Please see below.
Build Instructions for RZ/V2L Software Components                              

Use the commands below to prepare a build environment for the RZ/V2L SMARC board.

# Download and install a toolchain
cd /tmp
wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.2-2020.11/binrel/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz
sudo mkdir -p /opt/arm
cd /opt/arm
sudo tar xvf /tmp/gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf.tar.xz

# Download Build Scripts
cd /home/$USER    # Choose your own location
git clone https://github.com/renesas-rz/rzg2_bsp_scripts

# Download source code repositories
cd build_scripts
git clone --branch rz_g2l         https://github.com/renesas-rz/rzg2_flash_writer
git clone --branch v2.5/rzg2l     https://github.com/renesas-rz/rzg_trusted-firmware-a
git clone --branch v2020.10/rzg2l https://github.com/renesas-rz/renesas-u-boot-cip

# Build
./build.sh s      # Select RZ/V2L SMARC, and the toolchain "ARM gcc-arm-10.2-2020.11" you downloaded
./build.sh f      # Build Flash Writer
./build.sh u      # Build u-boot
./build.sh t      # Build Trusted Firmware-ARM


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

The RZV2L includes a ARM CM33 MCU. This section describes how to build applications and communication between the CV55 and the CM33.

Official RZV2L Cortex-M33 Multi-OS Package

  • Please review the downloads and documents here

The Cortex-M33 supports the the Reness FSP ( Flexible Software Package ).

  • Documentation for the FSP can be found on the Official RZV2L Cortex-M33 Multi-OS Package
  • Release Note for RZV2L Flexible Software Package PDF
  • RZV2L FSP Documentation V1.00 PDF

Renesas e2studio IDE supports application development and debugging for the Cortex-CM33

  • Please review the RZV2L Getting Started Guide. This document includes information about setting up the IDE for RZV2L/CM33 Development, loading, and running Cortex-CM33 Applications

CM33 e2studio GDB Debug

  1. Build the BSP and downloaded the latest ARM Trust Zone Loader and Uboot. This is very important because the loaders setup the board and processor hardware ( CM33, DRP, ... ). The preinstalled loaders on the board do not properly setup the processor and board.
  2. Set the SW1 switch to enable the JTAG and SW11 to QSPI Flash or Serial Interface. ( See figure JTAG Connection and SW11 Settings ).
    JTAG Connection and SW11 Settings.
  3. Press the power button on the board. You should see three LEDS. If the USB wire is connected to the Serial Interface you should see the uboot start up.
  4. Create a RZV2L Project.
    1. Set the Board to RZV2L Evaluation Kit (SMARC). This will set the project GPIO pins correctly
    2. Device settings: R9A07G054L23GBG
    3. Debugger: J-Link ARM
    4. Choose either Mare Metal - Blinky or FreeRTOS - Blinky. Theses projects will generate the GPIO code for the LED.
  5. Compile Project
    1. If there are error check the correct compiler is selected or open the FSP perspective and click generate code.
  6. Open the Project Debug Configuration ( Run -> Debug Configuration ). Under Renesas GDB Hardware Debugging, select the configuration with the same name as your project name.
  7. In the Debug Configuration -> Debugger Check the following settings.
    1. Target Device is R9A07G054L_M33
    2. Connection Settings -> Rest on connection is set to No
  8. In the Debug Configuration -> Startup
    1. Reset and Delay is unchecked
    2. Run Commands:
set {int} 0x4102080C=0x1001FF80
set {int} 0x41020810=0x00010000
  1. Press Apply then debug.

Linux BSP and CM33 Command U-Boot support

The Default RZV2L BSP U-Boot does not support Cortex-M33 Multi-OS. To enable the u-boot CM33 command and OpenAMP Multi-processor communication add below snippet to the BSP build script described Getting Started.

Simple build instructions for Cortex-M33 Multi-OS        

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

cd ~/user_work
unzip r01an6238ej0100-rzv2l-cm33-multi-os-pkg.zip

# Unpack the Cortex-M33 Multi-OS Packages
unzip ./r01an6238ej0100-rzv2l-cm33-multi-os-pkg/meta-rzv2l-freertos.zip
unzip ./r01an6238ej0100-rzv2l-cm33-multi-os-pkg/meta-openamp.zip
.
.
source poky/oe-init-build-env

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