RZ/G2L, RZ/G2LC, RZ/G2UL SMARC Board by Renesas

From Renesas.info

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

πŸ“ŒThis page is for the RZ/G2L, RZ/G2LC RZ/G2UL evaluation boards.

General Information

Board Version Identification (RZ/G2L only)

There are currently multiple versions of RZ/G2L boards with different components. (There is only 1 version of RZ/G2LC board). Please make note of what board you have.
Some boards require different software patches to be applied before building.

RZG2L Discrete vs PMIC.png

RZ/G2L Silicon version WS1 vs WS2:

  • The WS1 Silicon version has the specific date code "2050KC002" written on top of the device
  • The WS2 Silicon version has the text "RZ/G2L" written on top of the device

Discrete Power Design vs New Renesas PMIC Solution:

  • The Discrete Power design has the words "Renesas" written in white silk screen on the top edge of the board.
  • The PMIC Power design has the words "Renesas" written in white silk screen in the center the board. Also, the PMIC has the words Renesas on the top of the device.

Board Combinations:

Here are the only release of these boards:

  • 1st Release: WS1 Silicon + Discrete Power
  • 2nd Release: WS2 Silicon + Discrete Power
  • 3rd Release: WS2 Silicon + PMIC Power

Power Button on PMIC Boards:

  • On the PMIC boards, please press and hold the red power button for 2 seconds to turn ON and OFF.
  • If the "Carrier PWR On" LED does not turn green, please try again and hold the button longer.

Getting Started

1. Download the Linux BSP

  • Download the RZ/G2L Board Support Package from renesas.com. Links to all the downloads can be found on the πŸ“¦ RZ/G2 Linux BSP on this site. Please refer to the sections that support RZ/G2L.
  • The Linux-5.10 BSP is recommended.
  • You will need to downloaded multiple packages for the full build. You will need to download the "RZ/G2L Mali Graphic Library" package to enable graphics and "RZ/G2L Codec Library" package to enable video encode/decode.

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

  • Build Instructions: The instructions for building the BSP are located in the Release Note document that is included in the ZIP file download from renesas.com.
  • Board Versions: There are currently 3 versions of RZ/G2L boards (WS1-Discrete, WS2-Discrete, WS2-PMIC). Please review section Board Version Identification above. There is only 1 version of RZ/G2LC board. There is only 1 version of RZ/G2UL board. If you have a RZ/G2L 'WS1' board (very rare), please review section 6 in the 'Release Note' of the BSP in detail before following the instructions in section 3.
  • Enable Qt: To build the Qt demos (core-image-qt) you must edit the file build/conf/local.conf and remove the comment marker # to set QT_DEMO = "1" . Please build (bitbake) core-image-weston first, then bitbake core-image-qt. If you buid core-image-qt first, you will get an error. Also, if you get a build error, just keep running the bitbake command again until it completes (there seems to be some issue in the order that packages build).
  • Graphics Libraries: If you are building core-image-weston or core-image-qt, you need to add Mali Graphics library mentioned in step 1.
  • Hint: To make the build faster, you can copy the downloads directory from an older BSP (rzg2l_bsp_v1.3/build/downloads -> rzg2l_bsp_v1.4/build/downloads) to skip downloading the same open source packages again.


4. Prepare an SD Card

  • The evaluation boards boot from SPI Flash (boot loaders), then can run Linux from either eMMC on the board or an external SD Card.
  • The SD Card must be formatted by a Linux PC, and contain 2 partitions: FAT and ext4.
    • 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 from github 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.
  • Choose the correct command for RZ/G2L or RZ/G2LC or RZ/G2UL
# Change to the Yocto output directory that contains the files
$ cd build/tmp/deploy/images/smarc-rzg2l   # RZ/G2L
$ cd build/tmp/deploy/images/smarc-rzg2lc  # RZ/G2LC
$ cd build/tmp/deploy/images/smarc-rzg2ul  # RZ/G2UL

# Copy the Linux kernel and Device Tree to partition 1
$ sudo cp -v Image /media/$USER/RZ_FAT
$ sudo cp -v r9a07g044l2-smarc.dtb /media/$USER/RZ_FAT   # RZ/G2L
$ sudo cp -v r9a07g044c2-smarc.dtb /media/$USER/RZ_FAT   # RZ/G2LC
$ sudo cp -v r9a07g043ull-smarc.dtb /media/$USER/RZ_FAT  # RZ/G2LUL

