Skip to contentSkip to conversation

special glibc support for Xenomai?

Xenomai-help Steven Scholz 3 participants 9 messages Jan 17, 2007 – Jan 18, 2007

lore
Share & tools
lore
#0 lore raw

Hi all,

I wonder if I would need a special glibc support in order to build and run xenomai applications.

Especially I think about high resolution timer support and NTPL thread library (which would be need if I'd do plain
http://people.redhat.com/mingo/realtime-preempt right).

Thanks a million!

Steven

#1 lore raw
Quoted 5 lines · Steven Scholz

Hi all,

I wonder if I would need a special glibc support in order to build and run xenomai applications.

In short, no. You could use the oldish linuxthreads, or the NPTL as you see fit, from any glibc version. Hi-res timing is provided by the Xenomai nucleus directly, and it is implicitely made available by the Xenomai APIs to the bound applications.

In the particular POSIX case, calling e.g. nanosleep() over a Xenomai thread context already gives you a microsecond-level precision for timings. You just need to make sure to compile/link with the hardened Xenomai POSIX library, try running:

$ xeno-config --posix-cflags|--posix-ldflags.
Quoted 12 lines

Especially I think about high resolution timer support and NTPL thread library (which would be need if I'd do plain
http://people.redhat.com/mingo/realtime-preempt right).

Thanks a million!

Steven

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#2 lore raw

Philippe,

Quoted 5 lines
Quoted 2 lines

I wonder if I would need a special glibc support in order to build and run xenomai applications.

In short, no. You could use the oldish linuxthreads, or the NPTL as you see fit, from any glibc version...

Thanks.

Quoted 3 lines

... Hi-res timing is provided by the
Xenomai nucleus directly, and it is implicitely made available by the Xenomai APIs to the bound applications.

But that would need some low level support for my special platform? Cause hrtimers are platform specific. Right?

Quoted 3 lines

In the particular POSIX case, calling e.g. nanosleep() over a Xenomai thread context already gives you a microsecond-level precision for timings.

Ok.

Quoted 3 lines

You just need to make sure to compile/link with the hardened Xenomai POSIX library, try running:

$ xeno-config --posix-cflags|--posix-ldflags.

What does it do?
Can I use it for cross-compiling as well?

Steven

#3 lore raw
Quoted 7 lines · Steven Scholz

Philippe,

Quoted 5 lines
Quoted 2 lines

I wonder if I would need a special glibc support in order to build and run xenomai applications.

In short, no. You could use the oldish linuxthreads, or the NPTL as you see fit, from any glibc version...

Quoted 8 lines

Thanks.

Quoted 3 lines

... Hi-res timing is provided by the
Xenomai nucleus directly, and it is implicitely made available by the Xenomai APIs to the bound applications.

But that would need some low level support for my special platform? Cause hrtimers are platform specific. Right?

Since Xenomai implements its own hi-res timers, the "only" thing you need is to have it ported over your platform of choice. The Xenomai (user-space) API side is totally independent from the way hi-res timing is obtained.

Quoted 10 lines
Quoted 4 lines

In the particular POSIX case, calling e.g. nanosleep() over a Xenomai thread context already gives you a microsecond-level precision for timings.

Ok.

Quoted 3 lines

You just need to make sure to compile/link with the hardened Xenomai POSIX library, try running:

$ xeno-config --posix-cflags|--posix-ldflags.

What does it do?

It returns the proper CFLAGS and LDFLAGS to use in order to compile a POSIX application using the Xenomai hardened POSIX library. In short, libpthread.so is partially shadowed by our libpthread_rt.so library. What's not shadowed remains handled by the vanilla glibc/Linux code, the rest is handled by Xenomai, i.e. with timeliness and predictability in mind.

Quoted 2 lines

Can I use it for cross-compiling as well?

Same principles.

Quoted 1 line

Steven

Signature · 1 line
Philippe.
#4 lore raw

Philippe,

Quoted 8 lines
Quoted 4 lines
Quoted 3 lines

You just need to make sure to compile/link with the hardened Xenomai POSIX library, try running:

$ xeno-config --posix-cflags|--posix-ldflags.

What does it do?

It returns the proper CFLAGS and LDFLAGS to use in order to compile a POSIX application using the Xenomai hardened POSIX library. In short, libpthread.so is partially shadowed by our libpthread_rt.so library.

xeno-config --verbose

    --version="2.3.50"
    --cc="arm-softfloat-linux-gnu-gcc"
    --arch="arm"
    --prefix="/usr/xenomai"
    --xeno-cflags="-I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT"
    --xeno-ldflags="-L/usr/xenomai/lib -lpthread "
    --posix-cflags="-I/usr/xenomai/include -I/usr/xenomai/include/posix

-D_GNU_SOURCE -D_REENTRANT -D__XENO__"
--posix-ldflags="-L/usr/xenomai/lib -lpthread_rt -lpthread -lrt " --library-dir="/usr/xenomai/lib"

Sorry. I have to ask again. What am I supposed to do with these lines? Shell I use all of it whenn calling arm-softfloat-linux-gnu-gcc to compile my application?

Thanks!

Steven

#5 lore raw
Quoted 22 lines · Steven Scholz

Philippe,

Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

You just need to make sure to compile/link with the hardened Xenomai POSIX library, try running:

$ xeno-config --posix-cflags|--posix-ldflags.

What does it do?

It returns the proper CFLAGS and LDFLAGS to use in order to compile a POSIX application using the Xenomai hardened POSIX library. In short, libpthread.so is partially shadowed by our libpthread_rt.so library.

xeno-config --verbose

    --version="2.3.50"
    --cc="arm-softfloat-linux-gnu-gcc"
    --arch="arm"
    --prefix="/usr/xenomai"
    --xeno-cflags="-I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT"
    --xeno-ldflags="-L/usr/xenomai/lib -lpthread "
    --posix-cflags="-I/usr/xenomai/include -I/usr/xenomai/include/posix
Quoted 7 lines

-D_GNU_SOURCE -D_REENTRANT -D__XENO__"
--posix-ldflags="-L/usr/xenomai/lib -lpthread_rt -lpthread -lrt " --library-dir="/usr/xenomai/lib"

Sorry. I have to ask again. What am I supposed to do with these lines? Shell I use all of it whenn calling arm-softfloat-linux-gnu-gcc to compile my application?

Yes, you should pass the result of xeno-config --posix-cflags and xeno-config --posix-ldflags to arm-softfloat-linux-gnu-gcc. When running xeno-config --posix-ldflags here, I get:

-Wl,--wrap,pthread_create -Wl,--wrap,pthread_setschedparam -Wl,--wrap,pthread_getschedparam -Wl,--wrap,pthread_yield -Wl,--wrap,sched_yield -Wl,--wrap,sem_init -Wl,--wrap,sem_destroy -Wl,--wrap,sem_post -Wl,--wrap,sem_timedwait -Wl,--wrap,sem_wait -Wl,--wrap,sem_trywait -Wl,--wrap,sem_getvalue -Wl,--wrap,sem_open -Wl,--wrap,sem_close -Wl,--wrap,sem_unlink -Wl,--wrap,clock_getres -Wl,--wrap,clock_gettime -Wl,--wrap,clock_settime -Wl,--wrap,clock_nanosleep -Wl,--wrap,nanosleep -Wl,--wrap,pthread_mutexattr_init -Wl,--wrap,pthread_mutexattr_destroy -Wl,--wrap,pthread_mutexattr_gettype -Wl,--wrap,pthread_mutexattr_settype -Wl,--wrap,pthread_mutexattr_getprotocol -Wl,--wrap,pthread_mutexattr_setprotocol -Wl,--wrap,pthread_mutexattr_getpshared -Wl,--wrap,pthread_mutexattr_setpshared -Wl,--wrap,pthread_mutex_init -Wl,--wrap,pthread_mutex_destroy -Wl,--wrap,pthread_mutex_lock -Wl,--wrap,pthread_mutex_trylock -Wl,--wrap,pthread_mutex_timedlock -Wl,--wrap,pthread_mutex_unlock -Wl,--wrap,pthread_condattr_init -Wl,--wrap,pthread_condattr_destroy -Wl,--wrap,pthread_condattr_getclock -Wl,--wrap,pthread_condattr_setclock -Wl,--wrap,pthread_condattr_getpshared -Wl,--wrap,pthread_condattr_setpshared -Wl,--wrap,pthread_cond_init -Wl,--wrap,pthread_cond_destroy -Wl,--wrap,pthread_cond_wait -Wl,--wrap,pthread_cond_timedwait -Wl,--wrap,pthread_cond_signal -Wl,--wrap,pthread_cond_broadcast -Wl,--wrap,mq_open -Wl,--wrap,mq_close -Wl,--wrap,mq_unlink -Wl,--wrap,mq_getattr -Wl,--wrap,mq_setattr -Wl,--wrap,mq_send -Wl,--wrap,mq_timedsend -Wl,--wrap,mq_receive -Wl,--wrap,mq_timedreceive -Wl,--wrap,mq_notify -Wl,--wrap,open -Wl,--wrap,socket -Wl,--wrap,close -Wl,--wrap,ioctl -Wl,--wrap,read -Wl,--wrap,write -Wl,--wrap,recvmsg -Wl,--wrap,sendmsg -Wl,--wrap,recvfrom -Wl,--wrap,sendto -Wl,--wrap,recv -Wl,--wrap,send -Wl,--wrap,getsockopt -Wl,--wrap,setsockopt -Wl,--wrap,bind -Wl,--wrap,connect -Wl,--wrap,listen -Wl,--wrap,accept -Wl,--wrap,getsockname -Wl,--wrap,getpeername -Wl,--wrap,shutdown -Wl,--wrap,timer_create -Wl,--wrap,timer_delete -Wl,--wrap,timer_settime -Wl,--wrap,timer_getoverrun -Wl,--wrap,timer_gettime -Wl,--wrap,ftruncate -Wl,--wrap,close -Wl,--wrap,shm_open -Wl,--wrap,shm_unlink -Wl,--wrap,mmap -Wl,--wrap,munmap -L/home/gcx/repository/HardV3/linux2.6/trunk/lib/xenomai/inst//lib -lpthread_rt -lpthread -lrt

The wrapped calls are handled by xenomai libpthread_rt.so library.

Signature · 1 line
                                                 Gilles Chanteperdrix
#6 lore raw

Gilles,

Quoted 10 lines
Quoted 3 lines

Sorry. I have to ask again. What am I supposed to do with these lines? Shell I use all of it whenn calling arm-softfloat-linux-gnu-gcc to compile my application?

Yes, you should pass the result of xeno-config --posix-cflags and xeno-config --posix-ldflags to arm-softfloat-linux-gnu-gcc. When running xeno-config --posix-ldflags here, I get:

-Wl,--wrap,pthread_create -Wl,--wrap,pthread_setschedparam
...

Ah. Thanks! Passing these flags seems to work now.
But I had to copy and paste it from your mail since when I run ./xeno-config --posix-ldflags I get

POSIX support is not available

???

How is that?

Steven

#7 lore raw
Quoted 9 lines · Steven Scholz

Ah. Thanks! Passing these flags seems to work now.
But I had to copy and paste it from your mail since when I run ./xeno-config --posix-ldflags I get

POSIX support is not available

???

How is that?

These flags are stored in the posix.wrappers file. xeno-config has to find it. So, if you installed Xenomai with DESTDIR set to a non null value you should set DESTDIR to the same value in xeno-config environment.

Signature · 1 line
                                                 Gilles Chanteperdrix
#8 lore raw
In reply to Steven Scholz
Quoted 12 lines · Steven Scholz

Gilles,

Quoted 9 lines
Quoted 3 lines

Sorry. I have to ask again. What am I supposed to do with these lines? Shell I use all of it whenn calling arm-softfloat-linux-gnu-gcc to compile my application?

Yes, you should pass the result of xeno-config --posix-cflags and xeno-config --posix-ldflags to arm-softfloat-linux-gnu-gcc. When running xeno-config --posix-ldflags here, I get:

-Wl,--wrap,pthread_create -Wl,--wrap,pthread_setschedparam
...

Quoted 7 lines

Ah. Thanks! Passing these flags seems to work now.
But I had to copy and paste it from your mail since when I run ./xeno-config --posix-ldflags I get

POSIX support is not available

???

Ah. Ok. Nevermind. I was using the script on my developent hsot where no xenomai libs are install. Running it directly on the target I get all these linker flags as well.

Thanks

Steven