Virtual Machines for RTEMS Development

From RTEMSWiki
Jump to: navigation, search

Contents

This page describes the VirtualBox image of CentOS 6.2 with the RTEMS 4.11 development environment preinstalled for the i386 and SPARC targets. BSPs within these CPU families can be run on simulators inside the virtual CentOS 6.2 environment. The CentOS install has been stripped of multimedia and office applications to save space. This image is configured to support the following RTEMS activities:

  • basic testing of sparc/sis BSP using sis simulator in gdb
  • basic testing i386/pc386 BSP using qemu
  • coverage analysis using i386/pc386 BSP using qemu
  • testing networked RTEMS applications with i386/pc386 BSP on qemu
  • testing graphical RTEMS applications with i386/pc386 BSP on qemu

The current CentOS image does not include Eclipse and the the RTEMS plugin.

If there are packages which need to be removed from this image, please let us know. This is the first CentOS VM for RTEMS.

WARNING: Qemu was built from source in this VM. If it is not in your PATH, it is in a directory named something like /home/rtems/qemu/install/bin. Please add it to your PATH.

Downloading

You will need to download and install the free VirtualBox virtual machine player in order to use this image.

Accounts and Passwords

There are two user accounts with the following passwords:

root  with password Virtual0
rtems with password rtems123 (if not try just rtems) :)

Support

If you have questions or issue, please join the RTEMS User's Mailing List and ask them there. We will work with you to solve them.

If you would like a custom development environment, contact JoelSherrill.

First Time

The first time you run the virtual environment, please log in as root and do an update. If you get an error about mpc or mpfr, please add the EPEL Yum Repository to the VM per the instructions at http://fedoraproject.org/wiki/EPEL and try the yum upgrade again. If you still have missing dependencies for gmp (GNU Multiple Precision Arithmetic) and mpc (Multiple Precision Complex Library), contact the RTEMS Developers or Users mailing list. These should be able to come from a standard CentOS or RHEL repository.

After that completes, log out and login as the rtems user. You will spend most of your time as this user. You will want to update the RTEMS source tree using the following command sequence: (this may introduce build problems due to out-of-date libraries in CentOS, see discussion page)

. ~/rtems-4.11-work/setenv
cd $r
git pull
./bootstrap

The bootstrap will probably take 10-15 minutes to execute depending on the speed of your computer.

rtems user account

When you log in as rtems, your PATH is not set to include the RTEMS development tools and some scripts which assist in using CPU simulators to run RTEMS applications. Before working, you will need to add to your PATH using the appropriate <VERSION> number:

. ~/rtems-4.<VERSION>-work/setenv

At this point you have a completely up to date RTEMS development environment for the 4.11 git master with a checked out copy of the development tree. You are set to work but before you do,let's look at how to run a SPARC/sis or i386/pc386 executable.

BSP/Simulator Specific Details

SPARC/sis

The SPARC/SiS BSP is one of the easiest targets to work with in RTEMS. The simulator is quick and easy to run. A SPARC/sis executable can be run using the "sis" helper script as follows:

sis -i <PROGRAM_NAME>.ralf

The -i indicates that the program is to be run "interactively" with the output displayed as it is generated. The default is to output to a log file for subsequent analysis. When you want to debug, just use the following:

sis-gdb <PROGRAM_NAME>.ralf

At this point you will be sitting at a gdb prompt and can type run.

With that out of the way, now we can build your own sis executables. To make this easy, we have placed a configure command in a file so your first configure will not have typos. You can tinker with it later to match your project requirements. The build_bsp file contains the configure and make commands. It only builds the sample executables.

cd ~/rtems-4.<VERSION>-work 
./build_bsp sparc sis

If that all works, you should have a few sample executables in the build tree. Executing the following command will show you the set of samples built:

find . -name "*.ralf"

Pick one and run it. The "fileio" sample is interesting. Pick the "s" option and login to the RTEMS shell. Use rtems or root as the account with no password.