# Copy and expand the Root File System to partition 2
$ sudo tar -xvf core-image-minimal-smarc-rzg2l.tar.gz   -C /media/$USER/RZ_ext          # RZ/G2L
$ sudo tar -xvf core-image-minimal-smarc-rzg2lc.tar.gz  -C /media/$USER/RZ_ext          # RZ/G2LC
$ sudo tar -xvf core-image-minimal-smarc-rzg2ul.tar.gz  -C /media/$USER/RZ_ext          # RZ/G2UL
    (or if using graphics)
$ sudo tar -xvf core-image-weston-smarc-rzg2l.tar.gz   -C /media/$USER/RZ_ext          # RZ/G2L
$ sudo tar -xvf core-image-weston-smarc-rzg2lc.tar.gz   -C /media/$USER/RZ_ext          # RZ/G2LC
$ sudo tar -xvf core-image-weston-smarc-rzg2ul.tar.gz   -C /media/$USER/RZ_ext          # RZ/G2UL

# 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. 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/G2L.
  • ⚠️ u-boot environment variables are always stored in eMMC Flash (not SPI flash). This means if you change switch SW1-2 to ON 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/G2L.
  • On the SOM (CPU) board, there is a little switch (SW1) near the SD card socket.
  • Use the Recommended Settings below. It is the default of how the board was shipped.
[Recommended Settings]                        [Advanced Users Only]
 SOM board uses eMMC                           Flash SOM board uses SD Card socket
 SW1-1 = ON/OFF(JTAG)                          SW1-1 = ON/OFF(JTAG)
 SW1-2 = OFF                                   SW1-2 = ON
      +-----+                                       +-----+
      | ON  |                                       | ON  |
      | =   |                                       | = = |
      |   = |                                       |     |
      | 1 2 |                                       | 1 2 |
      +-----+                                       +-----+

6. Power the Board and Connect to the Serial Port

  • On the Carrier Board, set switches SW11 as follows because the boot loaders are stored in QSPI Flash.
SW11-1 = OFF
SW11-2 = OFF
SW11-3 = OFF
SW11-4 = ON
      +---------+
      | ON      |
      |       = |
      | = = =   |
      | 1 2 3 4 |
      +---------+
  • 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.

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.
  • ⚠️ If you get an failure when saving with "saveenv", remove power to the board and try again.

RZ/G2L EVK Booting Commands:

   # Create command macros and save them:
=> setenv sd_boot1 'mmc dev 1 ; fatload mmc 1:1 0x48080000 Image ; fatload mmc 1:1 0x48000000 /r9a07g044l2-smarc.dtb'
=> setenv sd_boot2 'setenv bootargs 'root=/dev/mmcblk1p2 rootwait' ; booti 0x48080000 - 0x48000000'
=> setenv bootcmd 'run sd_boot1 sd_boot2'
=> saveenv

RZ/G2LC EVK Booting Commands:

   # Create command macros and save them:
=> setenv sd_boot1 'mmc dev 1 ; fatload mmc 1:1 0x48080000 Image ; fatload mmc 1:1 0x48000000 /r9a07g044c2-smarc.dtb'
=> setenv sd_boot2 'setenv bootargs 'root=/dev/mmcblk1p2 rootwait' ; booti 0x48080000 - 0x48000000'
=> setenv bootcmd 'run sd_boot1 sd_boot2'
=> saveenv

RZ/G2UL EVK Booting Commands:

   # Create command macros and save them:
=> setenv sd_boot1 'mmc dev 1 ; fatload mmc 1:1 0x48080000 Image ; fatload mmc 1:1 0x48000000 /r9a07g043ull-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

  • Set switch SW1-2 = OFF
  • The boot loader (u-boot) by default will try to boot from

8. Linux Login

  • The login will be root (no password is needed)
  • You can plug in a USB Mouse or USB Touchscreen

Sample and Demo Code

Github Repository

Board Setup Information

board configuration.png
RZ/G2L Evaluation Board Kit Configuration
smarc module board top.png
RZ/G2L SMARC Module Board (TOP)
smarc module board bottom.png
RZ/G2L SMARC Module Board (Bottom)
smarc series carrier board.png
RZ SMARC Series Carrier Board
 
power supply.png
Power Supply
The following power supply environment is used in the evaluation of Renesas:
● USB Type-C cable CB-CD23BK (manufactured by Aukey)
● USB PD Charger Anker PowerPort III 65W Pod (manufactured by Anker)
JTAG connection ice debug.png
JTAG Cable Connection for ICE Debugging
When connecting JTAG debugger, please set the DIP SW1 settings as shown.
The JTAG connector is 10pin.
 
boot mode.png
How to set Boot Modes
 
