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.

There is an updated and tested version of a useful tutorial on CNXSoft (http://www.cnx-software.com/2012/11/06/getting-started-with-64-bit-arm-development-hello-world-and-linux-on-armv8-fast-models/).

Before you start, you should check you will be able to run this. Section 1.2 of the Foundation Model user guide contains the following software requirements:

  • Red Hat Enterprise Linux version 5.x or 6.X for 64-bit Intel architectures.
  • Ubuntu 10.04 or later for 64-bit Intel architectures.

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:

  1. Launch browser and go to http://www.arm.com/products/tools/models/fast-models/foundation-model.php
  2. At the bottom of the page that appears, click on “Get started with Foundation Platform Download now” (https://silver.arm.com/browse/FM00A).
  3. If you do not have an ARM Silver (free) account create one by clicking on Register (https://login.arm.com/register.php) for an ARM account, if you have one skip to step 8.
  4. Enter your email address, first name, last name and the verification code and then click on Next.
  5. Complete the ARM registration details – at a minimum you need to fill in your first and last name, company name, country and a password.
  6. ARM then sends you an email that includes an activation link. Click on this link and it will take you back to the ARM website, where you can log in.
  7. Go to https://silver.arm.com/browse/FM00A to download the Foundation Models
  8. On the right hand side of the “Fast Models – Main product” page, click “ARM V8 Foundation Model Download Now:” https://silver.arm.com/download/download.tm?pv=1509509
  9. 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.
  10. 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.
  11. 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.
  12. 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.
  13. Open a terminal window.
  14. 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
  15. 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
  1. Open a terminal window in Ubuntu and create a new folder in your home directory.
  2. Download the boot image by typing:
    wget http://releases.linaro.org/latest/openembedded/aarch64/img-foundation.axf
  3. While the output will not be exactly like the output shown, you should get something like the following output:
    --2014-05-22 13:56:26-- http://releases.linaro.org/latest/openembedded/aarch64/img-foundation.axfResolving releases.linaro.org (releases.linaro.org)... 54.224.103.109Connecting to releases.linaro.org (releases.linaro.org)|54.224.103.109|:80… connected.HTTP request sent, awaiting response… 200 OKLength: 9592803 (9.1M) [application/force-download]
    Saving to: ‘img-foundation.axf’100%[======================================>] 9,592,803 2.06MB/s in 5.1s2014-05-22 13:56:32 (1.81 MB/s) – ‘img-foundation.axf’ saved [9592803/9592803]
  4. Now download the disk image by typing:
    wget http://releases.linaro.org/latest/openembedded/aarch64/..., but substituting for the ellipses the image that you found on the release pages for this, as in the following example:
    wget http://releases.linaro.org/latest/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.8_20140530-656.img.gz
  5. You should get something very similar to the following output:
    --2014-05-22 14:29:21-- http://releases.linaro.org/latest/openembedded/aarch64/vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img.gz Resolving releases.linaro.org (releases.linaro.org)... 54.224.103.109 Connecting to releases.linaro.org (releases.linaro.org)|54.224.103.109|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 85602919 (82M) [application/force-download] Saving to: ‘vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img.gz’100%[======================================>] 85,602,919 1.45MB/s in 56s2014-05-22 14:30:18 (1.45 MB/s) - ‘vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img.gz’ saved [85602919/85602919]
  6. Now extract the disk image by typing:
    gunzip vexpress64-openembedded_minimal-armv8-gcc-4.8_20140417-630.img.gz
  7. 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
  8. A new terminal window opens with the kernel output displayed.
  9. After a few minutes, the command prompt appears.

  1. To check that you are running the 64-bit ARM (aarch64) version of Linux, type:
     uname -a
  2. To check that this is running on an emulated 64-bit CPU, type:
     cat /proc/cpuinfo


    CPU

  3. 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:

Installing a QEMU ARM-64 emulator to drive “instant” ARM-64

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.

# Use an explicit mirror name if you prefer.

sudo apt-get update

sudo apt-get install qemu-user-static debootstrap schroot

sudo qemu-debootstrap – -arch=arm64 – -variant=buildd – -exclude=debfoster unstable debian-arm64 http://http.debian.net/debian

# This will start up QEMU and install the latest Debian unstable for ARM64 . It will create a jessie chroot in

# debian-arm64 dir. It sets up a build environment, not a whole emulated computer.

# if you want an image INSTEAD of a chroot filesystem:

sudo vmdebootstrap – -image=/tmp/debian-arm64.img – -size=1G – -distribution=jessie – -arch=arm64

# If you do need extra packages then - -include git,emacs, etc. works fine to add them to the image

# or with vmdebootstrap add – – package=git – -package=emacs – -package=foo

#To get a foreign chroot created and automatically added with an schroot config run this:

sudo sbuild-createchroot – -debootstrap=qemu-debootstrap – -arch=arm64 jessie \

- -components=main,contrib,non-free debian-arm64 http://http.debian.net/debian/

# (With - -include=extra,packages,you,want )

# The nice thing about this is that it sets up the schroot config for

# you (which is otherwise fiddly editing of /etc/schroot/chroot.d/)

# Do schroot -l afterwards to see the list of configured schroots.

#Visible links

# 1. http://http.debian.net/debian

# 2. http://git.qemu.org/qemu.git

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

# 4. http://http.debian.net/debian

# Thanks to Wookey!