R-Car/Boards/ADAS-View-Solution-Kit-legacy

From eLinux.org
< R-Car
Revision as of 00:06, 22 August 2017 by Cogente (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

This is the official Wiki for Renesas R-Car ADAS View Solution Kit.


Refer to R-Car Starter Kit Pro page
Refer to R-Car Starter Kit Premier page

Where to buy

TBD

ADAS View Solution Kit Documentation

TBD

System with LVDS cameras

TBD

Quick Start

Build image

NOTE: you can refer to http://elinux.org/R-Car/Boards/ADAS-View-Solution-Kit-legacy#Build_scripts_example section and just use script.

First please visit R-Car Yocto Gen3 legacy and perform necessary preparation steps 1-12. Then:

  1. Clone demo layer to allow support of ADAS applications
    git clone https://github.com/CogentEmbedded/meta-renesas-quick-start.git -b bsp_v212
    
  2. Add necessary layers to $WORK/build/conf/bblayers.conf
    ${TOPDIR}/../meta-openembedded/meta-networking \
    ${TOPDIR}/../meta-openembedded/meta-python \
    ${TOPDIR}/../meta-openembedded/meta-multimedia \
    ${TOPDIR}/../meta-renesas-quick-start \
    
  3. Add necessary features to $WORK/build/conf/local.conf
    DISTRO_FEATURES_append = " surroundview "
    DISTRO_FEATURES_append = " opencv-sdk "
    DISTRO_FEATURES_append = " wayland"
    DISTRO_FEATURES_append = " ipv6 ipv4 opengl i2c dbus alsa"
    DISTRO_FEATURES_remove = "x11"
    BBMASK .= "|.meta-renesas/meta-rcar-gen3/recipes-graphics/cogl"
    OE_TERMINAL="screen"
    IMAGE_INSTALL_remove = "gtk+3-demo clutter-1.0-examples"
    
  4. Build and install image as it's described in [1] steps 13-16.
    bitbake core-image-weston
    

After all these steps you can start working with boards and apps.

Build SDK

After building image run this command to build SDK

bitbake core-image-weston -c populate_sdk

After build success the SDK installation script must appears in ./tmp/deploy/sdk directory:

 tmp/deploy/sdk/poky-glibc-x86_64-core-image-weston-aarch64-toolchain-2.0.2.sh

To install SDK run this command and follow instructions on the screen:

./tmp/deploy/sdk/poky-glibc-x86_64-core-image-weston-aarch64-toolchain-2.0.2.sh

Build scripts example

#!/bin/sh

mkdir build || exit
cd build
WORK=`pwd`
echo $WORK

# <h3ulcb|m3ulcb|salvator-x|ttardrive>
BOARD=h3ulcb

git clone git://git.yoctoproject.org/poky
git clone git://git.linaro.org/openembedded/meta-linaro.git
git clone git://git.openembedded.org/meta-openembedded
git clone git://github.com/CogentEmbedded/meta-rcar.git meta-renesas -b v2.12.0
git clone git://github.com/CogentEmbedded/meta-renesas-quick-start.git meta-renesas-quick-start -b bsp_v212

cd $WORK/poky
git checkout -b tmp 40376446904ae3529be41737fed9a0b650ed167d
cd $WORK/meta-linaro
git checkout -b tmp 9b1fd178309544dff1f7453e796a9437125bc0d9
cd $WORK/meta-openembedded
git checkout -b tmp 8ab04afbffb4bc5184cfe0655049de6f44269990

cd $WORK/meta-renesas
export PATCH_DIR=meta-rcar-gen3/docs/sample/patch/patch-for-linaro-gcc
patch -p1 < ${PATCH_DIR}/0001-rcar-gen3-add-readme-for-building-with-Linaro-Gcc.patch
unset PATCH_DIR

cd $WORK/
PKGS_DIR=$WORK/../proprietary
cd $WORK/meta-renesas
#sh meta-rcar-gen3/docs/sample/copyscript/copy_proprietary_softwares.sh -f $PKGS_DIR
sh meta-rcar-gen3/docs/sample/copyscript/copy_evaproprietary_softwares.sh -f $PKGS_DIR

cd $WORK/

source poky/oe-init-build-env

cp $WORK/meta-renesas/meta-rcar-gen3/docs/sample/conf/$BOARD/linaro-gcc/mmp/*.conf ./conf/.

cd $WORK/build
cp conf/local-wayland.conf conf/local.conf
echo "DISTRO_FEATURES_append = \" use_eva_pkg\"" >> $WORK/build/conf/local.conf
echo "DISTRO_FEATURES_append = \" surroundview\"" >> $WORK/build/conf/local.conf
echo "DISTRO_FEATURES_append = \" opencv-sdk\"" >> $WORK/build/conf/local.conf
echo "DISTRO_FEATURES_append = \" wayland\"" >> $WORK/build/conf/local.conf
echo "DISTRO_FEATURES_append = \" ipv6 ipv4 opengl i2c dbus alsa\"" >> $WORK/build/conf/local.conf
echo "DISTRO_FEATURES_remove = \"x11\"" >> $WORK/build/conf/local.conf
echo "BBMASK .= \"|.meta-renesas/meta-rcar-gen3/recipes-graphics/cogl\"" >> $WORK/build/conf/local.conf
echo "OE_TERMINAL=\"screen\"" >> $WORK/build/conf/local.conf
echo "IMAGE_INSTALL_remove = \"gtk+3-demo clutter-1.0-examples\"" >> $WORK/build/conf/local.conf

bitbake-layers add-layer ../meta-openembedded/meta-networking
bitbake-layers add-layer ../meta-openembedded/meta-python
bitbake-layers add-layer ../meta-openembedded/meta-multimedia
bitbake-layers add-layer ../meta-renesas-quick-start

bitbake core-image-weston
bitbake core-image-weston -c populate_sdk

Flashing firmware

In case you have absolutely new R-Car H3 or M3 board, you need to update firmware. Please refer to page R-Car H3SK or R-Car M3SK for the instructions on flashing firmware.

U-Boot Environment

For using view board you need to use *-view.dtb file. The example of setting U-Boot environment for booting from SD card:

# In U-Boot prompt
setenv bootargs 'root=/dev/mmcblk1p1 rootwait consoleblank=0 log_buf_len=1M'
setenv bootcmd 'ext4load mmc 0 48080000 /boot/Image; ext4load mmc 0 48000000 /boot/r8a7795-h3ulcb-view.dtb; booti 48080000 - 48000000'
saveenv

ADAS test applications

SurroundView GPU version

  1. Clone and build sv-utest application (see the README.md file as well):
    git clone https://github.com/CogentEmbedded/sv-utest.git
    cd sv-utest
    . <SDK_INSTALL_PATH>/environment-setup-aarch64-poky-linux 
    mkdir build
    cd build
    cmake -DSV_TARGET_PLATFORM=GEN3 ../
    make
    
  2. Copy the resulted binaries on rootfs. As example, for SD card:
    mkdir <mountpoint>/home/root/sv
    sudo cp sv-utest/bin/sv-utest <mountpoint>/usr/bin/
    sudo cp sv-utest/libs/gen3/libsv.so <mountpoint>/usr/lib/
    sudo cp -r sv-utest/resources/* <mountpoint>/home/root/sv/
    
  3. See the manual for instructions R-Car Surround View manual on how to run and use SurroundView application. In short:
    cd /home/root/sv
    sv-utest -v /dev/video0,/dev/video1,/dev/video2,/dev/video3 
    
  4. By default 1280x800 resolution is used for cameras, but you can change it with --camres option:
    sv-utest -v /dev/video0,/dev/video1,/dev/video2,/dev/video3 --camres 1280x1080
    

SurroundView IMR version

  1. Save mesh object file from the GPU SurroundView: after calibration and sphere adjusting are done, press S, then "=" on the main 3d view to save mesh file. Mesh object file name is "meshFull.obj" in the current working directory of SurroundView.
  2. Clone and build imr-sv-utest application (see the README.md file as well):
    git clone https://github.com/CogentEmbedded/imr-sv-utest.git
    cd imr-sv-utest
    . <SDK_INSTALL_PATH>/environment-setup-aarch64-poky-linux 
    mkdir build
    cd build
    cmake -DIMR_TARGET_PLATFORM=GEN3 ../
    make
    

    IMR SuroundView executable stored ../bin directory.

  3. It's need to generate png files with car model images before running IMR SurroundView. Copy executable "gen" from "prebuilt/GEN3" directory to the H3 board. Example of generation png files with car (available only for Gen3):
    ./gen -w <width> -h <height> -c <color> -o <path to store> -s <positions> -m <car object> \
    -l <car length> -S <shadow rectangle> -d <debug>
    ./gen -w 1920 -h 1080  -c 0x404040FF -o ./data/model -s 8:32:8 -m Car.obj -l 1.0  -S -0.2:-0.10:0.2:0.10
    
  4. Run the IMR SurroundView with the generated png files: For 4-cameras environment:
    ./imr-wl -f uyvy -v /dev/video0,/dev/video1,/dev/video2,/dev/video3 -w 1280 -h 800 -W 1920 -H 1080 \
    	-r /dev/video4,/dev/video5,/dev/video6,/dev/video7,/dev/video4,/dev/video5,/dev/video6,/dev/video7 -m ./data/model \
           -M meshFull.obj -X 1920 -Y 1080 -S -0.30:-0.10:0.30:0.10 -g 1.0 -s 8:32:8
    

    For 8-cameras environment:

    ./imr-wl -f uyvy -v /dev/video0,/dev/video1,/dev/video2,/dev/video3 -w 1280 -h 800 -W 1920 -H 1080 \
    	-r /dev/video8,/dev/video9,/dev/video10,/dev/video11,/dev/video8,/dev/video9,/dev/video10,/dev/video11 -m ./data/model \
           -M meshFull.obj -X 1920 -Y 1080 -S -0.30:-0.10:0.30:0.10 -g 1.0 -s 8:32:8
    

    Run "./imr-wl -h" for options explanation.

8 Camera Demo (GPU + IMR version)

Demo application demonstrates surround view with pre-defined viewpoints on Renesas boards with 4 additional cameras for mirror replacement purposes. First additional camera works as driver monitor.

  1. Save mesh object file from the GPU SurroundView: after calibration and sphere adjusting are done, press S, then "=" on the main 3d view to save mesh file. Mesh object file name is "meshFull.obj" in the current working directory of SurroundView.
  2. Clone and build 8-cam-imr-gpu-sv-utest application (see the README.md file as well):
    git clone https://github.com/CogentEmbedded/8-cam-imr-gpu-sv-utest.git
    cd 8-cam-imr-gpu-sv-utest
    . <SDK_INSTALL_PATH>/environment-setup-aarch64-poky-linux 
    mkdir build
    cd build
    cmake ../
    make
    

    Demo executable "sc" stored ../bin directory.

  3. It's need to generate png files with car model images before running IMR SurroundView. Copy executable "gen" from "prebuilt/" directory to the H3 board. Example of generation png files with car (available only for Gen3):
    ./gen -w <width> -h <height> -c <color> -o <path to store> -s <positions> -m <car object> \
    -l <car length> -S <shadow rectangle> -d <debug>
    ./gen -w 1920 -h 1080  -c 0x404040FF -o ./data/model -s 8:32:8 -m Car.obj -l 1.0  -S -0.2:-0.10:0.2:0.10
    
  4. Copy resources files to directory where application will be runned from "resources/". Copy libdrivermonitor.so and libsv.so from "lib/" directory to rootfs. Copy "resources/adas-utest" directory to /usr/share on rootfs.
  5. Run the application:
    ./sc -W 1920 -H 1080 -m ./data/model -M meshFull.obj -X 1920 -Y 1080 -g 1.0 -b 0x000000 -c config.txt -S -0.20:-0.1:0.20:0.1 -s 8:32:8
    
  6. To control application with SpaceNav start SpaceNav daemon: spacenavd command. There are 5 widgets on the main screen: main 3d SurroundView screen, DriverMonitor camera, right, left and rear mirror replacement cameras. To change focus on widget press right button on SpaceNav. To change zoom and view on mirror replacement cameras rotate SpaceNav joystick, when widget is in focus. To hide Driver Monitor camera and mirror cameras press and hold left button on joystick, when widget is in focus. To switch to IMR demo press left button on SpaceNav joystick, when main 3d SurroundView in focus. To get back from IMR demo press left button again. To rotate view in IMR demo use joystick or touchscreen.

Camera low level tests

It is possible to run low level tests to validate LVDS cameras.
The test application name is 'capture'. The 'capture' is provided in sources and build within yocto.

  1. The test examples are located on rootfs path:
    $ ls -1 /usr/share/tests/
    test_lvds_2cameras_on_display1920x1080.sh
    test_lvds_4cameras_on_display1920x1080.sh
    test_lvds_8cameras_on_display1920x1080.sh
    test_lvds_camera_0-3.sh
    test_lvds_camera_0.sh
    test_lvds_camera_4-7.sh
    test_lvds_camera_4.sh
    

Build with Qt5

  1. Clone meta-qt5 repository:
    git clone git://github.com/CogentEmbedded/meta-qt5.git meta-qt5 -b r-car-gen3
    
  2. Add cloned layer to $WORK/build/conf/bblayers.conf
      ${TOPDIR}/../meta-qt5 \
    
  3. Enable build with Qt5 in $WORK/build/conf/local.conf
    DISTRO_FEATURES_append = " qt5 "
    
  4. Start build process of target image and Qt5 toolchain:
    bitbake core-image-weston
    bitbake meta-toolchain-qt5
    
  5. The Qt5 toolchain will be avalaible here:
    ./tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-qt5-aarch64-toolchain-2.0.2.sh