Skip to main content

R-Car Starter Kit Premier

Prerequisites

Hardware:

  • R-Car Starter Kit Premier.
  • MicroSD card (at least 16Gb size).
  • Card reader for MicroSD card.

Software:

  • Ubuntu 20.04 LTS (Other OS currently are not tested.)
  • picocom (can be installed with command)

Please execute the following command to install picocom if not installed yet.

sudo apt install picocom

Write U-Boot and IPL

This chapter describes how to flash the firmware on the target board. The files required for this chapter are in the yocto/build-domd/tmp/deploy/images/h3ulcb/firmware/ directory generated at build time. The instruction provided below is a slightly edited version of the original document.

STEP 1. Power off the target board.

Press SW8

STEP 2. Set SW and JP as below.

SW6 is located near microUSB connector. If the target board is positioned with microUSB connector on the top, then switches are numbered from top to down, and ON position is on the right side. To determine the version of the target board (ws.) please use https://elinux.org/R-Car/Boards/H3SK#H3SK_has_several_kinds_of_boards

SW1=OFF
ws1.0: SW6[all]=OFF
ws1.1/ws2.0/ws3.0: SW6[1]=ON, SW6[2]=ON, SW6[3]=OFF, SW6[4]=ON
JP1 -> 1-2 short

STEP 3. Power on target board.

Start terminal software on the Host PC as a console for the target board. Select the serial device connected to the target board. In this case, ttyUSB0 is used. You need to go to the yocto/build-domd/tmp/deploy/images/h3ulcb/firmware/ directory and run the picocom command.

$ picocom -b 115200 -d 8 -y n -p 1 -f n -s "ascii-xfr -sv" /dev/ttyUSB0
Press SW8

STEP 4. Change SW as follows:

SW1=ON
ws1.0: SW6[3]=ON
ws1.1: SW6[1]=OFF, SW6[3]=ON
ws2.0/ws3.0: SW6[3]=ON

STEP 5. Flash bootparam_sa0-4x2g.srec. In the console execute xls2 command (load program to hyper flash) and provide the following inputs:

3
yy
e6320000
0
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "bootparam_sa0-4x2g.srec" to upload.
y

STEP 6. Flash bl2-h3ulcb-4x2g.srec. In the console execute xls2 command (load program to hyper flash) and provide the following inputs.

3
yy
e6304000
40000
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "bl2-h3ulcb-4x2g.srec" to upload.
y

STEP 7. Flash cert_header_sa6-4x2g.srec. In the console execute xls2 command (load program to hyper flash) and provide the following inputs:

3
yy
e6320000
180000
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "cert_header_sa6-4x2g.srec" to upload.
y

STEP 8. Flash bl31-h3ulcb-4x2g.srec. In the console execute xls2 command (load program to hyper flash) and provide the following inputs:

3
yy
44000000
1C0000
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "bl31-h3ulcb-4x2g.srec" to upload.
y

STEP 9. Flash tee-h3ulcb.srec. In console execute xls2 command (load program to hyper flash) and provide the following inputs:

3
yy
44100000
200000
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "tee-h3ulcb.srec" to upload.
y

STEP 10. Flash u-boot-elf-h3ulcb.srec. In the console execute xls2 command (load program to hyper flash) and provide the following inputs:

3
yy
50000000
640000
After typing "ctrl+A ctrl+S" you will see "*** file:".
Enter the file name "u-boot-elf-h3ulcb.srec" to upload.
y

Write Aos image to MicroSD card

This chapter describes how to flash image to MicroSD card.

STEP 1. Insert MicroSD card in a card reader and find it in Host PC. Check the MicroSD card in Host PC. List disk devices before and after you plug card in.

$ sudo fdisk -l

Alongside other disks, you will find your MicroSD card, like in this example:

Disk /dev/sdf: 14,9 GiB, 15962472448 bytes, 31176704 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device Boot Start End Sectors Size Id Type
/dev/sdf1 * 2038 31176703 31174656 14,9G 7 HPFS/NTFS/exFAT

Here you can see MicroSD Card device is /dev/sdf.

STEP 2. Write image to MicroSD card. Write the full.img generated in "3.2.1 R-Car Starter Kit Premier" with the following command. Before writing, delete the partition on the SD card using fdisk.

$ sudo fdisk /dev/sdX
$ sudo dd if=full.img of=/dev/sdX bs=1M
$ sync

The process may take up to 20 min to finish depending on the speed of MicroSD card. Now your MicroSD card is ready, and you can plug it into R-Car Starter Kit Premier.

Set up u-boot environment to boot from MicroSD card

This chapter describes how to set the proper u-boot environment for the further boot of AosCore from MicroSD Card. Turn on or reset the target board.

Hit any key to stop autoboot:

