Virtual Machines for RTEMS Development

From RTEMSWiki
Revision as of 20:21, 14 April 2012 by C Rempel (Talk | contribs)

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. Launch a terminal window and enter: (this will introduce missing dependencies due to out-of-date libraries in CentOS 6.2, see discussion page). To prevent the missing dependencies install gmp (GNU Multiple Precision Arithmetic) and mpc (Multiple Precision Complex Library)

wget http://www.rtems.org/ftp/pub/rtems/SOURCES/4.11/gmp-4.3.2.tar.bz2
wget http://www.rtems.org/ftp/pub/rtems/SOURCES/4.11/mpc-0.8.1.tar.gz
tar -xjf gmp-4.3.2.tar.bz2
tar -xzf mpc-0.8.1.tar.gz
mkdir b-gmp b-mpc
cd b-gmp
../gmp-4.3.2/configure && make && make install
cd ../b-mpc
../mpc-0.8.1/configure && make && make install
yum -y upgrade   

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.

Personal tools
Namespaces

Variants
Actions
Navigation
Gedare's Special Help
Toolbox