Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
108 lines (87 sloc) 6.13 KB
title author date image categories series tags
96boards: Real time and ROS2 | Hikey970 RT Setup
Servando German Serrano
2019-11-08 01:00:00 +0000
featured path name
true
/assets/images/blog/hikey970.png
hikey970.png
blog
96boards: Real time and ROS2
64-bit, 96Boards, aarch64, ARM, ARMv8, Consumer Edition, Hikey970, Linaro, Linux, arm64, real time, ROS2

Real Time enablement on 96boards

The following is the first on a series of blogs targeting the enablement of real time capabilities on a range of 96boards.

We'll kick off with the Hikey970, which features the HiSilicon Kirin 970 SoC with HiAI Architecture and a dedicated NPU. In addition of 6GB LPDDR4X 1866MHz memory, 64GB UFS 2.1 storage, Bluetooth, WIFI, GPS among many other features.

The post is organized as follows:


Board preparation: Bionic Builder

The Bionic Builder Tool can be used to flash the board with an Ubuntu 18.04 image for the Hikey970. This will allow installing Docker and, as of the time of writing, ROS Melodic and ROS2 Dashing.

After flashing the board with Ubuntu 18.04 we need to update the bootloader.

Bootloader update

The bootloader needs to be updated to enable PCIE power on the board.

Download the updated bootloader (fip.bin, l-loader.bin, sec_usb_xloader.img and sec_usb_xloader2.img) and the convenience script hisi-idt.py from http://people.linaro.org/~manivannan.sadhasivam/hikey970_images/.

Set the board to Recovery Mode and follow the steps to flash the updated bootloader, e.g. (assuming the board appears as ttyUSB0):

$ sudo python hisi-idt.py -d /dev/ttyUSB0 --img1 ./sec_usb_xloader.img --img2 ./sec_usb_xloader2.img --img3 ./l-loader.bin
$ sudo fastboot flash fastboot l-loader.bin
$ sudo fastboot flash fip fip.bin

Following the board jumper pins need to be set to fastboot mode as explained in https://www.96boards.org/documentation/consumer/hikey/hikey970/installation/linux-fastboot.md.html.

Kernel upgrade and flash

As mentioned at the beginning of this blog, our aim is to enable real time capabilities on the Hikey970 for further development.

The PREEMPT_RT patch changes the Linux kernel into being fully preemptible which enables real time capabilities on the patched kernel.

The preempt_rt patches are released for different kernel versions. Linux kernel v4.9.78 is the supported one for the Hikey970. Since there is no preempt_rt patch for this kernel version, a number of patches have been backported to v4.14.78 following Mani's blog posts. The modified kernel can be found in https://github.com/sgermanserrano/96b-k/tree/hi970_4.14.78.

In order to build and flash the preempt_rt enabled kernel on the Hikey970:

$ git clone https://github.com/sgermanserrano/96b-k.git -b hi970_4.14.78 linux-4.14.78
  • Download the appropriate preempt_rt patch:
$ wget https://www.kernel.org/pub/linux/kernel/projects/rt/4.14/older/patch-4.14.78-rt47.patch.xz
  • Change directory to the kernel source and apply the patch:
$ cd linux-4.14.78
$ xzcat ../patch-4.14.78-rt47.patch.xz | patch -p1
  • Download the kernel config:
$ wget -O .config people.linaro.org/~servando.german.serrano/hikey970/config_hikey970
  • Build the kernel:
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs modules Image
  • The modules can be installed into a local folder and should be copied on to the board before flashing the new kernel:
$ mkdir hikey970_modules
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install INSTALL_MOD_PATH=./hikey970_modules
$ cd ..
$ wget http://people.linaro.org/~manivannan.sadhasivam/hikey970_images/ramdisk.img
$ wget http://people.linaro.org/~servando.german.serrano/hikey970/build_hi970_rt.sh
  • With the Hikey970 in fastboot mode, run the script to flash the compiled kernel:
$ chmod +x build_hi970_rt.sh
$ ./build_hi970_rt.sh
  • After flashing the kernel reboot the board and log into it, e.g. via the serial port. Now, if everything went well doing uname -v should show ... SMP PREEMPT RT ... so we can confirm that the running kernel has been successfully patched.

Note

It is possible that the Wifi does not connect automatically after flashing the rt enabled kernel. To enable it back again you need to log into the board via the serial interface, check that the wlan0 interface is available doing ifconfig -a and then:

$ sudo systemctl stop NetworkManager
$ sudo systemctl start NetworkManager

for it to restart.


Conclusion

Next week, we'll make use of our new board setup to install ROS2 and test the pendulum demo which requires real time capabilities on the target hardware. In addition we'll run a simple performance comparison between FastRTPS and Eclipse Cyclone DDS implementations.

You can’t perform that action at this time.