picoTK makes a compact and easy to integrate GUI add-on for the RTEMS real-
time operating systems. RTEMS is an OpenSource POSIX compliant real-time
kernel written and maintained by the Online Application Research
Corporation, Huntsville, AL. RTEMS is available for many embedded 32-bit
platforms, including the PC, the Motorola PowerPC and the 68K. The most
current versions of RTEMS now support TCP/IP networking, making it suitable
for internet connected appliances. RTEMS is for real-time world, what Linux
is for the dektop/server OSses.
The following describes how to install RTEMS for a Linux development host
and a PC (i386) target. The required GNU C/C++ cross-compiler toolchains
for other host/target pairs are available precompiled from OAR's site
http://www.oarcorp.com/
as well. I personally used a SuSE 7.0 Linux
system - any other current Linux distribution shall do as well.
The following steps summarize the installation of RTEMS 4.5, the required additional tools for creating PC bootable floppy disks and linking of the picoTK demo application.
Get the following files from
ftp://ftp.rtems.com/pub/rtems/releases/4.5.0/...
.
(for i386 Linux host, i386-Target):
.../c_tools/linux_x86/RPMS/i386-rtems/
i386-rtems-binutils-2.9.5.0.24-1.i386.rpm
i386-rtems-gcc-gcc2.95.2newlib1.8.2-7.i386.rpm
i386-rtems-gdb-4.18-4.i386.rpm
.../c_tools/linux_x86/RPMS/shared/
rtems-base-binutils-2.95.2newlib1.8.2-7.i386.rpm
rtems-base-gcc-gcc2.95.2newlib1.8.2-7.i386.rpm
rtems-base-gdb-4.18-4.i386.rpm
These are the precompiled toolchain packages for i386/i386 host/target
combination.
.../
rtems-4.5.0.tgz
This is the RTEMS source. We have to compile it using the
above toolchain.
.../contrib
pc386_lilo.tar.gz
RTEMS Bootloader. Allows booting RTEMS from floppy disk.
.../
hello_world_c.tgz
Simple test program. Instructive for building your own Makefiles.
Become root. From the directory where you collected the RPMs type:
rpm -i rtems-base*rpm i386-rtems*rpm
(Accidently the alphabetic order implied by the bash wildcards gets the RPMs installed in the right order)
.../
export PATH=$PATH:/opt/rtems/bin
Assuming you use bash
as your command shell. It is only needed for the
following initial compilation of RTEMS itsel. Your own projects will find
the compiler using a special environment variable as described in section
"Set the environment"(
set-rtems-environment
).
Become an ordinary user. Create directory "rtems" somewhere in your home, e.g. /home/thomas/rtems. The rtems directory shall be on the same level as the "picotk" directory, see 4.1.2. The directory structure looks at follows (after the installation of all packages):
.../picotk/toolkit
| /emulators
| /demo/
| /rtems
/rtems/rtems-4.5.0
/build
/pc386_lilo
Cd to the rtems directory and untar RTEMS:
cd
mkdir rtems
cd rtems
tar xzf <...>/rtems-4.5.0.tgz
Create empty directory in which the compilation results will be held during compilation. (See note below.)
mkdir build
Up to now you shall have the following dir structure:
.../rtems/rtems.4.5.0
/build
IMPORTANT NOTE (Just for a better understanding):
This is very special with RTEMS and might cause some trouble to the
RTEMS newbie: Source texts and compilation output (i.e. objects) are
kept in different directory trees (.../rtems-4.5.0
and .../build
respectively). Sometimes it is necessary to
change the RTEMS source text
(for doing configuration, tweaking drivers, etc.)
Changing/Recompiling RTEMS requires these three steps:
.../rtems-4.5.0
.../rtems/build
directory
using make RTEMS_BSP=pc386
.../rtems/build
directory
using make install RTEMS_BSP=pc386
.
This copies things into the "public" installation
directories. The default settings of RTEMS - which are wise to use
nevertheless -
spatter RTEMS around the /usr
and /opt
directories.
Don't forget this step.
cd build
../rtems-4.5.0/configure --target=i386-rtems
make RTEMS_BSP=pc386
su /* Become root */
make install RTEMS_BSP=pc386
chmod -R 777 /usr/local/pc386
The chmod line is necessary since the RTEMS Makefiles insist on writing into that directory - causing write errors when being an ordinary user.
Compiling RTEMS might take a considerable amount of time (15-20 min on a K6-3/400).
RTEMS requires this additional setting in your environment:
export RTEMS_MAKEFILE_PATH=/usr/local/pc386 (sic!)
Add this line to the end of your personal .bashrc
file. Logout
and login again for the settings to take effect.
(The RTEMS_MAKEFILE_PATH points to the directory where a "Makefile.inc" file resides. )
As an ordinary user type:
cd .../rtems
tar xzf .../pc386_lilo.tgz
You can skip installation and test of the hello_world_demo and go straight to the picoTK RTEMS demo, ch. 5.2.
As ordinary user
cd .../rtems
tar xzf .../hello_world_c.tgz
cd hello_world_c
make
If you get an error about the not writable file in
/usr/local/pc386/...
you can either simply ignore this message or execute the chmod
line
from section "Configure, build and install RTEMS"(
build-rtems
).
There shall be an RTEMS "executable" now named o-optimize/test.exe
cd ..
cd rtems
tar xzf .../pc386_lilo.tgz
cd pc386_lilo
Edit Makefile.inc
. Change the RTEMS_IMAGE=...
line to include
the hello world binary (it is required to enter the full path), e.g.:
RTEMS_IMAGE=$(HOME)/rtems/hello_world_c/o-optimize/test.exe
Then
make
This looks like the end of a Linux kernel compilation and yields
a zImage file. Copy this file to a diskette and check the hello_world
output. There is a bug in some versions of the GNU linker ld
yielding
in the following error:
ld: cannot open binary: No such file or directory
If this is the case edit the Makefile and substitute all occurences of
-oformat
by --oformat
.
Now you are ready to compile the picoTK RTEMS library. This uses the RTEMS cross tool chain and the RTEMS OS installation - i.e. you definitely need to have them installed at this point.
Change directory to where you installed picoTK. Execute
make rtems
This shall yield a file called "libPTKrtems.a" in the toolkit subdirectory. That is the statically linked picoTK library for RTEMS.
cd demo
make rtems
make zImage
Make sure that RTEMS_IMAGE
is pointing to your actual
demo.exe
before executing make zImage
. If you get an error
from ld
please refer to the section describing the
hello_world demo.
This yields a file bootable zImage which can be copied to a diskette
using
cp zImage /dev/fd0
(Depending on the permissions of /dev/fd0
you might have to do this
as root. You can set permissions of /dev/fd0
to 666,
i.e. chmod 666 /dev/fd0
and futurely execute the copy command
as an ordinary user)
Simply boot this diskette on a PC.