Getting Started with 64-bit ARM Development: Hello World and Linux on ARMv8 Fast Models

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.

ARMv8 Foundation Model

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.

Hello Word! for ARMv8

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.


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.

Run ARMv8 Linux in the Virtual Platform

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:


After a few seconds, a terminal window (Telnet attached to UART) with the kernel output should pop-up:

Linux boot on Cortex A57 virtual platformBe patient, and after several minutes (12 minutes on a PC based on Intel Core 2 processor @ 1.8 GHz), you should see the command prompt.
Let’s see if we really run on ARMv8:


All good!

Building for ARMv8

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:


Install some dependencies:


Then write an  “Hello World!” program, and cross-compile it:


Let’s check the file is really a 64-bit binary:


Now copy it to the virtual platform, either by updating the rootfs, or via NFS or http, and run the program:


Success!

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…

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
25 Comments
oldest
newest
Nikolay Nikolaev
Nikolay Nikolaev
11 years ago

Hello, there’s an alternative – the buildroot guys recently added their AArch64 buidl support too. A quick step-through: git clone git://git.buildroot.net/buildroot cd buildroot make arm_foundationv8_defconfig && make It takes some time now. Then run the resulting images like this: ${LOCATION_OF_FOUNDATIONV8_SIMULATOR}/Foundation_v8 \ –image output/images/linux-system.axf \ –block-device output/images/rootfs.ext2 \ –network=nat Voilà. Now you have you own compiled distro. You don’t have to worry about downloading compilers and setting PATH, it’s all done for you. As a bonus you get the (almost) “latest” kernel: Welcome to Buildroot buildroot login: root # uname -a Linux buildroot 3.7.0-rc2 #1 SMP Tue Nov 6 06:06:00 EET… Read more »

Nikolay Nikolaev
Nikolay Nikolaev
11 years ago

@Nikolay Nikolaev
On my i7-3820 the simulator loads/runs pretty fast!
You definitely need a fast machine here.

Sander
Sander
11 years ago

Funny: the ‘file’ command does not yet know the ARM64 / AARCH64 structure:

$ file examples/hello.axf
examples/hello.axf: ELF 64-bit LSB executable, version 1 (SYSV), statically linked, not stripped

So: no mentioning of ARM (let alone ARM64) at all. 🙁

FWIW:

On my Raspi (with old-skool 32-bit ARM):

$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=0xae83e4aa4bcb54db085cc4501ebac0dde2b265e9, not stripped

And my x86-64:

$ file hello
hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0x037c38ade17339c41ea6f028a6dee9c302326e86, not stripped

Sander
Sander
11 years ago

My emulator is running, but without network.

After “udhcpc”, I have a network via ifconfig. Alas, I can’t get outside the emulator: traceroute only shows stars.

So … How do I get network running? Or, easier, how do I get files in and out of the emlulator?

Sander
Sander
11 years ago

@Nikolay Nikolaev

The buildroot is running now, but it’s download more that 1GB (“Cloning into bare repository ‘linux-7181edd0539e195f78adedbb6c3878f9f1e0c4bb’…”). Is that correct?

Nikolay Nikolaev
Nikolay Nikolaev
11 years ago

@Sander
Well – yes, that’s a git ‘feature’ 🙂
Just leave it and see what happens in the end.

BTW I run “make menuconfig” and selected ‘links’ (it’s a popular textbased web browser).
When I run the image – udhcpc eth0. Then you can do: links google.com. See – it works.
I also had network problems with Linaro’s OpenEmbedded image – don’t know what is the issue there.

Sander
Sander
11 years ago

@Nikolay Nikolaev

the make eventually succeeded, and I’m running the 3.7.0 Linux image. Problems
– still no network
– this image has no gcc 🙁

Sander
Sander
11 years ago

FWIW: this is my ifconfig after the udhcpc Tips how to get the network running? # ifconfig eth0 Link encap:Ethernet HWaddr 00:02:F7:EF:CE:D4 inet addr:172.20.51.1 Bcast:172.20.51.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:9 errors:0 dropped:0 overruns:0 frame:0 TX packets:65 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:940 (940.0 B) TX bytes:4310 (4.2 KiB) Interrupt:47 Base address:0xa000 DMA chan:ff lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) # # traceroute -n 8.8.8.8 traceroute to… Read more »

Sander
Sander
11 years ago

Could you try your network connectivity within the ARM64 / aarch64 emulator?

I tried a physical ethernet cable (with Wifi turned off), but “ping 8.8.8.8” results in a 100% loss … 🙁

FWIW: Running on Ubuntu 12.10 64-bit.

Sander
Sander
11 years ago

PS: I can ping the VM’s own IP address, and it’s default gateway. But that’s it. root@genericarmv8:~# ip route show default via 172.20.51.254 dev eth0 172.20.51.0/24 dev eth0 src 172.20.51.1 root@genericarmv8:~# ping 172.20.51.254 PING 172.20.51.254 (172.20.51.254): 56 data bytes 64 bytes from 172.20.51.254: seq=0 ttl=64 time=0.699 ms 64 bytes from 172.20.51.254: seq=1 ttl=64 time=0.414 ms 64 bytes from 172.20.51.254: seq=2 ttl=64 time=0.401 ms ^C — 172.20.51.254 ping statistics — 3 packets transmitted, 3 packets received, 0% packet loss round-trip min/avg/max = 0.401/0.504/0.699 ms root@genericarmv8:~# root@genericarmv8:~# ping 8.8.8.8 PING 8.8.8.8 (8.8.8.8): 56 data bytes ^C — 8.8.8.8 ping statistics — 9… Read more »

Sander
Sander
11 years ago

@Jean-Luc Aufranc (CNXSoft) Yes, I had already tried “network=bridged”, but that way udhcpc does not get an IP address at all … 🙁 root@genericarmv8:~# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@genericarmv8:~# udhcpc udhcpc (v1.20.2) started [ 55.816859] smc91x 1a000000.ethernet: eth0: link up, 10Mbps, half-duplex, lpa 0x0000 Sending discover… Sending discover… Sending discover… Sending discover… Sending discover… root@genericarmv8:~# udhcpc –retries 4 -n -q -i eth0 udhcpc (v1.20.2) started Sending discover… Sending discover…… Read more »

Sander
Sander
11 years ago

Yes, ip route looks good; see my older post of November 13th, 2012 at 04:52

Sander
Sander
11 years ago

Wow, indeed! Thank you!

Note to myself: ping/traceroute is NOT a good test. 🙁

Olivier Martin
8 years ago

I have just written a blog to explain how to build the entire reference ARM-64bit Software stack (ARM Trusted Firmware + UEFI + Device Tree + Linux Kernel) on the ARM Foundation Model: http://labapart.com/blogs/6-arm-foundation-model-free-solution-to-make-your-first-steps-on-arm-64bit-and-arm-software-stack

bharath
bharath
8 years ago

Hi .,

Not able to download ARM V8 Foundation Model (FM000-KT-00035) after successful registration to arm .
After clicking on download now section under public download it is asking to accept the license aggrmnt and endup without any option to download.

Thanks in advance !!

Boardcon Rockchip and Allwinner SoM and SBC products