Discussion:
How can I get a BSP and start to develop my RTEMS application on Eclipse ? Where is the BSP path ????
João Paulo Scalão Martins
2012-02-15 19:30:03 UTC
Permalink
Hello guys,

I am just a new guy working with RTEMS (really new, I started about 2 days
ago). After reading many "getting started" and "how to" guides, I think
that I've made the correct installation of a prebiult RTEMS tools. for i386.

Now, I have a "/opt/rtems-4.11 folder" working on my Ubuntu. And I've
already install the RTEMS Eclipse plug-in too. So, when I tried to start
with the RTEMS application development on Eclipse, I got the error "make
invocation .... returned with error number 2". That is because I cannot set
the right BSP Path on the properties!

I know what a BSP is, but I still have some basic questions: (real basics
questions)

1 - RTEMS is a Operational System, right? But it is special, it is made for
embedded applications. Ok, I know that. I just want to install a RTEMS
instance, which will run a basic application (that I will develop) on a
Advantech Single Board Computer (with a AMD Geode LX 800 CPU). So, what I
got to do is: write my application in the same "code" of the RTEMS source,
build this "executable" file, pass this file to the Single Board Computer
and ... FINISH!
Am I right?

2 - I know that a BSP is the "code" that the RTEMS Operational System will
use to work with the computer peripherals. So what I got to do is: find a
i386 BSP, get it from Internet, write my code inside it, and then I have my
own RTEMS. Is that correct ?

Assuming that the 2 answers are correct, anyone know where is the BSP path
when I install the RTEMS tools ? I have to "build RTEMS" to have a BSP ?

Guys, once again, forgive my lack of knowledge about RTEMS, I am just
starting by now...

Thanks so much!

Regards from Brazil !!

Joao Paulo
Cláudio Silva
2012-02-15 23:17:17 UTC
Permalink
Hello João,

Yes. RTEMS is a operating system targeted for embedded systems which
supports several architectures and includes BSPs for several boards. I
think you misunderstood: you develop your application separately from
RTEMS sources. During the build process your application will be
linked against the RTEMS libs to provide a full featured bootable
system.

If you were able to install the prebuilt tools, you have accomplished
the first step. Now you must configure and build RTEMS for the target
BSP. I think AMD geode is supported by the RTEMS' pc386 bsp.

First you must download and extract RTEMS sources as explained in
quick start, then you have to configure rtems: (assuming rtems-4.11
sources are in the folder rtems/ in the current dir)

mkdir build-rtems
cd build-rtems
../rtems/configure --target=i386-rtems4.11 --enable-rtemsbsp=pc386
--enable-tests=samples --disable-posix --disable-itron
--prefix=/opt/rtems-4.11
make
make install

If these steps conclude successfully your rtems for PC 386 will be
installed in /opt/rtems-4.11/i386-rtems4.11/pc386
Before your build an application you must inform the buildsystem where
RTEMS is installed. This is made through the RTEMS_MAKEFILE_PATH
environment variable:

export RTEMS_MAKEFILE_PATH=/opt/rtems-4.11/i386-rtems4.11/pc386

Finally for the application, It is easier if start by trying to build
one of the samples provided with RTEMS. You can obtain them from git:

git clone git://git.rtems.org/examples-v2.git examples
cd examples
make

If everything worked correctly you will have a RTEMS hello world
sample in examples/hello_world_c/o-optimize/
You can run this example in QEMU: http://www.rtems.org/wiki/index.php/QEMU

For more information about the process I described:
http://www.rtems.org/onlinedocs/releases/rtemsdocs-4.10.2/share/rtems/html/started/started00062.html
http://wiki.rtems.org/wiki/index.php/Quick_Start
http://wiki.rtems.org/wiki/index.php/Example_Application_Compiling


Regards from Portugal,
Cláudio
Post by João Paulo Scalão Martins
Hello guys,
I am just a new guy working with RTEMS (really new, I started about 2 days
ago). After reading many "getting started" and "how to" guides, I think that
I've made the correct installation of a prebiult RTEMS tools. for i386.
Now, I have a "/opt/rtems-4.11 folder" working on my Ubuntu. And I've
already install the RTEMS Eclipse plug-in too. So, when I tried to start
with the RTEMS application development on Eclipse, I got the error "make
invocation .... returned with error number 2". That is because I cannot set
the right BSP Path on the properties!
I know what a BSP is, but I still have some basic questions: (real basics
questions)
1 - RTEMS is a Operational System, right? But it is special, it is made for
embedded applications. Ok, I know that. I just want to install a RTEMS
instance, which will run a basic application (that I will develop) on a
Advantech Single Board Computer (with a AMD Geode LX 800 CPU). So, what I
got to do is: write my application in the same "code" of the RTEMS source,
build this "executable" file, pass this file to the Single Board Computer
and ... FINISH!
Am I right?
2 - I know that a BSP is the "code" that the RTEMS Operational System will
use to work with the computer peripherals. So what I got to do is: find a
i386 BSP, get it from Internet, write my code inside it, and then I have my
own RTEMS. Is that correct ?
Assuming that the 2 answers are correct, anyone know where is the BSP path
when I install the RTEMS tools ? I have to "build RTEMS" to have a BSP ?
Guys, once again, forgive my lack of knowledge about RTEMS, I am just
starting by now...
Thanks so much!
Regards from Brazil !!
Joao Paulo
_______________________________________________
rtems-users mailing list
http://www.rtems.org/mailman/listinfo/rtems-users
Wendell Pereira da Silva
2012-02-16 10:45:37 UTC
Permalink
João,

You are almost right.

I really recommend you to acquire some knowledge about the RTEMS, specifically:

1. Getting Started

2. Read some examples in the source code (testsuites/samples)

