How can I get a BSP and start to develop my RTEMS application on Eclipse ? Where is the BSP path ????

Wendell Silva silvawp at
Fri Feb 17 03:12:43 UTC 2012

Ok, João,

Let's try the following steps, and at the end, with some lucky, we'll get
RTEMS 4.11 development environment for i386/pc386 BSP up and running, on
Ubuntu, with Eclipse. I hadn't had time to make it shorter, so take a deep
breath and read this long text:

1 - Prepare your Ubuntu with the required packages to build the RTEMS
(GNU-based) tool-chains, presuming Ubuntu 10.10, run:

sudo aptitude install m4 patch  build-essential texinfo cvs \
    libncurses5-dev libgmp3-dev libmpfr-dev libmpc-dev autoconf \
    autotools-dev automake


2 - Build RTEMS tools: Follow the Phase 2 mentioned in the link above. In
summary: get tools tarballs of the tools, and, for each tool, apply patches
(if needed), configure, make, make install. *HOWEVER*, in your case, you
want to a different target, since your Board Support Package (BSP) matches
i386/pc386, use *--target=i386-rtems4.11* instead of
--target=powerpc-rtems4.11 when configuring each tool.
Another thing to worry about: probably you need to be logged as root to
perform the build process (I'm not sure on Ubuntu - I'd never use it, BTW).

3 - Build RTEMS for you BSP
By this time you probably have /opt/rtems-4.11/bin full of files. If this
is true (and you are lucky... :-), run the following steps as a non-root