RZG2UL SW1 setting.png
Smarc RZ/G2UL DIP Switch(SW1) Settings
RZG2LC SW1 setting.png
Smarc RZ/G2LC DIP Switch(SW1) Settings

Board Operation Information

power on.png
Power ON
● Connect USB-PD Power Charger to USB Type-C Connector. Then LED1(VBUS PWR On) and LED3(Module PWR On) lights up.
● Press SW9 to turn on the power. Then LED4(Carrier PWR On) lights up.
debug serial.png
Debug Serial (Console Output)
● Debug serial uses CN14. The baud rate is 115200bps.
● Since the serial-USB conversion IC is not always powered, the Windows PC will recognize it after the power switch is turned on.
● If it is not recognized by your Windows PC, please install the driverοΏ½https://www.ftdichip.com/Drivers/VCP.htm

LCD Monitors

The following HDMI LCD screens were tested with this board.

LCD Monitors
Resolution Touchscreen Description Link Comments
πŸ™‚ 1920x1080 Yes Wimaxit 14 Inch πŸ›’ buy This is a very nice screen. Good color and easy to press the icons. The LCD input is mini-HDMI and comes with a mini-HDMI to HDMI cable. The RZ board is micro-HDMI. You will also need to buy a HDMI to micro-HDMI adapter. Or, buy a mini-HDMI to HDMI-micro cable. Note the the micro-USB connection on the LCD for touchscreen does not work, but the USB-C connector does work for touchscreen. You will simply need a USB-C to USB-A cable or adapter.
πŸ™‚ 1920x1080 Yes ELECROW 10.1 Inch πŸ›’ buy This is a very nice screen. You will also need to buy a HDMI to micro-HDMI cable.
😐 1920x1080 Yes/No(issues) EVICIV 10.1 Inch πŸ›’ buy ⚠️ The display works, USB touch is detected and shows up as /dev/input/event0, but does not work 100%. You can 'scroll' in a web page by dragging your finger on the screen, but actually touches (mouse clicks) do not work for some reason. There is also a noisy fan inside for an R-pi that you'll need to unplug. You will also need to buy a HDMI to micro-HDMI cable. I would not recommend his one.
πŸ™‚ 1280x800 Yes SunFounder 10.1 inch πŸ›’ buy All the cables that you will need are included.
πŸ™‚ 1024x600 Yes Ingcool 7 inch
7IP-CAPLCD
πŸ›’ buy If you attach the 'Touch' USB connection on the LCD to the RZ/G2L board, it will both power the LCD board as well as enable touch support. This kit comes with HDMI cables.
πŸ™‚ 800x480 Yes GeeekPi 5 Inch
EP-0081
πŸ›’ buy HDMI cable not included.
😐 800x480 Yes/No(Header) Kuman 5 Inch
β€ŽSC5A-US-KFBA
πŸ›’ buy ⚠️ The Touchscreen comes out on a header and no easy way to hook it up. HDMI cable not included.
☹️ 800x480 Yes ELECROW 5 inch πŸ›’ buy ⚠️ This screen flickers with the RZ/G2L board. The reason is not known.

Using the Coral MIPI Camera

As of the RZ/G2L BSP v1.3 release, the Coral Camera module (OV5645) is supported and enabled.

MIPI CSI Configuration and Resolution Selection
Before you can use the camera, you must first configure the MIPI CSI module to capture image.
MIPI CSI configuration is done by using media-ctl utility from v4l-utils package.
The first 2 commands below enable the camera.
Below that are commands you use to select the camera resolution you want to capture.

[ Camera Setup ]
media-ctl -d /dev/media0 -r
media-ctl -d /dev/media0 -l "'rzg2l_csi2 10830400.csi2':1 -> 'CRU output':0 [1]"

[Select resolution 1280x960 ]
media-ctl -d /dev/media0 -V "'rzg2l_csi2 10830400.csi2':1 [fmt:UYVY8_2X8/1280x960 field:none]"
media-ctl -d /dev/media0 -V "'ov5645 0-003c':0 [fmt:UYVY8_2X8/1280x960 field:none]"

[Select resolution 1920x1080 ]
media-ctl -d /dev/media0 -V "'rzg2l_csi2 10830400.csi2':1 [fmt:UYVY8_2X8/1920x1080 field:none]"
media-ctl -d /dev/media0 -V "'ov5645 0-003c':0 [fmt:UYVY8_2X8/1920x1080 field:none]"

[Select resolution 2592x1944 ]
media-ctl -d /dev/media0 -V "'rzg2l_csi2 10830400.csi2':1 [fmt:UYVY8_2X8/2592x1944 field:none]"
media-ctl -d /dev/media0 -V "'ov5645 0-003c':0 [fmt:UYVY8_2X8/2592x1944 field:none]"