3. RTEMS C User's Guide

Topics 1 and 3 you can get here: http://www.rtems.com/onlinedocs.html

Probably you should start with a stable (release) version of RTEMS. For example, 4.10.2.

As an RTEMS user, you have to complete the following tasks:


1. Prepare the environment.

a. Get RTEMS tool chains for your BSP (i386 in your case)

b. Get the RTEMS source code

c. Bootstrap it

d. Build RTEMS for pc386 BSP

e. Install the generated libraries

2. Creating your own code

a. Probably the best option is to create your own Makefile from a template (e.g . rtems/make/Templates/Makefile.leaf)

b. Produce the code and edit the Makefile

c. Build the code: generating a bootable image

d. You can test it with QEMU (run and/or debug)

3. Deploy the bootable image in your target board.

a. ... well, this is taking too long!

Try to do all if it without Eclipse. Just to be aware of the whole process.

The RTEMS wiki is a very good source of information http://www.rtems.org/wiki/index.php.

--
Att.
Wendell

De: rtems-users-bounces-***@public.gmane.org [mailto:rtems-users-bounces-***@public.gmane.org] Em nome de João Paulo Scalão Martins
Enviada em: quarta-feira, 15 de fevereiro de 2012 17:30
Para: rtems-users-***@public.gmane.org
Assunto: How can I get a BSP and start to develop my RTEMS application on Eclipse ? Where is the BSP path ????

Hello guys,

I am just a new guy working with RTEMS (really new, I started about 2 days ago). After reading many "getting started" and "how to" guides, I think that I've made the correct installation of a prebiult RTEMS tools. for i386.

Now, I have a "/opt/rtems-4.11 folder" working on my Ubuntu. And I've already install the RTEMS Eclipse plug-in too. So, when I tried to start with the RTEMS application development on Eclipse, I got the error "make invocation .... returned with error number 2". That is because I cannot set the right BSP Path on the properties!

I know what a BSP is, but I still have some basic questions: (real basics questions)

1 - RTEMS is a Operational System, right? But it is special, it is made for embedded applications. Ok, I know that. I just want to install a RTEMS instance, which will run a basic application (that I will develop) on a Advantech Single Board Computer (with a AMD Geode LX 800 CPU). So, what I got to do is: write my application in the same "code" of the RTEMS source, build this "executable" file, pass this file to the Single Board Computer and ... FINISH!
Am I right?

2 - I know that a BSP is the "code" that the RTEMS Operational System will use to work with the computer peripherals. So what I got to do is: find a i386 BSP, get it from Internet, write my code inside it, and then I have my own RTEMS. Is that correct ?

Assuming that the 2 answers are correct, anyone know where is the BSP path when I install the RTEMS tools ? I have to "build RTEMS" to have a BSP ?

Guys, once again, forgive my lack of knowledge about RTEMS, I am just starting by now...

Thanks so much!

Regards from Brazil !!

Joao Paulo
João Paulo Scalão Martins
2012-02-16 20:11:21 UTC
Permalink
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
Wendell Silva
2012-02-17 03:12:43 UTC
Permalink
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

See:
http://www.rtems.org/wiki/index.php/Building_the_RTEMS_toolset_on_Ubuntu

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
user:

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

$ 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://git.rtems.org/rtems.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"
--enable-tests="samples"
(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
export PATH=$RTEMS_HOME/bin:$PATH

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)
./i386-rtems4.11/c/pc386/testsuites/samples/ticker/ticker.exe
./i386-rtems4.11/c/pc386/testsuites/samples/minimum/minimum.exe
./i386-rtems4.11/c/pc386/testsuites/samples/hello/hello.exe
./i386-rtems4.11/c/pc386/testsuites/samples/pppd/pppd.exe
./i386-rtems4.11/c/pc386/testsuites/samples/fileio/fileio.exe
(... 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
./i386-rtems4.11/c/pc386/testsuittes/samples/ticker/ticker.exe
( you should see the follwing output: )
More info: http://www.rtems.org/wiki/index.php/QEMU

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
boot.

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:
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/indigo/SR1/eclipse-linuxtools-indigo-SR1-incubation-linux-gtk-x86_64.tar.gz
)

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 "Name" write: RTEMS_MAKEFILE_PATH
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
/home/joao/workspace/rtems-app/Makefile

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_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)

#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:
#define CONFIGURE_INIT
#include "system.h"

rtems_task Init(rtems_task_argument argument)
{
int i = 0;

for (;;)
{
rtems_task_wake_after(RTEMS_MILLISECONDS_TO_TICKS(1000));
printk("%d RTEMS rocks!\n", i);
i++;
}

rtems_shutdown_executive(0);
}

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

Change: CC_PIECES=xxxa xxxb xxxc
To: CC_PIECES=

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

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

To:
LD_PATHS +=
LD_LIBS +=

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

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
o-optimize/init.o
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
o-optimize/rtems-app.nxe
i386-rtems4.11-objcopy -O binary o-optimize/rtems-app.nxe
o-optimize/rtems-app.bin
/home/wendell/rtems/bsp-install/i386-rtems4.11/pc386/build-tools/bin2boot
-v o-optimize/rtems-app.ralf 0x00097E00
/home/wendell/rtems/bsp-install/i386-rtems4.11/pc386/lib/start16.bin
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
or
$ qemu -kernel o-optimize/rtems-app.exe

Well, I hope it helps you now.

Best regards (from Brazil also! :-)

--
Att.
Wendell.


Em 16 de fevereiro de 2012 18:11, João Paulo Scalão Martins <
Post by João Paulo Scalão Martins
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!
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
http://www.rtems.org/mailman/listinfo/rtems-users
--
Att.
Wendell P. Silva
+55 12 8114-8018
Loading...