sis -i .../fileio.ralf

And that's all there is to the SPARC/sis. For many projects, this simulator has sufficient capabilities to support all your development and debug needs.

i386/pc386

Qemu is a simulator for a PC. It is a very robust simulator and we will focus in this on a very specific configuration. The PC is configured to use COM1 as the console. This allows us to redirect all console output to a file using standard UNIX redirection commands.

Qemu can simulate networking but we will not be exercising that in this example. If you are interested in that, please ask on the RTEMS User's mailing list and the discussion can be used to augment this page.

The combination of the i386/pc386 BSP and Qemu results in one of the most complete simulation environments to run RTEMS in. Unfortunately, it is not always the easiest simulators to work with. You have to deal with PC boot issues, network configuration etc. But the results are worth it for the functionality you can test.

A i386/pc386 executable can be run using the pc386 helper script as follows:

pc386 -i <APPLICATION>.exe

The -i indicates that the program is to be run "interactively" with the output display as it is generated. The default is to output to a log file for subsequent analysis. When you want to debug, you have to run Qemu in a gdb server mode. The current instructions do not cover that.

TBD

At this point you will be sitting at a gdb prompt and can type "c" for continue.

With that out of the way, now we can build your own pc386 executables for qemu. To make this easy, you can use the same build_bsp script, so your first configure will not have typos. You can tinker with it later to match your project requirements. This file contains the configure command. It only builds the sample executables.

cd ~/rtems-4.<VERSION>-work
./build_bsp i386 pc386

If that all works, you should have a few sample executables in the build tree. Executing the following command will show you the set of samples built:

find . -name "*.exe"

NOTE: The .exe files are ELF and the .ralf are Netboot format.

Pick one and run it. The "fileio" sample is interesting. Pick the "s" option and login to the RTEMS shell. Use rtems or root as the account with no password.

pc386 -i .../fileio.exe

Play around in the shell. When you are ready to quit type halt.

NOTE: Qemu sometimes has to be killed manually. If this occurs to you, "ps -ef | grep qemu". Note the process id (PID) and send it a "SIGHUP" signal via "kill -9 PID" where PID is the process id you obtained doing the "ps -ef" command.

And that's all there is to the i386/pc386 on Qemu. For projects which require PC compatibility or require more functionality than sis has, Qemu is a great option. RTEMS supports simulators for other architectures but for more developers, Qemu and sis are suitable for every day development and debugging that is not BSP specific.

Commonly Encountered Problems

This section describes some of the problems users of the Virtual Machines have encountered and solutions.

No Network Connection

There is an icon in the upper right hand side of the CentOS desktop once you login that shows two terminals or computers which appear to be connected. If there is a red X or line, click on this icon and "Enable System eth0" or whatever the wire network connection is.

If you are a laptop and have hibernated it and moved from one location to another, the networking details have likely changed on the host computer. In this case, disable networking and reenable it. All should be ok after that.

System Hangs at libvirtd During Boot

This is an ugly failure after a kernel upgrade. The Virtualbox extensions for the CentOS OS are out of sync with the Linux kernel. You can avoid this by uninstalling the Guest OS Extensions after upgrading the kernel and before rebooting. But you didn't get here because you knew that, did you?

You will have to press F1 when the progress bar starts to see ASCII output showing where the hang is.If it hangs at libvirtd OR virt-who then follow the following steps-

1) You will have to boot CentOS into an init level which does not start graphics. To do this open the grub menu, press "e" to edit the entry then down arrow to the kernel line. Press "e" to edit the line , now press "3" at the end of the line and press "b" to boot to init 3.

2) You may need to login but the command to execute is something like this with the version number corrected:

/opt/VBoxGuestAdditions-4.2.10/uninstall.sh

Once you have done this, reboot. It should boot to the graphical login. Once logged in again, you can reinstall the Virtual Box Guest OS Additions.

Personal tools
Namespaces

Variants
Actions
Navigation
Gedare's Special Help
Toolbox