Table of Contents:

Requirements

You should have at least:

  • 1 supported R-car board
  • 1 suitable Power adaptor
  • 1 USB to micro-usb cable
  • ATF /optee setup on the board and booting from the A57 CPU (See the documentation on how to set this up)

You need to provide your own:

  • 1 microSD card. At least 4GB for fixedfunction image and 15GB for HMI image.

Prepare SD card

  • Download the arm64 fixedfunction image, plus the .bmap file. microSD card using command:

    sudo bmaptool copy apertis_v2023-fixedfunction-arm64-uboot_v2023.2.img.gz /dev/mmcblk0
    

    Alternatively bmaptool can flash directly from http e.g. by using:

    sudo bmaptool copy https://images.apertis.org/release/v2023/v2023.2/arm64/fixedfunction/apertis_v2023-fixedfunction-arm64-uboot_v2023.2.img.gz /dev/mmcblk0
    
  • Put the SD card in the board

Setup instructions

The 64 bit Apertis images use the Generic Distro Configuration Concept from u-boot. Unfortunately this is not currently supported by the standard Renesas u-boot, as such at least u-boot needs to be updated.

Updating U-Boot

R-Car boards are shipped with different IPL/DRAM setup versions (part of the arm-trusted-firmware Renesas repository) depending on the time of productions. Apertis doesn’t currently supply builds for those components (hence the requirement to already have that setup). The following instructions assume an IPL and Secure monitor revision newer than 1.0.10

To flash u-boot, first determine if the current revision is new enough; The output show below is revision 1.0.12 on a StarterKit Pro:

NOTICE:  BL2: R-Car Gen3 Initial Program Loader(CA57) Rev.1.0.12
NOTICE:  BL2: PRR is R-Car M3 ES1.0
NOTICE:  BL2: Boot device is HyperFlash(80MHz)
NOTICE:  BL2: LCM state is CM
NOTICE:  BL2: AVS setting succeeded. DVFS_SetVID=0x52
NOTICE:  BL2: DDR3200(rev.0.20)[COLD_BOOT]..0
NOTICE:  BL2: DRAM Split is OFF
NOTICE:  BL2: QoS is default setting(rev.0.16)
NOTICE:  BL2: v1.3(release):a80bbf3
NOTICE:  BL2: Built : 22:16:12, Mar 30 2017
NOTICE:  BL2: Normal boot
NOTICE:  BL2: dst=0xe6316190 src=0x8180000 len=512(0x200)
NOTICE:  BL2: dst=0x43f00000 src=0x8180400 len=6144(0x1800)
NOTICE:  BL2: dst=0x44000000 src=0x81c0000 len=65536(0x10000)
NOTICE:  BL2: dst=0x44100000 src=0x8200000 len=524288(0x80000)
NOTICE:  BL2: dst=0x50000000 src=0x8640000 len=1048576(0x100000)

U-boot binaries to flash can be found on the images site. The following table shows the file to get for the various types of boards:

Hardware u-boot path
R-car Starter Kit Pro (M3) r8a7796_ulcb/u-boot-elf.srec
R-car Starter Kit Premier (H3) r8a7795_ulcb/u-boot-elf.srec
R-car Starter Kit Premier (H3e)* rcar3_ulcb/u-boot-elf.srec
R-car Salvator-X H3 r8a7795_salvator-x/u-boot-elf.srec
R-car Salvator-X M3 r8a7796_salvator-x/u-boot-elf.srec

*: The H3e board here is the RTP8J779M1ASKB0SK0SA003.

To flash first configure the dip switches on the board to boot into the monitor. The exact configuration depends on the board and can be found in the setup manual. For reference for the board available to us this is:

Hardware Jumper Settings
Starter Kit Pro SW1=OFF, SW6[1]=OFF, SW6[2]=OFF, SW6[3]=OFF, SW6[4]=ON, JP1 -> 1-2 short
Starter Kit Premier SW1=OFF, SW6[1]=ON, SW6[2]=ON, SW6[3]=OFF, SW6[4]=ON
Salvator-X H3 SW1=ON, SW2=ON, SW3=OFF, SW13=PIN1, SW10[5]=ON, SW10[6]=OFF,SW10[7]=ON, SW10[8]=ON

After changing these settings, connect to the serial console (using e.g. minicom), power on the board (note: some boards have a power button that must be pressed) and the mini loader should come up.

  1. execute xls2 on the board to put into receiving mode
  2. Choose 3 (hyperflash)
  3. Configure the switches as suggested by the monitor and input y
    1. On the Starter Kit Premier, the reference page mentions to change SW1=ON, SW6[1]=OFF, SW6[3]=ON.
  4. Input the memory destination address: 50000000
  5. Input the flash address: 640000
  6. Upload the u-boot.srec using ascii style tranfer (ctrl+A S in minicom)
  7. After upload indicate ok to clear: y

