At the end of last year, ARM announced ARMv8, the first ARM 64-bit ARM archtecture, and last week at ARM Techcon 2012, ARM announced the first ARMv8 cores: Cortex A53 and A57. But since there’s no silicon at the moment, what if you wanted to develop code running on ARMv8 before the hardware is available? The answer is: Fast Models, a Virtual Platform (VP) to accelerate software development. This is especially important for ARMv8 since hardware is not expected to be available for another year. In this post, I’ll first show how to run “Hello World!” in ARMv8 fast models, then we’ll run ARM Linux 64-Bit (Aarch64) in the virtual platform.
In order allow the developer’s community to program for ARMv8 (Cortex A53/A57 cores), ARM has made ARMv8 Foundation Model, a virtual platform, available free of charge.
This v8 Foundation model provides a basic ARMv8 platform environment suitable for running bare metal semi-hosted applications, and Linux OS booting. The platform provides:
- An ARMv8 processor cluster with 1-4 CPUs
- Up to 8GB of RAM
- An optional 128MB of secure RAM
- 4 PL011 UARTs exposed as host TCP sockets
- A network device model connected to host network resources
- A block storage device implemented as a file on the host
- A small system register block
The V8 processor model implements:
- AArch64 at all exception levels
- AArch32 support at EL0/EL1
- Little and big endian at all exception levels
- Generic timers
- Self-hosted debug
- GIC v2 memory mapped CPU interfaces and distributor
- No support for Thumb2EE
- No support for Crypto extensions
The models require an x86 64-bit Linux machine running Red Hat Enterprise Linux version 5.x for 64-bit architectures, Red Hat Enterprise Linux version 6.x for 64-bit architectures, Ubuntu 10.04 (64-bit) or later. However, any x86 64-bit Linux distributions with glibc v2.3.2 (or greater) and libstdc++ 6.0.0 (or greater), should be able to run the models. I used a machine running Ubuntu Desktop 12.04 LTS 64-bit with the instructions below.
To get started, visit the page linked above, and click on “Download Now” at the bottom of the page. You’ll need to login or register (It’s free), and then on the top right of the screen click on “Download Now” again to start downloading the V8 Foundation Model. You’ll a get a 8 MB file called FM000-KT-00035-r0p8-44rel23.tgz.
Let’s work in a terminal window, uncompress the file and run the “Hello World!” application.
tar xzvf FM000-KT-00035-r0p8-44rel23.tgz
./Foundation_v8 --image examples/hello.axf
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!
That’s it! Details are in in the document: DUI0677A_foundation_fast_model_ug.pdf, including instructions to access a web interface to monitor the machine, access to UART and more. hello.axf is a file based on “ARM Executable Format” that contains executable binary code generated with armlink linker part of the Keil ARM Compilation Tools. You can check the Makefile in the examples directory to see how armcc and armlink are used for the ARMv8 architecture.
Now let’s do something a bit more interesting by running Linux (OpenEmbedded) in the v8 foundation model. The instructions I followed are available at http://www.linaro.org/engineering/armv8.
Prepare a working directory:
Download boot image:
Download and extract disk image:
Run OpenEmbedded in the virtual platform:
~/Foundation_v8pkg/Foundation_v8 --image ~/linaro-armv8/img-foundation.axf --block-device ~/linaro-armv8/vexpress64-openembedded_sdk-armv8_20121019-22.img --network=nat
After a few seconds, a terminal window (Telnet attached to UART) with the kernel output should pop-up:
Linux genericarmv8 3.6.0-1-linaro-vexpress64 #1~ci+121019044339 SMP Fri Oct 19 05:03:44 UTC 2012 aarch64 GNU/Linux
Processor : AArch64 Processor rev 0 (aarch64)
processor : 0
BogoMIPS : 200.00
Features : fp asimd
CPU implementer : 0x41
CPU architecture: AArch64
CPU variant : 0x0
CPU part : 0xd00
CPU revision : 0
Hardware : V2P-AARCH64
Running Linux in ARMv8 is nice, but what you really want to do is write and build programs for the platform. Natively build programs inside the foundation models is probably not a good idea for most programs, since it would be quite slow, so you’ll have to cross-compile for Aarch64. I’ll build the “Hello World!” application as explained in https://wiki.linaro.org/HowTo/HelloAarch64.
First download and install aarch64-toolchain:
tar xf gcc-linaro-aarch64-linux-gnu-4.7+svn191987-20120925+bzr2498_linux.tar.xz
Install some dependencies:
apt-get install build-essential ia32-libs
Then write an “Hello World!” program, and cross-compile it:
aarch64-linux-gnu-gcc -o hello hello.c
Let’s check the file is really a 64-bit binary:
hello: ELF 64-bit LSB executable, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.39, BuildID[sha1]=0xf99cedfc98f57956a6de9c1c04beba2acf32dfee, not stripped
Now copy it to the virtual platform, either by updating the rootfs, or via NFS or http, and run the program:
Hello World! cnxsoft is in the 64-bit ARM house!
For more, there are other very useful ARM Linux 64-bit tutorials on Linaro website, such as:
And you could also try the minimal, LAMP or SDK Aarch64 images.
It’s also possible to run Android (32-bit) in the V8 models as shown in the video below (mainly an interview), but instructions do not appear available, and it’s not something I would want to try in my (slow) machine…
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
|Support CNX Software - Donate via PayPal or cryptocurrencies, become a Patron on Patreon, or buy review samples|