(presuming you are logged as 'joao', and the current directory is

$ export RTEMS_HOME=/opt/rtems-4.11
$ export PATH=$RTEMS_HOME/bin:$PATH
$ mkdir rtems-4.11-work
$ cd rtems-4.11-work
$ git clone git://
(this is going to download the rtems source code, version 4.10.99 - which
will become 4.11 upon release)
$ cd rtems
$ ./bootstrap
(this is going to prepare the rtems source for your environment; 'Makefile'
is created as well as the 'configure' script)
$ cd ..
$ mkdir b-pc386
$ cd b-pc386
$ ../rtems/configure --target=i386-rtems4.11
--prefix=/home/joao/rtems-4.11-work/bsp-install --enable-rtemsbsp="pc386"
(this is going to prepare the current directory to hold the temporary
stuffs created during the build process).
$ make all
(now actually building something :-)
$ make install
(note that /home/joao/rtems-4.11-work/bsp-install was created)

Don't forget to put

export RTEMS_HOME=/opt/rtems-4.11

in your ~/.bashrc (or ~/.bash_profile) to make these variables available
next time you boot your system.

4 - Testing
Since --enable-tests=samples was used, RTEMS samples was generated.
Find all of them just for fun:
$ find . -name *.exe
(this yields something like the following - all of them are bootable
images, besides the .exe extension)
(... lines suppressed...)

I recommend you to use qemu to test them; it will be useful to help you in
the development tasks like, debuging without the need of the real hardware.
If you does not have qemu yet, now is a good time to installing it. For
you, 'sudo apt-get install qemu' may work.
If you already has qemu installed:

$ qemu -kernel
( you should see the follwing output: )
More info:

5. Run bootable image on your target.
There are many options available. One of them is grub on a pen drive or
installed in your target's flash/hdd drive. Another one is iPXE network

6. Create your own application (ok, you won... with Eclipse):
Download and install the latest eclipse for GNU/Linux C/C++ developers (get
it from:

Open eclipse and File | New ... | C Project
In 'Project type' select: Makefile project | Empty Project
In 'Toolchains' select: Cross GCC
In 'Project name' write rtems-app
Click Next, then Finish

Select the project in the Project explorer, them click File | Properties
Select C/C++ Build | Environment, them click 'Add...' to add a new
environment variable, then:
In "Value"
write: /home/joao/rtems-4.11-work/bsp-install/i386-rtems4.11/pc386
Check "Add to all configurations", then click OK.
Select C/C++ | Paths and Symbols, then click 'Add...' to add a new path to
tell eclipse where RTEMS include files are.
In "Directory:" put ${RTEMS_MAKEFILE_PATH}/lib/include
Check "Add to all configurations" and "Add to all languages"
Click OK (close dialog)
Click OK (close properties dialog)

Presuming your eclipse workspace is at /home/joao/workspace, on a shell do:
$ cp /home/joao/rtems-4.11-work/rtems/make/Templates/Makefile.leaf

Back to to eclipse project, press F5 to refresh your project. You probably
can see the Makefile in the project's tree.

Add a new C header file to your project (File | New | Header file), named
system.h, and put the following content in there:
#ifndef SYSTEM_H_
#define SYSTEM_H_

#include <bsp.h> /* for device driver prototypes */

#define CONFIGURE_MAXIMUM_TASKS             4

#include <rtems/confdefs.h>

#endif /* SYSTEM_H_ */

Add a new C source file to your project (File | New | C Source file), named
init.c, and put the following content in there:
#include "system.h"

rtems_task Init(rtems_task_argument argument)
   int i = 0;

   for (;;)
  printk("%d RTEMS rocks!\n", i);


Edit the Makefile and alter the following lines:
Change: C_PIECES=xxxd xxxe xxxf
To: C_PIECES=init

Change: CC_PIECES=xxxa xxxb xxxc

Change: H_FILES=
To: H_FILES=system.h

Change: PGMS=${ARCH}/xxx-your-program-here ${ARCH}/xxx-another-one
to: PGMS=${ARCH}/rtems-app.exe

LD_PATHS  += xxx-your-EXTRA-library-paths-go-here, if any
LD_LIBS   += xxx-your-libraries-go-here eg: -lvx

LD_LIBS   +=

Change: CLEAN_ADDITIONS += xxx-your-debris-goes-here

Change: ${ARCH}/xxx-your-program-here: ${OBJS} ${LINK_FILES}
To: ${ARCH}/rtems-app.exe: ${OBJS} ${LINK_FILES}

Save Makefile

Now you should be able to create the make targets 'all' and 'clean', in the
"Make targets" view.
Just click "Create make target" there, and in "Target name", just write
'all' (without quotes). Do the same for the 'clean' make target.

Click 'all' in that view, and you should be able to see the build output in
the "Console" view, like:
**** Build of configuration Default for project rtems-app ****

make all
test -d o-optimize || mkdir o-optimize
i386-rtems4.11-gcc --pipe
-B/home/wendell/rtems/bsp-install/i386-rtems4.11/pc386/lib/ -specs
bsp_specs -qrtems   -g -Wall  -O2 -g -g     -mtune=i386      -c   -o
o-optimize/init.o init.c
i386-rtems4.11-gcc --pipe
-B/home/wendell/rtems/bsp-install/i386-rtems4.11/pc386/lib/ -specs
bsp_specs -qrtems   -g -Wall  -O2 -g -g     -mtune=i386
 -Wl,-Ttext,0x00100000    -mtune=i386   -o o-optimize/rtems-app.exe
i386-rtems4.11-nm -g -n o-optimize/rtems-app.exe > o-optimize/rtems-app.num
i386-rtems4.11-size o-optimize/rtems-app.exe
   text   data    bss    dec    hex filename
 174057  10256   8836 193149  2f27d o-optimize/rtems-app.exe
i386-rtems4.11-objcopy -O elf32-i386 --remove-section=.comment
--remove-section=.note --strip-unneeded o-optimize/rtems-app.exe
i386-rtems4.11-objcopy -O binary o-optimize/rtems-app.nxe
-v o-optimize/rtems-app.ralf 0x00097E00
0x00097C00 0 o-optimize/rtems-app.bin 0x00100000 0
header address       0x00097e00, its memory size 0x00000200
first  image address 0x00097c00, its memory size 0x00000200
second image address 0x00100000, its memory size 0x0002da00
rm -f o-optimize/rtems-app.nxe

**** Build Finished ****

The file rtems-app.exe should be created in the folder o-optimize. Use qemu
to run it:
$ cd ~/workspace/rtems-app
$ qemu-system-i386 -kernel o-optimize/rtems-app.exe
$ qemu -kernel o-optimize/rtems-app.exe

Well, I hope it helps you now.

Best regards (from Brazil also! :-)


Em 16 de fevereiro de 2012 18:11, João Paulo Scalão Martins <
joaopaulosm at> escreveu:

> Thank you so much guys!
> But I'm still having basic problems. The RTEMS building didn't work
> correctly, so I decided to start it all over again. I need to build the
> binutils, gcc-core and newlib, etc..
> The problem is: there are too many versions! RTEMS Tools version 4.11,
> RTEMS building version 4.10.2 ... I'm just getting crazy!
> I need your help one more time:
> 1 - Where is the best place (rtems ftp, git repository, cvs repository,
> apt-yum repository) to get the tool chain files ????? And which one should
> I download? The 4.10.2 or 4.11 ? Where are the 4.10.2 sources ????
> (my host machine is a Intel Core 2 Duo 64bits, running Ubuntu, and my
> target is a AMD Geode).
> 2 - Where is the best place to download the files for BUILD the RTEMS and
> examples ??
> Thank you, once again!
> Best regards,
> Joao
> _______________________________________________
> rtems-users mailing list
> rtems-users at

Wendell P. Silva
+55 12 8114-8018
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list