Afterwards ensure that the board is configured to boot from hyperflash and reset the board. To do this on the boards currently available to us:

Hardware Jumper Settings
Starter Kit Pro SW6[ALL]=ON
Starter Kit Premier SW6[ALL]=ON (this enables DDR3200)
Salvator-X H3 SW10[5]=ON, SW10[6]=ON, SW10[7]=OFF, SW10[8]=OFF

It is recommended to reset the U-Boot environment after flashing new version of bootloader. Stop in U-Boot prompt and execute commands:

env default -a
saveenv

After reset the board should now boot Apertis from SD card automatically.

Flashing ATF on the R-Car Starter Kit Premier

To support the RTP8J779M1ASKB0SK0SA003 version of the Starter Kit, ATF is built for Apertis but, like u-boot, cannot be installed automatically.

To have linux accept the reserved-memory regions set by ATF, a newer version of ATF needs to be flashed on the board.

Since apertis/v2024dev1, the arm-trusted-firmware package contains the bl31 and bl2 binaries for the Renesas UCLB boards.

The same procedure as u-boot is used to flash those 2 binaries but the addresses are different:

File Memory destination address Flash address
bl2.srec E6304000 040000
bl31.srec 44000000 1C0000

Only BL2 is mandatory to update but it is recommended to update both firmware so that they have the same version.

Flashing image to eMMC

SD cards can be slow to use. Given all Renesas board have a nice eMMC on board it makes sense to use that instead the simplest way to do that is to use an apertis image installed on SD card.

  1. Enable development mode by running apertis-dev
  2. Install the bmap-tools package apt install bmap-tools
  3. If not flashing directly from http download the intended Image to SD card
  4. Flash image to emmc (typically /dev/mmcblk1): bmaptool copy /dev/mmcblk1
  5. Remove the SD card (u-boot will prefer booting removable media), and restart the board

Setting up a R-car device for LAVA

For test automation it is required that a boards can be automatically powered on and off, for most boards this is done by simply cutting the power supply. However for Renesas boards it is strongly recommended not to do this. As such a different solution is needed.

Luckily for both Salvator-X and Starter Kit boards there are connectors exposed which allow remote on/off. Both accept 3.3v which means e.g. gpio’s on a raspberry pi can be used for control.

R-car Salvator X

Connector: SAMTEC QTE-040-03-L-D-A available from Farnell: http://nl.farnell.com/samtec/qte-040-03-l-d-a/header-dual-80way/dp/1667888

The Salvator-X board as an EX_PWRon line on the EXIO Connector D on the bottom of the board available, which internally connects to a FET which can force the board to be off if the board if the EX_PWRon line is forced to high.

For control add the GPIO line to pin 68 of the connector and a ground connection to pin 58 of the connector, once hooking up the ground and a gpio in the raspberry pi the board can be forced off/in reset (similar to the action of the physical switch) by turing the GPIO high and to come back on by setting the gpio to low.

R-car Starter Kit

Connector: EPT 402-51501-51 Stacking Board Connector available from Farnell: http://nl.farnell.com/ept/402-51501-51/conn-stacking-rcpt-440pos-0-5mm/dp/2474236

The Starter kit is even more tricky, by default it will not turn on on power on only after pressing the reset button. To automate control, as explained in section 3.18 of the Hardware Manual. The reset mode pin (A18 on the CoM Express connector) should be clamped low (e.g. connector to ground, pin A21 is conveniently close). Once that’s done Pin A15 (EX_PWRon) can be used to control the boards power state (high is on, low is off).

Alternative method

There is an alternative method to boot the Starter Kit without using the COM port.

An unpopulated resistor pins can be soldered together to change the RSTBMODE of the PMIC so that it boots when the power supply is connected. More details here.

This has been tested on both the R-car Starter Kit and R-car Starter Kit Premier.

The picture is not super clear so here is a clearer one from the R-car Starter Kit Premier:

References

Known issues

  • In case if the boot has stopped after loading the kernel, initramfs and dtb with string Starting kernel ...

    Check the values of kernel_addr_r and ramdisk_addr_r – there should be enough space to load the kernel.

    Probably you need to increase ramdisk_addr_r value to avoid overlapping of the kernel in memory. For example:

    kernel_addr_r=0x48080000
    ramdisk_addr_r=0x4A000000