Capture Images using GStreamer
This command can be used capture images and display them on the screen in weston.

gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! waylandsink

To capture 300 images (resolution 1280x960) in .jpg format use

gst-launch-1.0 v4l2src  num-buffers=300 device=/dev/video0 ! video/x-raw,format=UYVY,width=1280,height=960 ! videoconvert ! jpegenc ! multifilesink location=image_HD_%05d.jpg

To capture appr. 2min videos (resolution 1280x960) in .mp4 format use

gst-launch-1.0 v4l2src num-buffers=3600 device=/dev/video0 ! video/x-raw,format=UYVY,width=1280,height=960,framerate=60/1 ! vspmfilter outbuf-alloc=true ! video/x-raw,format=NV12 ! omxh264enc control-rate=2 target-bitrate=10485760 interval_intraframes=14 periodicty-idr=2 no-copy=true ! video/x-h264,profile=\(string\)high,level=\(string\)4.2 ! h264parse ! video/x-h264,stream-format=avc,alignment=au ! qtmux ! queue ! filesink location=video_HD.mp4

Build Qt in the v1.4 BSP

This only applies to BSP V1.3 an V1.4. BSP v3.0.0 is supposed by default.

BSP V1.3 and V1.4 already supports to build core-image-qt. Please follow these instructions to add Qt to the build.
There is an issue in BSP V1.3 to play the multimedia file by gstreamer or gst-launch-1.0. This issue is fixed in BSP V1.3_update1.

Start in the base of the Yocto BSP directory.

$ git clone https://github.com/meta-qt5/meta-qt5
$ cd meta-qt5
$ git checkout c1b0c9f546289b1592d7a895640de103723a0305
$ cd ..

It also comes with Qt demoes. If you want to build the demos, enable QT_DEMO = "1" in conf/local.conf.

  • Edit file /build/conf/local.conf
  • Remove the comment marker # to set QT_DEMO = "1"
# Adding qt demonstration to core-image-qt or not
QT_DEMO = "1"

Now you can build core-image-qt.

$ bitbake core-image-qt

After the build is complete, copy the new root file system to your SD Card

$ cd build/tmp/deploy/images/smarc-rzg2l
$ sudo tar -xvf core-image-qt-smarc-rzg2l.tar.gz   -C /media/$USER/RZ_ext
$ cd -
$ sync

After the board boots, on the Weston desktop you will see icons that will start the demos.

Add HTML5 Browser to BSP v1.4

  • The following instructions will add Firefox and the HTML engine Gecko (ver 91) to the RZ/G2L v1.4 BSP.
  • The package "vte" (Virtual Terminal) package changed from GLPv2 to GPLv3 from v0.52 to v0.53. This package is required when build gecko. However, a patch is supplied that will revert this package to an older version in order to avoid GLPv3 license issues.
  • Sometimes when building, you will get a pseudo abort exit 134 error in Yocto. We fix that by adding the Debian packages pseudo and attr to the BSP v1.4. Then, it will build correctly every time.
  • First, download and configure the RZ/G2L BSP v1.4. Following the Release Note, do the steps in Section 3, but stop at step "(5) Start a build". We need to make some changes before we run "bitbake core-image-weston".
  • Now that you have configured the BSP, you can follow the instructions below to add HTML support.
  • For the instructions below, start at the base of the BSP v1.4 directory. If you are in the build directory, please do a cd .. first to get back to the base of the BSP before copy/pasting the instructions below.
  • Please note that these changes will break a core-image-qt build.
Instructions                              

Add meta layers to build Gecko91

$ git clone -b gem-firefox-91.0.0esr https://github.com/webdino/meta-browser.git
$ git clone https://github.com/meta-rust/meta-rust.git
$ git -C meta-rust checkout 1b59fd45906082c978d0a0a6e4e51a0ea4aa32c7
$ git -C meta-rust revert 647b976da2a9161ceb01ad477216480fc1c88af8 < /dev/null
$ git clone -b dunfell https://github.com/webdino/meta-clang.git

Add dummy files in meta-rzg2/classes/ because the gecko recipes want to "inherit"

$ cd meta-rzg2/classes
$ touch distutils.bbclass pythonnative.bbclass setuptools.bbclass
$ cd ../..

Download and apply addition patches for X11 and vte

