« All blog posts

QEMU + ARM test setup

19.04.2013


From time to time we get inquiries regarding OPC UA server and client application suitability and performance on ARM platforms. This blog post is intended to serve as a starting point for users interested in testing Prosys Java applications on ARM platform virtual machine.

About QEMU

QEMU is a open-source software that performs hardware virtualization. It supports emulation of various architectures, including ARM. QEMU emulates the ARMv5TEJ instruction set and all the derivative processors families like ARM7, ARM9E, ARM10E and XScale. For example, QEMU powers the Android emulator which is part of the Android SDK. See http://wiki.qemu.org/Main_Page or http://en.wikipedia.org/wiki/QEMU for more information about the QEMU system itself.

Getting started

This post covers the installation and basic operation of QEMU and couple of hints to get up and running with Prosys SampleConsoleServer and SampleConsoleClient fast and easy. This guide is made using Java SE Embedded 7 but also other Java versions intended to be used with ARM should work. There’s also a ARM version of Java SE, see http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html for more details.

From our experience until now it seems that QEMU works best with Linux platforms so we chose Ubuntu 12.04 as the host for the virtual machine. Qemu can be installed with:

apt-get install qemu-system

We chose Debian to be our virtual machine OS. To start our ARM-virtual machine we need suitable kernel, initrd (initial ramdisk) and disk image. We acquired these by downloading them from http://people.debian.org/~aurel32/qemu/armel/

Note that there’s also QEMU versions for Windows and Mac. Those might also get the job done.

First boot

Now we are ready to boot our virtual machine! Run command:

sudo qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.32-5-versatile
-initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2
-append "root=/dev/sda1"

Optionally you can also add “-m” option at the end of the command. This option lets you increase or decrease the amount of RAM in virtual machine. Note that 256 MiB is the maximum amount of RAM available.

If you are planning on testing only console applications, as is our case in this post, it’s recommended to use the “standard” version of the disk image. Running graphical user interface in normal QEMU setup can be really slow.

You should now see a virtual machine screen with Debian booting for the first time and then ending up at a login prompt. Default usernames and passwords are “root/root” and “user/user”. Of course these passwords are recommended to be changed immediately after logging in.

QEMU

Usual configurations

After succesful first boot you will probably want to make some useful basic configurations. As I am writing this from Finland my first configuration was

dpkg-reconfigure keyboard-configuration

Java version 7 requires at least kernel version 2.6.28 and glibc version 2.9. These version numbers can be checked with:

~/lib/libc.so.6
uname -a

Although if you have followed these instructions you already have correct versions.

QEMU

Correct Java version for our test platform is ARMv5 Linux – Headless EABI, SoftFP ABI, Little Endian, which can be loaded from: http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html

Now the next step is to download the .tar.gz folder and unzip it to desired folder. Remember also to set Java path variable. This can be done for example by modifying file

/etc/profile

and adding

export PATH=$PATH:/path/to/java/.../ejre1.7.0_10/bin

Run command

source /etc/profile

to make changes come to use. Test that Java works by running

java -version

The output should look similar to below:

QEMU

Acquiring SampleConsoleServer and SampleConsoleClient

Java SE Embedded ships without Java compiler (javac) which is understandable as embedded platforms are not intended to be used for developing applications but rather only to run them. “Normal” versions of SampleConsoleServer and SampleConsoleClient however require use of Java compiler so we have to make different packages for embedded platforms. This is pretty trivial, you can for example export runnable .jar-packages from Eclipse if you have SampleConsoleServer and SampleConsoleClient source code.

Move these newly created .jar packages to your virtual machine.

You now have all the essential parts ready. However at this default setup virtual machine puts empty quotations as domain name which causes SampleConsoleServer to exhibit errors. Edit the

/etc/hosts

file to avoid this error. In our case

debian-armel.""

was changed to

debian-armel.prosys.fi

Installing screen

At this point we recommend installing screen-program to be able to run both Java programs easily at the same time. Run command

apt-get install screen

Here’s some screen commands to get you started if you’re not familiar with the program beforehand: Starting:

screen

or

screen java -jar SampleConsoleServer.jar

Detaching:

Ctrl a+d

Exiting: just normally exit the program that you run in screen Listing different screen instances:

screen -list

Attaching to different screens:

screen -r [pid]

Testing the configuration

One good way to test that both the server and client application are working correctly is to make a subscription to MyLevel:

QEMU QEMU QEMU

Known issues

If you export SampleConsoleServer.jar and SampleConsoleClient.jar from Eclipse without modifications you will get Log4j-warnings at the startup of both .jar files.

log4j:WARN No appenders could be found for logger (com.prosysopc.ua.UaApplication).
log4j:WARN Please initialize the log4j system properly.

QEMU

You have to modify SampleConsoleClient.java and SampleConsoleServer.java accordingly.

// Load Log4j configurations from external file
PropertyConfigurator.configureAndWatch(SampleConsoleServer.class
.getResource("log.properties").getFile(), 5000);

Has to be changed to:

// Initialize log4j logging
PropertyConfigurator.configure(SampleConsoleServer.class
.getResource("log.properties"));
Heikki Tahvanainen

Heikki Tahvanainen

Customer Service Manager

Email: heikki.tahvanainen@prosysopc.com

Expertise and responsibility areas: Prosys OPC product and service sales and customer relationships

Tags: Embedded, Java, OPC UA

comments powered by Disqus

About Prosys OPC Ltd

Prosys OPC is a leading provider of professional OPC software and services with over 20 years of experience in the field. OPC and OPC UA (Unified Architecture) are communications standards used especially by industrial and high-tech companies.

Read more about us »

Newest blog posts

Why Do Standards Matter in Smart Manufacturing?

The blog post discusses the importance of standards in smart manufacturing, envisioning a future where auto-configurable systems in manufacturing rely on standardized data formats for seamless integration and reduced costs, with a focus on the OPC UA standard family as a key enabler.

OPC UA PubSub to Cloud via MQTT

Detailed overview of the demo presented at the OPC Foundation booth

SimServer How To #3: Simulate data changes on a server using an OPC UA client

A two-part step-by-step tutorial on how to write data changes on an OPC UA server using an OPC UA client.

View all blog posts »