Wait until you see a message in the terminal and press any key. If you have no properly set boot device, you will fall into u-boot command line without pressing a key. You should see the prompt of u-boot command line. Copy the following text and insert it into the terminal.

=>

Important note: It is strongly recommended to copy-paste text line by line, due to possible corruptions if whole block is copied. For example, copying whole block into picocom you can see following incorrect symbols .If you see corruptions, you need to reset board and start this chapter from start to avoid storing of incorrect variables.

setenvmmc0_initr}...ext2load mmc 0:1 0x7400000 /boot/uInitramfs

Also do not miss symbol ' at the end of some lines.

setenv bootargs
setenv loadaddr 0x58000000
setenv bootcmd_mmc0 'run mmc0_xen_load; run mmc0_dtb_load; run mmc0_kernel_load; run mmc0_xenpolicy_load;
run mmc0_initramfs_load; bootm 0x48080000 0x84000000 0x48000000'
setenv mmc0_dtb_load 'ext2load mmc 0:${aos_boot_slot} 0x48000000 xen.dtb; fdt addr 0x48000000; fdt resize;
fdt mknode / boot_dev; fdt set /boot_dev device mmcblk1'
setenv mmc0_initramfs_load 'ext2load mmc 0:${aos_boot_slot} 0x84000000 uInitramfs'
setenv mmc0_kernel_load 'ext2load mmc 0:${aos_boot_slot} 0x8a000000 Image'
setenv mmc0_xen_load 'ext2load mmc 0:${aos_boot_slot} 0x48080000 xen'
setenv mmc0_xenpolicy_load 'ext2load mmc 0:${aos_boot_slot} 0x8c000000 xenpolicy'
setenv aos_default_vars 'setenv aos_boot_main 0; setenv aos_boot1_ok 1; setenv aos_boot2_ok 1; setenv
aos_boot_part 0'
setenv aos_load_vars 'run aos_default_vars; if load mmc 0:3 ${loadaddr} uboot.env; then env import -t
${loadaddr} ${filesize}; else run aos_save_vars; fi'
setenv aos_save_vars 'env export -t ${loadaddr} aos_boot_main aos_boot_part aos_boot1_ok aos_boot2_ok;
fatwrite mmc 0:3 ${loadaddr} uboot.env 0x3E'
setenv aos_boot1 'if test ${aos_boot1_ok} -eq 1; then setenv aos_boot1_ok 0; setenv aos_boot2_ok 1; setenv
aos_boot_part 0; setenv aos_boot_slot 1; echo "==== Boot from part 1"; run aos_save_vars; run bootcmd_mmc0;
fi'
setenv aos_boot2 'if test ${aos_boot2_ok} -eq 1; then setenv aos_boot2_ok 0; setenv aos_boot1_ok 1; setenv
aos_boot_part 1; setenv aos_boot_slot 2; echo "==== Boot from part 2"; run aos_save_vars; run bootcmd_mmc0;
fi'
setenv bootcmd_aos 'run aos_load_vars; if test ${aos_boot_main} -eq 0; then run aos_boot1; run aos_boot2;
else run aos_boot2; run aos_boot1; fi'
setenv bootcmd 'run bootcmd_aos'

Check that variables are set as specified. Print all variables and inspect output. Pay attention that bootargs will be not printed as it is set to empty value.

=> print

Save variables persistently

=> saveenv

You can reset target board by pressing SW9 or typing reset in u-boot command line.

Press SW9

On successful boot you can proceed to provisioning procedure. Obtain the IP address of this target board, which is required for unit creation. Use the terminal connected to the target board. After the target board is booted, enter the following commands.

generic-armv8-xt-dom0 login: root

root@generic-armv8-xt-dom0:~# xl console DomD

h3ulcb-domd login: root

root@h3ulcb-domd:~# ifconfig
eth0
Link encap:Ethernet HWaddr 0E:2E:F4:1A:9A:7B
inet addr:192.168.2.119 Bcast:192.168.2.255 Mask:255.255.255.0

In this case, '192.168.2.119' is the IP address of the target board.

Provision your device.

To use the whole AosEdge functionality appropriate target system. Login to aoscloud.io as OEM. And create a target system with the name "h3ulcb-4x2g".

Target system

Use next Unit configuration:

{
"resources": [
{
"name": "vis",
"hosts": [
{
"ip": "192.168.0.1",
"hostname": "wwwivi"
}
]
}
],
"components": [
{
"id": "h3ulcb-4x2g-1.0-dom0"
},
{
"id": "h3ulcb-4x2g-1.0-domd"
},
{
"id": "h3ulcb-4x2g-1.0-domf"
}
]
}

Perform unit provisioning

$ aos-prov -u IP_ADDR:8089

Note: IP_ADDR is the IP address assigned to target board. (192.168.2.119 )