RTOS with KVM Virtualized GPOS co-Execution for ARMv8 Architecture
How to run concurrently a RTOS and a KVM GPOS on Juno 64-bit ARM Platform
An important trend in the design of embedded systems is the integration of applications with different levels of criticality on multi-core heterogeneous hardware platforms. ECUs integration in automotive marketplace is a good example of such a mixed criticality system, aiming to meet stringent requirements related to latency, performance, cost, space, weight and power consumption. In fact, ethernet/vSwitch-centric gateways in a connected car executes safety-critical functions (e.g., break, electric-assist steering, etc.) that have to be securely isolated from In-Vehicle Infotainment (IVI) functionalities, while running on a multi-core SoC.
To support such type of mixed-criticality use-cases, Virtual Open Systems has developed KVM virtualization extensions and a TrustZone-enabling custom monitor layer to showcase through this step by step guide how to run concurrently a Real Time Operating System (RTOS) and a General Purpose Operating System (GPOS) on a real ARMv8 hardware target.
Introduction to ALS mixed-criticality PoC - concurrent RTOS and virtualized GPOS
Virtual Open Systems, official sponsor at the Tokyo Automotive Linux Summit (ALS) 2015, a Linux Foundation event, has showcased a Proof of Concept (PoC) of a RTOS and a GPOS concurrently executed on the ARMv8 Juno development platform, an ARMv8 architecture with two Cortex-A57 running at 1.2GHz, and four Cortex-A53 at 650MHz. The two Operating Systems (OSes) are executed within an ARM TrustZone environment which defines two execution worlds, a normal world and a secure world which are completely isolated each other.
The RTOS used in this PoC is a custom port to Juno board of a 32-bit FreeRTOS, which has been adapted by Virtual Open Systems. It executes, in the TrustZone Secure world (S-EL1 exception level), different tasks to control sequentially hardware LEDs available in the Juno, located under the board chassis; on the other hand, as GPOS, a Linux kernel version 4.0 with KVM virtualization extension enabled is executed in the TrustZone Normal world (NS-EL1 exception level). Thanks to KVM virtualization, the GPOS is able to run different virtual machines in parallel such as Tizen, Android.
This guide doesn't describe the process to virtualize a guest on the host Linux, however information about how to enable KVM Virtualization can be found on the Virtual Open Systems' Kvm on armv8 guide.
To manage the CPU resources and context switches between these two OSes, Virtual Open Systems has extended Arm Trusted Firmware (ATF). This extended software layer, called herewith VOSYS-custom-ATF, is a key part of the system, as it is able to stop the execution of one world to prioritize the other (Quality of Service), depending on the specific interrupt occurred.
In this guide we refer to ARM64, ARMv8 or aarch64 as the same architecture.
PoC Requirements to enable RTOS with KVM Linux
This guide is mainly based on the ARM Juno Development board and Ubuntu 14.04 (code name Trusty). However, all the software tools used hereinafter are also available for other Linux distributions, such as Debian and Fedora. Additional requirements are:
2 Converters UART/USB, 2 UART cables, 1 Ethernet cable, 1 USB cable TypeA/TypeB
Personal computer with Ubuntu 14.04 or similar distribution
64-bit ARM cross compiler The cross compiler used to compile toward the ARMv8 64bit architecture
32-bits GCC cross compiler for bare metal application on ARM Cortex-A/R/M processors
The JUNO ARM Development Platform
Install and set up an execution environment
This section describes how to install an execution environment and to set up the Juno ARM development platform.
How to get the 64-bit and 32-bit bare metal ARM cross compiler
First of all, there is a need to install ARM cross compilers, which will be used to compile ARM applications on an x86 workstation. To install them, run the following commands:
$ sudo apt-get install gcc-aarch64-linux-gnu $ sudo apt-get install gcc-arm-none-eabi
Then, to test if the compilers have been correctly added to the PATH environmental variable, type:
$ which aarch64-linux-gnu-gcc < You should get the compiler path here > $ which arm-none-eabi-gcc < You should get the compiler path here >
How to install serial communication and versioning tools
At this point, in order to receive UART data from the JUNO board, a serial communication tool, such as minicom, is necessary. Similarly, GIT, the Linux versioning tool used by developers to retrieve the kernel code is needed to download the sources used in this guide. To install them, run:
$ sudo apt-get install minicom $ sudo apt-get install git
User-space NFS Image for the Host
Network File System (NFS) allows to access the ARM host filesystem from the development workstation even when the Juno board is not running. For this flexibility, NFS will be used in the next sections with OpenEmbedded (Minimal), a linaro pre-configured image (linaro-image-minimal-genericarmv8-20140223-649.rootfs.tar.gz).
In order to export a directory through NFS, we have to install the NFS service, which is available in almost all Linux distributions. For instance, in Ubuntu, it can be installed as it follows:
$ sudo apt-get install nfs-kernel-server nfs-common
At this point, /srv/nfsroot, the folder that will serve the ARM Host image, can be created and populated with the host filesystem:
$ sudo mkdir -p /srv/nfsroot/ $ sudo tar -xf linaro-image-minimal-genericarmv8-20130526-319.rootfs.tar.gz \ -C /srv/nfsroot/
Moreover, to make it available for the Juno, the NFS configuration file /etc/exports needs to be modified in the following manner:
$ /srv/nfsroot 192.168.1.20/255.255.255.0(rw,sync,no_root_squash,no_subtree_check,insecure)
Then, to apply the new configuration, restart the NFS server:
$ sudo service nfs-kernel-server restart
Preparing the Juno board
Once the necessary software tools have been installed as instructed, the Juno board must be connected to the workstation and the serial link must be correctly set to enable the communication between hardware peripherals.
Virtual Open Systems is not responsible for any damage which might be caused to your platform while following the instructions below. While the content of this guide has been tested thoroughly, Virtual Open Systems cannot guarantee for any potential user errors which may harm the target platform.
Connect two UART cables on UART ports of the Juno platform, that you link on the converter UART/USB to connect the USB to your computer
Connect the USB TypeB connector on the Juno board and the USB TypeA connector on your computer
Link the Juno ARM Development Platform to the network by connecting the ethernet cable
Plug the 12 volt power supply to the board
Login or register to access full information