R-Car/Boards/S4SK-Proto

From eLinux.org
< R-Car
Revision as of 18:58, 14 December 2022 by RenesasJa (talk | contribs) (Build script)
Jump to: navigation, search

Introduction

This page is for the Starter Kit prototype board equipped with R-Car S4(ws1.1).
This board is not for sale and has limited users.
The mass production version is scheduled for 2023. Please look forward to it.

Hardware

Type name

Y-ASK-RCAR-S4

Picture

[Top view]

Top view

[Bottom view]

Bottom view

Hardware feature

  • Power connector for 5V input (incl. protection circuit)
  • LPDDR4X (4 GiB)
  • Boot device: QSPI (64 MiB)
  • UFS memory (128GB(Sumsung/SDINFDO4-128G))
  • uSD-card x1
  • Ethernet @TSN0 and TSN1: two PHYs for 2500BASE-T1 (88Q4364) with 2-wire automotive Ethernet connectors(Rosenberger/E6S20A-40MT5-x)
  • Ethernet PHY (100 Mbps) at G4MH
  • PCIe interfaces available on two OCuLink connectors (2 channels x 2 lanes)
  • Debug port DBG0 and DBG1
  • two CAN transceivers (4-pin headers)
  • one LIN transceiver (4-pin headers)
  • 3 LEDs/buttons

    AC Adapter

    AC adapter is not bundled with the board, please prepare it.
    Here is the AC adapter information that has been confirmed.

    Type Name Where to buy
    SMI36-5-V-P6 Click to buy from Digi-Key
    Click to buy from Mouser

    Debug Serial

    CN13
    Two serial ports are recognized. Please use the younger number.
    Baudrate
    921600

    Specification of DIP SW (SW3)

    DIP SW information
    SW Usage When on When off Description Default
    SW3-1 MD1 L H Boot device selection [0] On
    SW3-2 MD2 L H Boot device selection [1] On
    SW3-3 MD3 L H Boot device selection [2] Off
    SW3-4 MD4 L H Boot device selection [3] On
    SW3-5 MD5 L / enabled H / disabled Secure authorization Off
    SW3-6 MD6 L / ICU-MXB H / CR52 Master boot processor On
    SW3-7 -
    SW3-8 -
    MD[4:1] Pins – Selection of Boot Device (SW On = 0 / Off = 1)
    MD4 MD3 MD2 MD1 Selection of Boot Device
    0 1 0 0 Serial flash ROM boot at single read 40MHz using DMA
    1 1 1 1 SCIF Downloading mode
    MD6 Pin – Selection of Master Boot Processor (SW On = 0 / Off = 1)
    MD6 Selection of Master Boot Processor
    0 Booted through ICUMXA (Initial setting)
    1 Booted through Cortex-R52

    How to update the loader

    Write data information
    Filename Program Top Address Qspi Save Address Description
    bootparam_sa0.srec 0xEB200000 0x0000000 ICUMX IPL (boot parameter)
    icumx_loader.srec 0xEB210000 0x0040000 ICUMX IPL
    cert_header_sa9.srec 0xEB230000 0x0240000 ICUMX IPL (certification)
    dummy_fw.srec 0xEB240000 0x0280000 Dummy firmware (Instead of secure firmware)
    dummy_rtos.srec 0xE2100000 0x0500000 Dummy RTOS (Instead of CR main OS)
    ca55_loader.srec 0xE6300000 0x0480000
    dummy_g4mh_case0.srec 0x00000000 0x0900000 Dummy G4MH program image
    dummy_icumh_case1.srec 0x00500000 0x0380000 Dummy ICUMH program image
    bl31-s4sk-proto.srec 0x46400000 0x0E00000 Secure monitor
    tee-s4sk-proto.srec 0x44100000 0x0E80000 Tee OS
    u-boot-elf-s4sk-proto.srec 0x50000000 0x0F80000 U-Boot
    • If you do not have binaries, please contact the S4SK-Proto board provider.

    Windows user

    1. Connect the Windows PC to the SK4SK-Proto(CN13) with a USB serial cable
    2. baudrate : 921600
      
    3. SW3 : Set to SCIF Download(DL) mode
    4. SW3
      Default SCIF DL mode
      SW3.1 On Off
      SW3.2 On Off
      SW3.3 Off Off
      SW3.4 On Off
      SW3.5 Off Off
      SW3.6 On On
      SW3.7 Off Off
      SW3.8 Off Off
    5. Power ON (SW5)
    6.  SCIF Download mode (w/o verification) 
       (C) Renesas Electronics Corp. 
       -- Load Program to SystemRAM --------------- 
       please send !
      
    7. Execute TeraTerm macro "S4SK_nonCX_QSPI_BL31.ttl"
    8. Teta Term: Control -> Macro -> S4SK_nonCX_QSPI_BL31.ttl
      The following log is output:

       Flash writer for R-Car S4 Series Rev.0.9.0 May 25,2022
       > xls2
       ===== Qspi/HyperFlash writing Command =============
      
       (snip)
      
    9. Power OFF (SW5)
    10. SW3 : Set to default mode

    Linux user

    $ git clone  https://github.com/morimoto/renesas-bsp-rom-writer.git
    $ cd renesas-bsp-rom-writer
    $ WORK=`pwd`
    Please refer to the following file for the writing procedure.
    	${WORK}/README
    	${WORK}/board/s4sk-prototype/README
    	${WORK}/board/s4sk-prototype/linux/README
    

    SW environments

    Base environments
    Software Revision
    Yocto Project 3.1.11
    aarch64-poky-linux-gcc (GCC) 9.3
    Kernel Ver 5.10.41
    Userland 64/32bit 64
    U-Boot 2020.10
    Renesas Yocto BSP v5.12.0 (R-Car SDK v3.3.0)

    Host PC

    Ubuntu 20.04 LTS (64bit) is recommended as OS. 32bit version is not supported.

    Supported OS

    Linux

    How to build

    Installation of required tools and libraries

    Ubuntu is used as Linux Host PC since Yocto Project Quick Start specifies Ubuntu as one of the distributions. You need to install the required packages as follows.

    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
    build-essential chrpath socat cpio python3 python3-pip python3-pexpect \
    xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa \
    libsdl1.2-dev pylint3 xterm libarchive-zip-perl
    

    Build script

    1. Build script(build.sh)
      #!/bin/bash
      
      WORK=`pwd`/s4sk_proto
      META_RENESAS_COMMIT=b3745d99266782e38a9b627ba207537c180f43e3
      
      mkdir -p ${WORK}
      cd ${WORK}
      
      git clone git://git.yoctoproject.org/poky
      git clone git://git.openembedded.org/meta-openembedded
      git clone https://github.com/renesas-rcar/meta-renesas
      
      # Switch to proper branches/commits
      cd $WORK/poky
      git checkout -b tmp 74b22db6879b388d700f61e08cb3f239cf940d18
      cd $WORK/meta-openembedded
      git checkout -b tmp 814eec96c2a29172da57a425a3609f8b6fcc6afe
      cd $WORK/meta-renesas
      git checkout -b tmp ${META_RENESAS_COMMIT}
      
      cd $WORK
      source $WORK/poky/oe-init-build-env build
      cp $WORK/meta-renesas/meta-rcar-gateway/docs/sample/conf/s4sk-proto/poky-gcc/bsp/*.conf conf/
      
      bitbake rcar-image-gateway
      
    2. build
      ./build.sh
      
      If the build completes successfully, all the necessary files are generated in a following directory:
      ./s4sk_proto/build/tmp/deploy/images/s4sk-proto/
      

    Manual steps

    1. Create a directory and switch to it
      Warning! Yocto builds require a lot of disk space (up to 100 GB). Make sure you have got enough before starting the build.
      mkdir build
      cd build
      export WORK=`pwd`
      
    2. Clone basic Yocto layers:
      cd $WORK
      git clone git://git.yoctoproject.org/poky
      git clone git://git.openembedded.org/meta-openembedded
      git clone https://github.com/renesas-rcar/meta-renesas
      
    3. Switch to proper branches/commits
      cd $WORK/poky
      git checkout -b tmp 74b22db6879b388d700f61e08cb3f239cf940d18
      cd $WORK/meta-openembedded
      git checkout -b tmp 814eec96c2a29172da57a425a3609f8b6fcc6afe
      cd $WORK/meta-renesas
      git checkout -b tmp b3745d99266782e38a9b627ba207537c180f43e3
      
    4. Setup build environment
      cd $WORK
      source poky/oe-init-build-env $WORK/build
      
    5. Prepare default configuration files.
      cp $WORK/meta-renesas/meta-rcar-gateway/docs/sample/conf/s4sk-proto/poky-gcc/bsp/*.conf conf/ ./conf/
      cd $WORK/build
      
    6. Start the build
      bitbake rcar-image-gateway
      
    7. Building image can take up to a few hours depending on your host system performance.
      After the build has been completed successfully, you should see the output similar to:
      NOTE: Tasks Summary: Attempted 4956 tasks of which 5 didn't need to be rerun and all succeeded.
      
      and the command prompt should return.
    8. Bitbake has generated all the necessary files in ./tmp/deploy/images directory.
      You can verify its content:
      $ ls -1 `find ./tmp/deploy/images/s4sk-proto/  -maxdepth 1 -type l -print`
      ./tmp/deploy/images/s4sk-proto/Image
      ./tmp/deploy/images/s4sk-proto/Image-s4sk-proto.bin
      ./tmp/deploy/images/s4sk-proto/modules-s4sk-proto.tgz
      ./tmp/deploy/images/s4sk-proto/r8a779f0-s4sk-prototype-s4sk-proto.dtb
      ./tmp/deploy/images/s4sk-proto/r8a779f0-s4sk-prototype.dtb
      ./tmp/deploy/images/s4sk-proto/rcar-image-gateway-s4sk-proto.manifest
      ./tmp/deploy/images/s4sk-proto/rcar-image-gateway-s4sk-proto.tar.bz2
      ./tmp/deploy/images/s4sk-proto/rcar-image-gateway-s4sk-proto.testdata.json
      ./tmp/deploy/images/s4sk-proto/u-boot-elf-s4sk-proto.srec
      ./tmp/deploy/images/s4sk-proto/u-boot-elf.srec
      ./tmp/deploy/images/s4sk-proto/u-boot-initial-env
      ./tmp/deploy/images/s4sk-proto/u-boot-initial-env-s4sk-proto
      ./tmp/deploy/images/s4sk-proto/u-boot-s4sk-proto.bin
      ./tmp/deploy/images/s4sk-proto/u-boot.bin
      
      Image is a Kernel image, r8a779f0-s4sk-prototype.dtb is a blob file, rcar-image-gateway-s4sk-proto.tar.bz2 is the rootfs, modules-s4sk-proto.tgz is kernel modules.

    How to boot

    Loading kernel and rootfs via SD card

    This section describes steps that are necessary for preparing and booting from SD card.

    Preparing SD card

    WARNING! These steps will erase the SD card completely. In short, all files will be lost.
    In order to prepare you SD card, follow these instructions on host machine:

    1. Partion your SD card to set 1 partition and ID=83 (Linux)
      Make sure the SD card doesn't contain any important files.
      $ fdisk /dev/mmcblk0
      -> d
      -> n
      -> p
      -> 1
      -> t
      -> 83
      
    2. Format this partition to ext4
      $ mkfs.ext4 /dev/mmcblk0p1
      
    3. Mount this partition on your host to any directory and upack the rcar-image-gateway-s4sk-proto.tar.bz2 into mounted folder.
      $ mount /dev/mmcblk0p1 /mnt
      $ cd <your_yocto_build_directory>
      $ tar xfj build/tmp/deploy/images/s4sk-proto/rcar-image-gateway-s4sk-proto.tar.bz2  -C /mnt
      
      NOTE: probably you need to be a root user, hence use "sudo"

    Configure U-Boot to boot from SD card

    • Proper U-Boot command to boot from SD:
      # setenv bootargs 'console=ttySC0,921600 rw root=/dev/mmcblk0p1 rootwait'
      # ext4load mmc 0:1 0x48080000 /boot/Image
      # ext4load mmc 0:1 0x48000000 /boot/r8a779f0-s4sk-prototype.dtb
      # booti 0x48080000 - 0x48000000
      
    • Example of U-Boot environment variables:
      baudrate=921600
      bootargs=root=console=ttySC0,921600 rw root=/dev/mmcblk0p1 rootwait
      bootcmd=ext4load mmc 0:1 0x48080000 /boot/Image; ext4load mmc 0:1 0x48000000 /boot/r8a779f0-s4sk-prototype.dtb; booti 0x48080000 - 0x48000000
      bootdelay=2
      bootm_size=0x10000000
      fdtcontroladdr=bbf45160
      loadaddr=0x58000000
      platform=r8a779f0
      stderr=serial@e6540000
      stdin=serial@e6540000
      stdout=serial@e6540000
      

    How to test some capabilities

    CPU Hotplug

    Ex)
    root@s4sk-proto:~#  cat /sys/devices/system/cpu/online
    0-7
    root@s4sk-proto:~#                                     
    root@s4sk-proto:~# echo 0 > /sys/devices/system/cpu/cpu1/online
    [   83.276294] IRQ209: set affinity failed(-22).
    [   83.276416] CPU1: shutdown
    [   83.277352] psci: CPU1 killed (polled 0 ms)
    root@s4sk-proto:~# 
    root@s4sk-proto:~# cat /sys/devices/system/cpu/offline
    1
    root@s4sk-proto:~# 
    root@s4sk-proto:~#  echo 1 > /sys/devices/system/cpu/cpu1/online
    [  116.336034] Detected VIPT I-cache on CPU1
    [  116.336084] GICv3: raw_spin_lock_init for SGI
    [  116.336093] GICv3: CPU1: found redistributor 100 region 0:0x00000000f1080000
    [  116.336163] CPU1: Booted secondary processor 0x0000000100 [0x412fd050]
    root@s4sk-proto:~# cat /sys/devices/system/cpu/offline
    
    root@s4sk-proto:~#
    

    PCIe 0ch

    Environment:

    1) MZVPV512HDGL-0000
    2) U.2 to M.2 M-Key NVME SSD and PCIe
    3) Oculink to U.2 Cable
    4) SATA/IDE AC Adoperq(Japanese site)
    S4sk pcie nvme.jpg
    root@s4sk-proto:~# mount /dev/nvme0n1p1 /mnt/
    [   25.899108] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
    root@s4sk-proto:~# mount -t tmpfs -o size=400M tmpfs /tmp
    root@s4sk-proto:~# dd if=/dev/urandom of=/tmp/file bs=1M count=350
    350+0 records in
    350+0 records out
    367001600 bytes (367 MB, 350 MiB) copied, 4.94124 s, 74.3 MB/s
    root@s4sk-proto:~# cp /tmp/file /mnt/
    root@s4sk-proto:~# sync
    root@s4sk-proto:~# cmp /mnt/file /tmp/file
    root@s4sk-proto:~#
    

    QA site

    Please contact the S4SK Prototype board provider for the URL.

    Known issues & Restrictions

    1. [SW restriction] PCIe ch1(CN31): doesn't support yet
    2. [SW restriction] Ethernet TSN(CN14, 17) : doesn't support yet
    3. UFS: doesn't support yet
    4. Thermal : doesn't support yet
    5. [Known issue] Bitbake error messages when building SDK first time
      ERROR: When reparsing  <build directory>../poky/meta/recipes-core/meta/meta-environment.bb:do_generate_content, the basehash value changed from c498a7b1837b356d8c9f0ca2507a80c9bdd3ae9096919f0ed50942fca91d7965 to e0d701347e83f6723e7525070147bcf143886e5896a3c2dc49c1c17086844261. The metadata is not deterministic and this needs to be fixed.
      ERROR: The following commands may help:
      ERROR: $ bitbake meta-environment-s4sk-proto -cdo_generate_content -Snone
      ERROR: Then:
      ERROR: $ bitbake meta-environment-s4sk-proto -cdo_generate_content -Sprintdiff
      
      These error message are Poky 3.1.11 bug, it doesn't affect to build output.
      Ignore error messages.