$ cd meta-rzg2
$ wget https://raw.githubusercontent.com/seebe/rzg_stuff/master/boards/rzg2l_smarc/gecko91_for_bsp_v1.4/0001-recipes-graphics-xorg-xserver-Remove-unsupported-opt.patch
$ wget https://raw.githubusercontent.com/seebe/rzg_stuff/master/boards/rzg2l_smarc/gecko91_for_bsp_v1.4/0001-recipes-gecko-add-vte-version-0.52.2.patch
$ patch -p1 < 0001-recipes-graphics-xorg-xserver-Remove-unsupported-opt.patch
$ patch -p1 < 0001-recipes-gecko-add-vte-version-0.52.2.patch
$ cd ..

Download and apply addition patches to add debian pseudo and attr

$ cd meta-rzg2
$ wget https://raw.githubusercontent.com/seebe/rzg_stuff/master/boards/rzg2l_smarc/gecko91_for_bsp_v1.4/add-debian-pseudo-and-attr.patch
$ patch -p1 < add-debian-pseudo-and-attr.patch
$ cd ..

Edit the file build/conf/local.conf

$ gedit build/conf/local.conf &
  • Comment out the following line in the build/conf/local.conf by placing a "#" at the beginning of the line.
#DISTRO_FEATURES_remove = " x11"		
  • Add the following lines for Gecko91 at the end of build/conf/local.conf
IMAGE_INSTALL_append = " firefox "
IMAGE_INSTALL_append = " ttf-sazanami-gothic ttf-sazanami-mincho "
IMAGE_INSTALL_append = " pulseaudio-server "
IMAGE_INSTALL_append = " adwaita-icon-theme adwaita-icon-theme-cursors "
PACKAGECONFIG_append_pn-firefox = " openmax "
PACKAGECONFIG_append_pn-firefox = " webgl "
PACKAGECONFIG_append_pn-firefox = " gpu "
PREFERRED_VERSION_vte = "0.52.2"

TARGET_CXXFLAGS_remove_toolchain-clang = " --stdlib=libc++"
TUNE_CCARGS_remove_toolchain-clang = " --rtlib=compiler-rt --unwindlib=libunwind --stdlib=libc++"
TUNE_FEATURES_remove_toolchain-clang = "cortexa57-cortexa53"

DISTRO_FEATURES_append = " x11"
PACKAGECONFIG_remove = " libedit "

Configure bblayers.conf to add the meta-layers we downloaded (git cloned) to the build

$ source poky/oe-init-build-env
$ bitbake-layers -F add-layer $(pwd)/../meta-rust
$ bitbake-layers -F add-layer $(pwd)/../meta-clang
$ bitbake-layers -F add-layer $(pwd)/../meta-browser

Start the build

$ bitbake core-image-weston

How to launch Firefox91

  • After launching the board, you can launch Firefox91 with the following command.
  • We suggest that you use PMIC board with Full HD resolution(1920:1080) to evaluate HTML5.

Launch in a window:

$ WAYLAND_DISPLAY=wayland-0 GDK_BACKEND=wayland MOZ_OMX_RZG2L=1 firefox --width 640 --height 480

Launch full screen: (kiosk mode, adjust resolution to match your screen),

$ WAYLAND_DISPLAY=wayland-0 GDK_BACKEND=wayland MOZ_OMX_RZG2L=1 firefox --width 1024 --height 600 --kiosk https://renesas.info

Enable eMMC Boot

eMMC Boot refers to the SoC booting directly from eMMC flash after RESET. This means SPI Flash is not used.

eMMC boot support was added after BSP v1.3 was released.

The follow commands (copy/paste) and instructions will allow you to manually download, build and program your board.

Instructions                              
# Download and install a toolchain
# Linaro Toolchain, Version 7.5.0-2019.12
sudo mkdir -p /opt/linaro
cd /opt/linaro
sudo wget https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
sudo tar xvf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu.tar.xz
cd -   # this command puts you back to your original directory :)

# Make sure you have all the build utilities you need
sudo apt-get install git make gcc g++ libncurses5-dev libncursesw5-dev python bison flex libssl-dev

# Allow non-root access to tty
sudo usermod -a -G dialout $USER

# Create a new Directory
mkdir rzg2l_emmc_boot
cd rzg2l_emmc_boot

#---------------------------------------------------
# Download Flash Writer
#---------------------------------------------------
git clone https://github.com/renesas-rz/rzg2_flash_writer
cd rzg2_flash_writer ; git checkout rz_g2l ; cd ..      # Same branch for RZG2L and RZV2L

#---------------------------------------------------
# Download Trusted Firmware-A
#---------------------------------------------------
git clone https://github.com/renesas-rz/rzg_trusted-firmware-a
cd rzg_trusted-firmware-a ; git checkout v2.5/rzg2l ; cd ..    # Same branch for RZG2L and RZV2L

