Difference between revisions of "Template:R-Car-Gen3-CPLD-Flash-IPL"

From eLinux.org
Jump to: navigation, search
 
(No difference)

Latest revision as of 22:07, 28 September 2020


This block is not included when this template is used.
How to use this template

=== Section Name ===
{{Template:R-Car-Gen3-CPLD-Flash-IPL}}


By using CPLD and Flash Writer, it is enabled to flash IPLs(firmware) without changing any switch(SW1/SW6) on R-Car Gen3 Starter Kit.
There are two steps to prepare to write IPLs.
First, reboot R-Car Gen3 Starter Kit in "SCIF Download Mode" via CPLD.
Then, send Flash Writer binary to the board.
After launching Flash Writer, it is possible to write IPLs by using xls2 command.

  • Initial SW1/6 status
    • SW1: ON
    • SW6[all]: ON
How to reboot in "SCIF Download Mode" via CPLD

There are two ways to reboot in "SCIF Download Mode" via CPLD.
It is enough to execute one of the following.

  1. Using U-boot
    => cpld write 0x00 0x802181fe 
    => cpld write 0x80 0x01
    
  2. Using cpld-control
    1. Build cpld-control for Host PC
      $ sudo apt install libftdi-dev
      $ make
      
    2. execute following script.
      #!/bin/bash
      DEV_NAME="/dev/ttyUSB0"
      USB_NAME=$( dmesg | grep "attached to ${DEV_NAME##*/}" | tail -1 | grep -oP "(?<=usb )[^:]+" )
      SERIAL_NAME=$( dmesg | grep -oP "(?<=usb $USB_NAME: SerialNumber: ).*" | tail -1 )
      USB_NAME+=":"$( dmesg | grep -oP "(?<=ftdi_sio $USB_NAME:)[^:]+" | tail -1 )
      
      if [[ "$(id -u)" != "0" ]]; then
          echo Please run as root!
          exit 1
      fi
      
      # enter SCIF Download Mode
      stty -F $DEV_NAME 115200
      ./cpld-control -w $SERIAL_NAME 0x00 0x802181FE # For aarch32 flash writer 
      # ./cpld-control -w $SERIAL_NAME 0x00 0x8021813E # For aarch64 flash writer
      ./cpld-control -w $SERIAL_NAME 0x80 0x01
      echo "$USB_NAME" > /sys/bus/usb/drivers/ftdi_sio/bind
      
      exit
      
      Note: Even if reboot in "SCIF Download mode" is succeeded, there is no output on terminal(Ex. minicom).
How to boot Flash Writer
  1. Build Flash Writer
    $ make AArch=32 clean
    $ CROSS_COMPILE=~/gcc-linaro-7.3.1-2018.05-x86_64_arm-eabi/bin/arm-eabi- make AArch=32 BOARD=ULCB
    
    Note: build option "BOARD=ULCB" and "AArch=32" are required.
    Note: Specific cross compiler is also required(https://github.com/renesas-rcar/flash_writer/blob/rcar_gen3/docs/application-note.md#41-prepare-the-compiler).
  2. Send Flash Writer to the board
    ex) Using minicom
    Type "ctrl+A S" and select upload method "ascii", then choose file for uploading "AArch32_Flash_writer_SCIF_DUMMY_CERT_E6300400_ULCB.mot", after upload finished press any key.
    Then, message like below is shown in terminal
    > Flash writer for R-Car H3/M3/M3N Series Vx.xx <Date>
    
How to flash IPLs

Please refer to the following pages:

After flashing IPLs , please reboot the board by SW8 to reset CPLD register.