Porting and Performance contest sponsored by Linaro

ARM Coding Environment

To begin working on porting and optimizing the software packages, you will need an environment to write, compile and test your coding. As ARMv8 64-bit hardware platforms are released, it may be possible to do this locally on hardware, but for most participants, initial work will need to be done of ARM’s models. This section explains how to download and install these models, access the code repositories to get the code to work on and download tools to enable you to compile your work.

For most people working on ARM 64-bit software development, there is a choice of two free development platforms: the ARM Foundation models and the open source QEMU project. Both of these emulate a 64-bit ARM platform on a regular desktop or laptop PC. The ARM Foundation models are available on Linux only, but QEMU can be used on Linux or Windows. In the tutorial below, we’ll explain how to get up and running with the ARM Foundation models. For information on QEMU, the best place to start is the QEMU_wiki and the tutorial you will find after this one on the ARM models.

In mid-2014, although ARM began sharing details of its 64-bit architecture in late 2011, there is only one hardware platform currently available: the Applied Micro XC-1. If you are lucky enough to have access to one of these, then you’re all set. We expect additional options will come available in 2014, but they may be costly and so we are looking at ways to make some hardware available in the cloud so that entrants to this challenge can make performance improvement measurements. Watch this site for developments.

Getting started with the ARM Foundation models.

There is a lot of useful information about the Foundation models on the Internet, but the one document you should have at hand is ARM’s own Foundation model user guide.

There are also several tutorials to get you started, but several of these were written a long time ago and link to outdated source.

At present there is no support for running the model on other operating systems. However, the model should run on any recent x86 64-bit Linux OS provided glibc v2.3.2, or higher, and libstdc++ 6.0.0, or higher, are present.

We tested the following step-by-step instructions on Ubuntu 14.04 with Gnome shell running on a two-year old Dell XPS L502X:

A click-through end-user license agreement should appear. Having read the agreement and assuming you agree with it, check the “I Agree *” box and then click confirm.

In Ubuntu 14.04, open the file with the default Archive Manager and view the contents of the .tgz file. This should include three directories (doc, examples and models) and a copy of the license agreement. The doc folder contains a PDF user guide and a Readme text file; chapter 2 of this explains getting started.

Navigate to the models/Linux64_GCC-4.1 folder and, as explained in the guide, there is a Foundation_v8 executable (although it is shown as an unknown file type), labarmctmodel.so code translation library and lib MAXCOREInit…. helper library that the model requires.

Create a folder called armv8-model in your home directory and extract the content of the example and models/Linux64_GCC-4.1 folders into this folder.

Open a terminal window.

Type

./Foundation_v8 --image hello.axf

and you should get the following output:
terminal_0: Listening for serial connection on port 5000
terminal_1: Listening for serial connection on port 5001
terminal_2: Listening for serial connection on port 5002
terminal_3: Listening for serial connection on port 5003
Simulation is started
Hello, 64-bit world!
Simulation is terminating. Reason: Simulation stopped

This demonstrates that the models are working correctly, now we need to be able to boot Linux on the models.

Booting Linux on the ARM Foundation models

The following steps explain how to get Linux up and running on the ARM Foundation models and check that it is actually emulating a 64-bit system. The Linaro website includes some information about running Linux on the ARM Foundation models here: http://www.linaro.org/projects/armv8/.

In addition, the latest Linaro releases for ARMv8 are stored here: http://releases.linaro.org/latest/openembedded/aarch64/. You should go there first and find the latest version of the “vexpress64-openembedded_minimal-arm8-gcc-” image. It will also have a version of gcc (perhaps 4.x) followed by an underscore and the date in yyyymmdd format, followed by a hyphen and an image number followed by a DOT then the letters ‘img.gz”, somewhat like this:

vexpress64-openembedded_minimal-armv8-gcc-4.8_20140530-656.img.gz

Open a terminal window in Ubuntu and create a new folder in your home directory.

Now extract the disk image by typing:gunzip vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img.gz

Assuming that the file Foundation_v8, the file img-foundation.axf and the OpenEmbedded minimal system image are all in the current directory, run OpenEmbedded on the Foundation Model by typing: ./Foundation_v8 --image ~/linaro-armv8/img-foundation.axf --block-device vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img --network=nat

A new terminal window opens with the kernel output displayed.

After a few minutes, the command prompt appears.

To check that you are running the 64-bit ARM (aarch64) version of Linux, type:

uname -a

To check that this is running on an emulated 64-bit CPU, type:

cat /proc/cpuinfo

You now have the Foundation models running correctly on your computer and you have booted Linux.

Your next step is to begin building for ARMv8. There are several places you can find out more about this:

Recently Fedora and Debian have set up testing distributions (Debian “Jessie”, for example), that now allows native testing of modules and native development, which is a lot simpler for contestants. It is still not really good for ARM-64 specific performance enhancements, but we think that 99% of the performance enhancements that work for Intel-64 will also enhance ARM-64. Also the most important thing is having the code run on ARM-64, obviously, which can be shown through QEMU.

Briefly the steps to use QEMU-64 are:

(1) Install Debian/Jessie (the “Testing” release) on your notebook or desktop. This can be done through VMware, to a separate disk (internal or external), or to a clean partition on an existing disk.

(2) Install the ARM-64 version of QEMU into this Intel version of “Jessie”, which is basically just doing a “apt-get”

(3) Now run the ARM-64 version of Jessie underneath the ARM-64 version of QEMU, and log into Jessie to do your testing and porting work.

Linaro believes this to be a lot easier than trying to maintain a cross-compilation environment for people who are not used to working that way

======Steps for Setting up an Environment=====

# The URL below is useful current info that covers making a qemu-ready debian arm64 jessie rootfs/chroot

# on testing and stable:

# https://wiki.debian.org/Arm64Port#Debootstrap_arm64

# Install Debian Testing on an x86 machine)

# make sure you have debootstrap, chroot and sudo installed

# notes: http://http.debian.net is a handy service to proxy to a sensible debian mirror for wherever you are in the world.