#---------------------------------------------------
# Download mbed
# mbed code is needed to build Trusted Firmware-A with security enabled
#---------------------------------------------------
git clone git://github.com/ARMmbed/mbedtls.git
cd mbedtls ; git checkout mbedtls-2.16.3 ; cd ..

#---------------------------------------------------
# Download u-boot
#---------------------------------------------------
git clone https://github.com/renesas-rz/renesas-u-boot-cip
cd renesas-u-boot-cip ; git checkout v2020.10/rzg2l ; cd ..    # Same branch for RZG2L and RZV2L

#---------------------------------------------------
# Download build scripts
#---------------------------------------------------
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_common.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_flashwriter.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_tfa.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_uboot.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build.sh
chmod +x *.sh


#---------------------------------------------------
# Configure build system
#
# - Select "smarc-rzg2l" or "smarc-rzv2l"
# - All output files will be in directory "output_smarc-rzg2l" or "output_smarc-rzv2l"
#---------------------------------------------------
./build.sh s

#---------------------------------------------------
# build Flash Writer
#
# - Select toolchain "Linaro gcc-linaro-7.5.0-2019.12 " that you installed
# - Change "eMMC Flash programming support" from "(default)" to "ENABLE"
# - Select 'Build'
#---------------------------------------------------
./build.sh f

#---------------------------------------------------
# build u-boot
#---------------------------------------------------
# * Select toolchain "Linaro gcc-linaro-7.5.0-2019.12" that you installed
./build.sh u

#---------------------------------------------------
# build TF-A
#
# - Select toolchain "Linaro gcc-linaro-7.5.0-2019.12" that you installed
# - Change "Boot Device" to "eMMC Flash"
# - Select 'Build'
#---------------------------------------------------
./build.sh t

#---------------------------------------------------
# Download and run 'Flash Writer Tool'
# - Configure for our output directory 
# - Configure for board "smarc-rzg2l" or for RZV2L "smarc-rzv2l"
# - Configure for eMMC Flash boot
#---------------------------------------------------
git clone https://github.com/renesas-rz/rzg2_bsp_scripts
cd rzg2_bsp_scripts/flash_writer_tool
./flash_writer_tool.sh

### For 'Board', select "smarc-rzg2l" or "smarc-rzv2l"

### For 'Target Flash', select "eMMC Flash"

### For 'FILES_DIR', manually set to "../../output_smarc-rzg2l" or "../../output_smarc-rzv2l"

### Do the follow operations:

Step 1. Select "Show Switches" to show how to put board into SCIF Download mode
Step 2. Select "Download F.W."
Step 3. Select "eMMC boot setup"
Step 4. Select "Program BL2"
Step 5. Select "Program FIP"
Step 6. Select "Show Switches" to show how to put board into eMMC Boot mode
Step 7. Select "<SAVE-and-EXIT>"

Program On-Board eMMC Flash

  • To program the eMMC Flash device on the SOM board, you can follow the instructions below.
  • You will need to boot with SD card first and partition eMMC Flash device. Then you can load the files from SD card to eMMC Flash.

1. Copy listed files to β€œ/home/root” of the SD Card that you use to boot the system.

RZG2L : core-image-weston-smarc-rzg2l.tar.gz, Image and r9a07g044l2-smarc.dtb

RZV2L : core-image-weston-smarc-rzv2l.tar.gz, Image and r9a07g054l2-smarc.dtb

2. Boot the board with the SD card and log into Linux.

3. Partition the eMMC Flash using fdisk.

  • In fdisk, use the commands 'n' to make a new partition, and 'w' to write the partition (will automatically exit fdisk)
  • In fdisk, you can just press the Enter Key to select the default value (you do not have to type the default value)
root@smarc-rzg2l:~# fdisk /dev/mmcblk0
Command (m for help): n
Partition number (1-128, default 1): 1                <<<< just press ENTER for default value
First sector (34-124321758, default 2048): 2048       <<<< just press ENTER for default value
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-124321758, default 124321758): 124321758  <<<< just press ENTER for default value
Created a new partition 1 of type 'Linux filesystem' and of size 59.3 GiB.

Command (m for help): w
The partition table has been altered.

4. Format the partition as ext4

root@smarc-rzg2l:~# mkfs.ext4 -L rootfs /dev/mmcblk0p1

5. Mount the ext4 partition to "/mnt".

root@smarc-rzg2l:~# mount /dev/mmcblk0p1 /mnt

6. Extract the file system to the ext4 partition

RZG2L

