Skip to contentSkip to conversation

How to use Xenomai in Eclipse

Xenomai Frede Florian 3 participants 4 messages Jul 24, 2014 – Jul 27, 2014

lore
Share & tools
lore
#0 lore raw

Hello,

We plan to use Xenomai in our new project. So now I tried to prepare a Eclipse-Project with Xenomai. First I compiled the Debian packages from Xenomai 2.6.3 <http://www.xenomai.org/index.php/Building_Debian_packages> for my System. After that I install the libxenomai1 and libxenomai-dev

After that I have create a new empty project. There I can include the Xenomailib (#include <xenomai/native/task.h>).

First issue: While compiling the code with Eclipse I get an*fatal error: nucleus/sched.h: file or directory not found*...

I try to find a answer in the endless world wide web :-) but I didn't found a solution.

Second issue: When I change to the compiler for my target platform (arm-cortexa8-linux-gnueabihf-gcc) I can not include the Xenomai library?

I use following Software on my System: Eclipse Version: Luna Release (4.4.0), Debian GNU/Linux 7.6 (wheezy), Xenomai 2.6.3, OSELAS.Toolchain-2013.12.2 <http://www.pengutronix.de/oselas/toolchain/download/OSELAS.Toolchain-2013.12.2.tar.bz2>

Regards Florian

#1 lore raw
Quoted 17 lines · Frede Florian

Hello,

We plan to use Xenomai in our new project. So now I tried to prepare a Eclipse-Project with Xenomai. First I compiled the Debian packages from Xenomai 2.6.3
<http://www.xenomai.org/index.php/Building_Debian_packages> for my System. After that I install the libxenomai1 and libxenomai-dev

After that I have create a new empty project. There I can include the Xenomailib (#include <xenomai/native/task.h>).

First issue: While compiling the code with Eclipse I get an*fatal
error: nucleus/sched.h: file or directory not found*...

I try to find a answer in the endless world wide web :-) but I didn't found a solution.

Quoted 7 lines

Second issue: When I change to the compiler for my target platform (arm-cortexa8-linux-gnueabihf-gcc) I can not include the Xenomai library?

I use following Software on my System: Eclipse Version: Luna Release
(4.4.0), Debian GNU/Linux 7.6 (wheezy), Xenomai 2.6.3,
OSELAS.Toolchain-2013.12.2 <http://www.pengutronix.de/oselas/toolchain/download/OSELAS.Toolchain-2013.12.2.tar.bz2>

You usually have to explicitly specify /usr/include/xenomai as an include directory when working with xenomai, given the xenomai files don't put the xenomai part of the path in the #include statements.

Of course if cross compiling you would have to have the header files for your target in the correct place and add that to the include path.

Using pkg-config would pretty much just take care of it for you of course.

For example:

root@omap5:~# pkg-config --cflags libxenomai_native
-D_GNU_SOURCE -D_REENTRANT -D__XENO__ -I/usr/include/xenomai  

So you would make sure your makefile had:

CFLAGS += $(shell pkg-config --cflags libxenomai_native) LIBS += $(shell pkg-config --libs libxenomai_native)

I can't remember the syntax for using pkg-config for cross compiling at the moment, but I remember there is one. I almost never cross compile so I don't remember it.

Signature · 1 line
Len Sorensen
#2 lore raw

Thanks for the fast help,

seems to work for me I used the wrong directory in the includes... also the arm cross compiler seems to work.

Regards Florian

Quoted 22 lines

You usually have to explicitly specify /usr/include/xenomai as an include directory when working with xenomai, given the xenomai files don't put the xenomai part of the path in the #include statements.

Of course if cross compiling you would have to have the header files for your target in the correct place and add that to the include path.

Using pkg-config would pretty much just take care of it for you of course.

For example:

root@omap5:~# pkg-config --cflags libxenomai_native
-D_GNU_SOURCE -D_REENTRANT -D__XENO__ -I/usr/include/xenomai

So you would make sure your makefile had:

CFLAGS += $(shell pkg-config --cflags libxenomai_native) LIBS += $(shell pkg-config --libs libxenomai_native)

I can't remember the syntax for using pkg-config for cross compiling at the moment, but I remember there is one. I almost never cross compile so I don't remember it.

#3 lore raw
In reply to Lennart Sorensen
Quoted 7 lines · Lennart Sorensen

CFLAGS += $(shell pkg-config --cflags libxenomai_native) LIBS += $(shell pkg-config --libs libxenomai_native)

I can't remember the syntax for using pkg-config for cross compiling at the moment, but I remember there is one. I almost never cross compile so I don't remember it.

In order to use pkg-config for cross-compiling, you have to use some environment variables.

I use:

	PKG_CONFIG_LIBDIR=$(staging)/usr/lib/pkgconfig:$(staging)/usr/share/pkgconfig \
	PKG_CONFIG_SYSROOT_DIR=$(staging) \
	PKG_CONFIG_ALLOW_SYSTEM_LIBS=y \
	PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=y

Where $(staging) is the directory passed to the DESTDIR variable when installing xenomai.

Signature · 1 line
                                                                Gilles.