ARM development on a virtual platform



This is an article related to what is commonly called the Virtual Platform or Virtual Prototype. There are probably many definitions of what this means. here it means the Virtual Platform as a software model of a hardware system, created for the purpose of running embedded software and verifying the hardware/software interaction.

Here are some general characteristics to help clarify what the Virtual Platform is:

  • Runs unmodified target code
  • Uses instruction accurate models of processors 
  • Provides a full programmers view
  • Runs very fast (may be faster than the hardware it emulates)
  • Has excellent visibility and control (compared to physical hardware)
  • Is easy to distribute to many users

Virtual Platforms have been available since somebody had the idea to make a software model of the hardware.

I expect that many software engineers already understand the details about how to select operating systems, write device drivers, create and populate file systems, cross compile software, program flash memory, etc., but sometimes software engineers are not familiar with virtual systems since somebody else sets up all the infrastructure and they just “add code” in the right place.

I’m sure that virtual platforms are (or will become) critical to verification engineers and people who have worked primarily with RTL simulation in the past and are making the transition to the next level of abstraction.
Virtual Platforms can play a key role in system verification and delivery of high quality software sooner in the process.

The hardware system to be virtualized is the ARM Integrator CP board. It is an older board that was supplied by ARM and according to the ARM website is no longer promoted because newer hardware platforms have been developed.

Not being a state of the art board that means there is a lot of public information available as well as software.

One of the benefits of the Virtual Platform becomes apparent immediately. First, a software company probably wouldn’t understand the need to buy a board to develop embedded software.
Next, if a physical board was needed I doubt any readers would buy the board to learn about how embedded software development and verification works.

Since we have Virtual Platform technology nobody needs to buy any hardware and everybody can contribute. All that is needed is a computer, and the Qemu emulator.

Instead of actually reading the User Guide, we can start with a quick overview of the Integrator board and its memory map:
ARM926EJ-S CPU
Peripherals                                        Base Address
Primary Interrupt Controller                    0x14000000
Secondary Interrupt Controller                0xca000000
Counter / Timer                                     0x13000000
Real time Clock                                    0x15000000
UART 0                                                0x16000000
UART 1                                                0x17000000
Control Registers                                  0xcb000000
Keyboard Controller                               0x18000000
Mouse Controller                                   0x19000000
Multimedia Card                                    0x1c000000
Ethernet Controller                                0xc8000000
LCD Controller                                      0xc0000000

There are many uses for the Virtual Platform. A common one we can start with is to boot the operating system and run applications. Another one is to write device drivers and debug them.

Linux will be used as the operating system to load on the virtual device. Again, there is a wealth of information available and Linux is becoming popular as an embedded operating system.

To start, download QEMU which will emulate the Integrator board and boot Linux.

Get QEMU here. QEMU is an open source processor emulator which is available to run on both Linux and MS Windows.

If you have a Linux machine it may be installed already or can be installed using your package manager.

Once you have qemu installed it’s time to get a Linux kernel and file system and boot it.

There are Fedora and Debian howto links on the home page with step by step guides.

An easy starting point is to download the ARM Linux 2.6 kernel and ram disk file system image from the qemu website. Extract this file and go to the arm-test directory.
As the README shows you can boot doing:
% qemu-system-arm -kernel zImage.integrator -initrd arm_root.img

If all goes well you will see a new window:

Photobucket

You can login as root with no password and you have a Linux system running on the ARM Integrator CP Board with the ARM926EJ-S processor.

You can use
Ctrl-Alt-2 to get to the qemu command prompt, type help to see the commands or type quit to exit.
Ctrl-Alt-1 will get back to the console (this is actually the LCD controller).
Ctrl-Alt-3 will get to UART 0 and allows another login window.
Ctrl-Alt is the key to release the keyboard and mouse.

Now try some networking:
% wget http://www.google.com
This will download index.html This is a ramdisk so next time you boot the file will be gone.
To browse the web use the lynx browser:
% lynx google.com

Other than being pretty cool, this exercise raises many questions:

  • How is the Integrator Board modeled?
  • How does qemu know I want to run the Integrator board?  There was no configuration or arguments.
  • What’s in the file zImage.integrator?
  • What’s in the file arm_root.img
  • How is the Ethernet controller on the Integrator board able to access the Internet?
  • Can I debug code running on the Integrator board?
  • This is a minimalist system, how can I compile and add more programs to it?

Original article:
http://www.cadence.com/Community/blogs/sd/archive/2009/01/16/welcome-to-quot-understanding-the-virtual-platform-quot-series.aspx?postID=13987

Advertisements
This entry was posted in http://schemas.google.com/blogger/2008/kind#post. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s