root@smarc-rzg2l:~# cd /home/root
root@smarc-rzg2l:~# tar -zxvf core-image-weston-smarc-rzg2l.tar.gz -C /mnt
root@smarc-rzg2l:~# cp Image /mnt/boot
root@smarc-rzg2l:~# cp r9a07g044l2-smarc.dtb /mnt/boot
root@smarc-rzg2l:~# sync

RZV2L

root@smarc-rzg2l:~# cd /home/root
root@smarc-rzg2l:~# tar -zxvf core-image-weston-smarc-rzv2l.tar.gz -C /mnt
root@smarc-rzg2l:~# cp Image /mnt/boot
root@smarc-rzg2l:~# cp r9a07g054l2-smarc.dtb /mnt/boot
root@smarc-rzg2l:~# sync

7. Unmount β€œ/mnt”

root@smarc-rzg2l:~# umount /mnt

8. Reboot and change the boot parameter in u-boot to boot from eMMC

=> setenv bootargs 'rw rootwait earlycon root=/dev/mmcblk0p1'
=> setenv bootcmd 'ext4load mmc 0:1 0x48080000 boot/Image; ext4load mmc 0:1 0x48000000 boot/r9a07g044l2-smarc.dtb; booti 0x48080000 - 0x48000000'
=> saveenv
=> boot

SD card boot

RZ/G2L-LC-UL and RZ/V2L can also boot from a (micro) SD card, this is boot mode 0 called "Booting from eSD" in the User Manual.

This procedure is similar to what reported above for eMMC boot, we are not using Yocto to build (not supported in VLP3.0.0).

Assuming that the host PC is already configured to cross-build:

mkdir sd_boot
cd sd_boot

Now let's clone and patch RZ/G Trusted Firmware:

git clone https://github.com/renesas-rz/rzg_trusted-firmware-a
cd rzg_trusted-firmware-a
git checkout v2.6/rz
wget https://raw.githubusercontent.com/seebe/rzg_stuff/master/tfa_patches/0001-SD-boot-support.patch
patch -p1 < 0001-SD-boot-support.patch
cd ..

Clone u-boot:

git clone https://github.com/renesas-rz/renesas-u-boot-cip
cd renesas-u-boot-cip/
git checkout v2021.10/rz
cd ..

Retrieve some useful scripts to ease the TF-A and u-boot builds, as well as the generation of the binary files we need:

wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_common.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_tfa.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build_uboot.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/build_scripts/build.sh
wget https://raw.githubusercontent.com/renesas-rz/rzg2_bsp_scripts/master/usb_sd_partition/usb_sd_partition.sh
chmod +x *.sh

Select toolchain that you have:

./build.sh s

Let's build u-boot:

./build.sh u

Then TF-A, normally you can leave the default parameters (smarc rz/g2l is the default board) and boot device does not matter:

./build.sh t

Now we have to prepare the (micro) SD card. We can optionally zero it out (WARNING: THE SD CARD CONTENT WILL BE DESTROYED):

sudo dd if=/dev/zero of=/dev/sda bs=1M status=progress

Then, assuming you want to use the same SD card to store kernel and device tree, we can (optionally) partition it:

./usb_sd_partition.sh

