R-Car/Boards/S4SK-Proto

From eLinux.org
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

    Note

    Heat sink and FAN : Tighten all 8 screws on the top of the acrylic board to prevent high temperatures.


    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

    PCIe

    CH0(CN30)
    Root Complex
    CH1(CN31)
    Endpoint

    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.18.0 (R-Car SDK v3.9.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)
      2022/12/27 updated
      #!/bin/bash
      
      WORK=`pwd`/s4sk_proto
      META_RENESAS_COMMIT=a634d930d30af39eec68c9fc82ce113c74775c25
      
      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

    2022/12/27 updated

    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 a634d930d30af39eec68c9fc82ce113c74775c25
      
    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.

    Build SDK

    • After building BSP you may build SDK:
      bitbake rcar-image-gateway -c populate_sdk
      
    • After build finished the SDK installation script may be found in following path:
      tmp/deploy/sdk/poky-glibc-x86_64-rcarimage-gateway-aarch64-spider-toolchain-3.1.11.sh
      
    • Install SDK by run the following command and follow instructions on the screen:
      sudo ./poky-glibc-x86_64-rcar-image-gateway-aarch64-spider-toolchain-3.1.11.sh
      

    Note: Please see the Known issues & Restrictions chapter.

    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 cma=560M'
      # 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 cma=560M
      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

    Thermal

    root@s4sk-proto:~# cat /sys/class/thermal/thermal_zone*/temp
    31500
    31000
    31000
    root@s4sk-proto:~#
    

    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:~#
    

    UFS

    After starting the Linux, from the start log, there are some messages are showed,

    Well-known LUN    WDC      SDINFEO4-128G    1428 PQ: 0 ANSI: 6
    UFS dev info: WDC      SDINFEO4-128G    rev 1428
    

    Create partition

    root@s4sk-proto:~# fdisk -u /dev/sda
    Command (m for help): enter “o”
    Command (m for help): enter “n”
    Select (default p): enter “p”
    Partition number (1-4, default 1): enter “1”
    First sector (256-31246335): press enter key
    Last sector, +/-sectors or +/-size{K,M,G,T,P} (256-31246335, default 31246335):press enter key
    press enter key
    Command (m for help): enter “w”
    
    sda: sda1
    

    Format partition

    root@s4sk-proto:~# mkfs -t ext4 /dev/sda1
    

    Read/Write

    Ex)
    root@s4sk-proto:~# mount /dev/sda1 /mnt/
    [ 1045.920790] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
    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.95581 s, 74.1 MB/s
    root@s4sk-proto:~# cp /tmp/file /mnt/
    root@s4sk-proto:~# sync
    root@s4sk-proto:~# cmp /tmp/file /mnt/file
    root@s4sk-proto:~#
    

    PCIe Root Complex(CN30) : SSD

    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:~#
    

    pcitest [S4SK - Another S4 SK]

    Environments

    <S4 SK Prototype board : PCIe CH0(CN30)[*1]> <--- OCuLink cable[*2] ---> Another <S4 SK Prototype board : PCIe CH1(CN31)[*3]>
    [*1] PCIe CH0(CN30) : Root Complex
    [*2] Ex) https://store.supermicro.com/supermicro-55cm-oculink-to-oculink-cable-cbl-sast-0818.html
    [*3] PCIe CH1(CN31) : Endpoint

    Create DTB file for Endpoint

    Disable: Root Complex of PCIe CH0
    Enable : Endpoint of PCIe CH1
    Ex)
    $ cd (Your SDK Build directory)
    $ ls
    build  meta-openembedded  meta-renesas  poky
    $ source poky/oe-init-build-env build/
    $ bitbake -c devshell linux-renesas
    $ vi arch/arm64/boot/dts/renesas/r8a779f0-s4sk-prototype.dts
      (snip)
      &pciec0 {
            status = "disabled";                <-- Change to disable !!!
            pinctrl-0 = <&pcie0_pins>;
            pinctrl-names = "default";
            clkreq-gpios = <&gpio2 15 GPIO_ACTIVE_LOW>;
      };
      (snip)
      &pciec1_ep {
            status = "okay";                  <-- Change to enable !!!
            pinctrl-0 = <&pcie1_pins>;
            pinctrl-names = "default";
            clkreq-gpios = <&gpio2 16 GPIO_ACTIVE_LOW>;
      };
    $ make dtbs
    $ exit
    

    Output: build/tmp/work/s4sk_proto-poky-linux/linux-renesas/5.10.41+xxxx/linux-s4sk_proto-standard-build/arch/arm64/boot/dts/renesas/r8a779f0-s4sk-prototype.dtb

    Copy r8a779f0-s4sk-prototype.dtb to SD card for Endpoint as r8a779f0-s4sk-prototype_pcie1ep.dtb
    Ex)
    $ mount /dev/mmcblk0p1 /mnt
    $ cp r8a779f0-s4sk-prototype.dtb /mnt/boot/r8a779f0-s4sk-prototype_pcie1ep.dtb
    $ ls /mnt/boot
    Image  Image-5.10.41-yocto-standard  r8a779f0-s4sk-prototype.dtb r8a779f0-s4sk-prototype_pcie1ep.dtb
    

    pcitest

    Step 1: Start S4 SK of Endpoint using r8a779f0-s4sk-prototype_pcie1ep.dtb
    => setenv bootargs console=ttySC0,921600 rw root=/dev/mmcblk0p1 rootwait cma=560M
    => ext4load mmc 0:1 0x48080000 /boot/Image;ext4load mmc 0:1 0x48000000 /boot/r8a779f0-s4sk-prototype_pcie1ep.dtb;booti 0x48080000 - 0x48000000
    (snip)
    s4sk-proto login: root
    root@s4sk-proto:~# sed -e 's/e65d0000.pciec0_ep/e65d8000.pciec1_ep/' ep_setup.sh  > ep1_setup.sh
    root@s4sk-proto:~# chmod +x ep1_setup.sh
    root@s4sk-proto:~# ./ep1_setup.sh
    Endpoint setup
    mount: /sys/kernel/config: none already mounted or mount point busy.
    completed.
    root@s4sk-proto:~#
    
    Step 2: Start S4 SK of Root Complex (after Step 1)
    => setenv bootargs console=ttySC0,921600 rw root=/dev/mmcblk0p1 rootwait cma=560M
    => ext4load mmc 0:1 0x48080000 /boot/Image;ext4load mmc 0:1 0x48000000 /boot/r8a779f0-s4sk-prototype.dtb;booti 0x48080000 - 0x48000000
    (snip)
    s4sk-proto login: root
    root@s4sk-proto:~# sed -e 's/1024000/102400/' -e 's/1024001/102401/' pcitest_script.sh  > pcitest_script_s4sk.sh
    root@s4sk-proto:~# chmod +x pcitest_script_s4sk.sh
    root@s4sk-proto:~# ./pcitest_script_s4sk.sh
    
    Log: Root Complex
    root@s4sk-proto:~# ./pcitest_script_s4sk.sh
    BAR tests
    
    BAR0:           OKAY
    BAR4:           OKAY
    
    MSI Interrupt tests
    
    SET IRQ TYPE TO MSI:            OKAY
    MSI1:           OKAY
    MSI2:           OKAY
    
    (snip)
    
    Copy Tests
    
    COPY (      1 bytes):           OKAY
    COPY (   1024 bytes):           OKAY
    COPY (   1025 bytes):           OKAY
    COPY ( 102400 bytes):           OKAY
    COPY ( 102401 bytes):           OKAY
    
    root@s4sk-proto:~#
    
    Log: Endpoint
    [   44.917496] WRITE => Size: 1 bytes    DMA: NO         Time: 0.000001320 seconds      Rate: 739 KB/s
    [   45.941519]
    [   45.941519] WRITE => Size: 1024 bytes         DMA: NO         Time: 0.000003060 seconds      Rate: 326797 KB/s
    
    (snip)
    
    [  642.777482] COPY => Size: 1 bytes     DMA: NO         Time: 0.000002160 seconds      Rate: 452 KB/s
    [  643.793517]
    [  643.793517] COPY => Size: 1024 bytes  DMA: NO         Time: 0.000060420 seconds      Rate: 16550 KB/s
    [  644.809523]
    [  644.809523] COPY => Size: 1025 bytes  DMA: NO         Time: 0.000061500 seconds      Rate: 16276 KB/s
    [  645.831665]
    [  645.831665] COPY => Size: 102400 bytes        DMA: NO         Time: 0.006186660 seconds      Rate: 16163 KB/s
    [  646.851668]
    [  646.851668] COPY => Size: 102401 bytes        DMA: NO         Time: 0.006195241 seconds      Rate: 16141 KB/s
    

    Ethernet TSN

    QA site

    Please contact the S4SK Prototype board provider for the URL.

    Known issues & Restrictions

    1. [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.