We are ready to write the boot files to some specific sectors of the SD card (MBR and partitions won't be touched):

cd output_smarc-rzg2l/
sudo dd if=bootparams-smarc-rzg2l.bin of=/dev/sda seek=1 count=1
sudo dd if=bl2-smarc-rzg2l.bin of=/dev/sda seek=8
sudo dd if=fip-smarc-rzg2l.bin of=/dev/sda seek=128
sync

SD card.png

(*) Note: the size of the files and SD card reported in this picture are just examples. Actual output files size may be different and there is no limitation on the SD card capacity.

If you are using the SMARC board you can insert the micro SD card in the SOM module slot:

smarc micro sd.png

Change the switches to eSD boot on the carrier board acting on SW11 (SW11-1 ON, SW11-2 ON, SW11-3 OFF, SW11-4 ON):

SW11 - sd boot.png

Change SW1 on the module to select micro sd card slot (SW1-1 ON, SW1-2 ON):

SW1 - sd boot.png

and finally the board is ready to boot from the micro SD card:

NOTICE:  BL2: v2.6(release):7e8696ff4-dirty
NOTICE:  BL2: Built : 12:07:55, Sep  8 2022
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x1f7c0 src=(p:0)0x10000(128) len=0x10(1)
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x1f920 src=(p:0)0x10010(128) len=0x28(1)
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x44000000 src=(p:0)0x10090(128) len=0x6069(49)
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x1f7c0 src=(p:0)0x10000(128) len=0x10(1)
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x1f920 src=(p:0)0x10010(128) len=0x28(1)
NOTICE:  BL2: Load dst=0x1f920 src=(p:0)0x10038(128) len=0x28(1)
NOTICE:  BL2: SD boot from partition 0
NOTICE:  BL2: Load dst=0x50000000 src=(p:0)0x16100(176) len=0xa9878(1357)
NOTICE:  BL2: Booting BL31
NOTICE:  BL31: v2.6(release):7e8696ff4-dirty
NOTICE:  BL31: Built : 12:07:55, Sep  8 2022


U-Boot 2021.10-g90edad6e00 (Sep 08 2022 - 11:55:48 +0200)

CPU:   Renesas Electronics K rev 6.15
Model: smarc-rzg2l
DRAM:  1.9 GiB
MMC:   sd@11c00000: 0, sd@11c10000: 1
Loading Environment from MMC... MMC partition switch failed
*** Warning - MMC partition switch failed, using default environment

In:    serial@1004b800
Out:   serial@1004b800
Err:   serial@1004b800
Net:
Error: ethernet@11c20000 address not set.
No ethernet found.

Please note that u-boot by default is configured to store the environment variables on the eMMC boot partition 2. On the Smarc EVKs the SD card slot is shared with eMMC, so environment variables cannot be loaded / saved.

Use SD card for u-boot environment variables

It is possible to configure u-boot to use the SD card also as env variable storage device. We can take advantage of the spare space between the end of FIP and first partition:

sd boot env variables.png


To do that it is sufficient to modify the u-boot configuration:

./build.sh u menuconfig

Navigate to "Environment --->" and change:

mmc partition number -> 0: there is only one physical partition on a sd card, so select it.

Environment size -> 0x10000: use 64K space for u-boot environment variables, i.e 128 sectors (512 bytes)

Environment offset -> 0xF0000: this is the offset starting from the base. We want to start from 2048 (first logical partition) - 128 (size) = 1920. 1920 * 512 = 983.040 = 0xF0000

sd boot env variables menuconfig.png

Exit and save, then rebuild both u-boot and TF-A and reprogram bl2 and fip binaries as documented in the previous section.

Fix qmake missing in BSP v1.1 and BSP v1.3

To created an SDK package that can build Qt applications, you use this command:

bitbake core-image-qt -c populate_sdk

However, there is an issue where when the Qt SDK is created, the qmake utility is not added to the SDK toolchain. This means you will not be able to build Qt user applications.

This can be fixed by editing the file:

  • rzg2l_bsp_v1.3/meta-rzg2/dynamic-layers/qt5-layer/images/core-image-qt.bb

and adding the following lines to the file:

inherit populate_sdk_qt5
TOOLCHAIN_HOST_TASK_append = " nativesdk-qtwayland-tools " 
FEATURE_PACKAGES_tools-sdk += " packagegroup-qt5-toolchain-target kernel-devsrc " 

This will be fixed for BSP v1.4

Fix Exit Code 134 Error in BSP v1.4

  • Sometimes when building, you will get a pseudo abort exit 134 error in Yocto.
  • The build will fail with the error message below.
ERROR: Task (virtual:multilib:lib32:/home/renesas/rzg2l_bsp_v1.4/build/../meta-rzg2/recipes-debian/glibc/glibc_debian.bb:do_package) failed with exit code '134'
ERROR: glibc-2.28-r0 do_package: Error executing a python function in exec_func_python() autogenerated:
  • We fix that by adding the Debian packages pseudo and attr to the BSP v1.4. Then, it will build correctly.
  • Please follow the instructions below download and apply addition patches to add debian pseudo and attr by entering the commands in a terminal at the base of your BSP v1.4.
$ cd meta-rzg2
$ wget https://raw.githubusercontent.com/seebe/rzg_stuff/master/boards/rzg2l_smarc/gecko91_for_bsp_v1.4/add-debian-pseudo-and-attr.patch
$ patch -p1 < add-debian-pseudo-and-attr.patch
$ cd ..
  • Simply restart your build and it should be OK.

RZG2L Cortex-M33 Multi-OS Package

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

Official RZG2L 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 RZG2L Cortex-M33 Multi-OS Package
  • Release Note for RZG2L Flexible Software Package PDF
  • RZG2L FSP Documentation V1.00 PDF

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

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

Information on how to Debug on the CM33 is here

US108 2D Barcode Scanner Carrier Board

Importing Orcad design files into Altium

SMARC board schematics and layout are provided in Orcad format only, .dns and .brd respectively. These files can be imported into Altium designer using this guide and/or this guide.