Skip to contentSkip to conversation

using the RTAI skin

Xenomai-help [email protected] 3 participants 5 messages Jan 21, 2010

lore
Share & tools
lore
#0 lore raw

Hello all,

I'm doing some investigation on migrating my application from RTAI to Xenomai. From the description of a Xenomai skin, it seems like I might be able to use the RTAI skin to run my application "as is". Along this line, I put together a small test application in RTAI that would be very illustrative if I can get it to run in Xenomai. The first step is of course compiling it which I haven't been able to do because of missing references to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels like helping out, we could work through this whole process (from an RTAI app to running on Xenomai) and turn this into another example to add to the examples folder for future reference. Here's the application I'm trying to compile (the Makefile I just adapted from the native examples folder and changed the application name):

<CODE SNIP>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>

#include <rtai_lxrt.h>

int main(int argc, char *argv[])
{

	RT_TASK *rttsk;
	RTIME period;
	int  hrt = 1;
	int idx, end = 0;
	
	rt_allow_nonroot_hrt();

        if (!(rttsk = rt_task_init_schmod(nam2num("RTTSK"), 2, 0, 0, 
SCHED_FIFO, 0xF))) {
		printf("CANNOT INIT THE TASK\n");
		exit(1);
	}

	/*****************************************************************/
	/* start the scheduler */
	
	rt_set_oneshot_mode();
	start_rt_timer(0);
	
	/*****************************************************************/
	/***********************************************************/
	/* run the task */
	
	mlockall(MCL_CURRENT | MCL_FUTURE);
	
	printf("\nSTARTING TASK\n\n");
	if (hrt) rt_make_hard_real_time();  
	
	if (hrt) {
		rt_printk("\nTASK RUNNING\n\n");
	}else{
		printf("\nTASK RUNNING\n\n");
	}

	period = nano2count(1e8);
	
	rt_task_make_periodic(rttsk, rt_get_time(), period);

	for (idx = 0; idx < 10 && !end; idx++) {	
		if (hrt) {
			rt_printk("Finished step %d\n", idx);
			printf("Finished step %d\n", idx);
		} else {
			printf("Finished step %d\n", idx);
		}
	
		/* pause */
		rt_task_wait_period();
	}
	

	rt_sleep(nano2count(1E8));	
	rt_make_soft_real_time();
	
	/***********************************************************/

	stop_rt_timer();	
	rt_task_delete(rttsk);
	printf("\nTASK STOPPED\n");
	return 0;
}

</CODE SNIP>

#1 lore raw
Quoted 14 lines · [email protected] wrote:

Hello all,

I'm doing some investigation on migrating my application from RTAI to Xenomai. From the description of a Xenomai skin, it seems like I might be able to use the RTAI skin to run my application "as is". Along this line, I put together a small test application in RTAI that would be very illustrative if I can get it to run in Xenomai. The first step is of course compiling it which I haven't been able to do because of missing references to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels like helping out, we could work through this whole process (from an RTAI app to running on Xenomai) and turn this into another example to add to the examples folder for future reference. Here's the application I'm trying to compile (the Makefile I just adapted from the native examples folder and changed the application name):

The RTAI skin is mostly kernel-space. User-space only supports a few things (like shared memory). In an case, to find what is supported, check src/skins/rtai in xenomai sources tree.

In the makefile, what is important is:

XENO_DESTDIR=/path/to/xenomai/installation/root XENO_CONFIG=$(XENO_DESTDIR)/usr/local/bin/xeno-config) XENO_RTAI_CPPFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --cflags) XENO_RTAI_LDFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --ldflags) -lrtai

then add XENO_RTAI_CPPFLAGS to your program CPPFLAGS or CFLAGS, and add XENO_RTAI_LDFLAGS to your program LDFLAGS.

Signature · 4 lines
Gilles Chanteperdrix, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw
Quoted 16 lines · Gilles Chanteperdrix
Quoted 10 lines · [email protected] wrote:

Hello all,

I'm doing some investigation on migrating my application from RTAI to Xenomai. From the description of a Xenomai skin, it seems like I might be able to use the RTAI skin to run my application "as is". Along this line, I
put together a small test application in RTAI that would be very illustrative if I can get it to run in Xenomai. The first step is of course compiling it which I haven't been able to do because of missing references
to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels like
helping out, we could work through this whole process (from an RTAI app to
running on Xenomai) and turn this into another example to add to the examples folder for future reference. Here's the application I'm trying to compile (the Makefile I just adapted from the native examples folder and changed the application name):

The RTAI skin is mostly kernel-space. User-space only supports a few things (like shared memory). In an case, to find what is supported, check src/skins/rtai in xenomai sources tree.

In the makefile, what is important is:

Quoted 10 lines

XENO_DESTDIR=/path/to/xenomai/installation/root XENO_CONFIG=$(XENO_DESTDIR)/usr/local/bin/xeno-config) XENO_RTAI_CPPFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --cflags) XENO_RTAI_LDFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --ldflags) -lrtai

then add XENO_RTAI_CPPFLAGS to your program CPPFLAGS or CFLAGS, and add XENO_RTAI_LDFLAGS to your program LDFLAGS.

Oh I see. This is helpful thanks Gilles. I'll give this a try and report back on my progress.

Jesse

#3 lore raw
Quoted 36 lines · [email protected] wrote:
Quoted 34 lines · Gilles Chanteperdrix
Quoted 13 lines · [email protected] wrote:

Hello all,

I'm doing some investigation on migrating my application from RTAI to Xenomai. From the description of a Xenomai skin, it seems like I might be
able to use the RTAI skin to run my application "as is". Along this line, I
put together a small test application in RTAI that would be very illustrative if I can get it to run in Xenomai. The first step is of course
compiling it which I haven't been able to do because of missing references
to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels

Quoted 8 lines

like
helping out, we could work through this whole process (from an RTAI app to
running on Xenomai) and turn this into another example to add to the examples folder for future reference. Here's the application I'm trying to
compile (the Makefile I just adapted from the native examples folder and changed the application name):

The RTAI skin is mostly kernel-space. User-space only supports a few things (like shared memory). In an case, to find what is supported, check src/skins/rtai in xenomai sources tree.

In the makefile, what is important is:

XENO_DESTDIR=/path/to/xenomai/installation/root XENO_CONFIG=$(XENO_DESTDIR)/usr/local/bin/xeno-config) XENO_RTAI_CPPFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --cflags) XENO_RTAI_LDFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --ldflags) -lrtai

Quoted 7 lines
Quoted 4 lines

then add XENO_RTAI_CPPFLAGS to your program CPPFLAGS or CFLAGS, and add XENO_RTAI_LDFLAGS to your program LDFLAGS.

Oh I see. This is helpful thanks Gilles. I'll give this a try and report back on my progress.

Maybe what you are looking for is the native skin. It is has some similarities with the RTAI API.

And it is documented at:
http://www.xenomai.org/documentation/xenomai-2.5/html/api/group__native.html

Signature · 4 lines
Gilles Chanteperdrix, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw
Quoted 42 lines · Gilles Chanteperdrix
Quoted 41 lines · [email protected] wrote:
Quoted 38 lines · Gilles Chanteperdrix
Quoted 13 lines · [email protected] wrote:

Hello all,

I'm doing some investigation on migrating my application from RTAI to Xenomai. From the description of a Xenomai skin, it seems like I might be
able to use the RTAI skin to run my application "as is". Along this line, I
put together a small test application in RTAI that would be very illustrative if I can get it to run in Xenomai. The first step is of course
compiling it which I haven't been able to do because of missing references
to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels

Quoted 8 lines

like
helping out, we could work through this whole process (from an RTAI app to
running on Xenomai) and turn this into another example to add to the examples folder for future reference. Here's the application I'm trying to
compile (the Makefile I just adapted from the native examples folder and changed the application name):

The RTAI skin is mostly kernel-space. User-space only supports a few things (like shared memory). In an case, to find what is supported, check src/skins/rtai in xenomai sources tree.

In the makefile, what is important is:

XENO_DESTDIR=/path/to/xenomai/installation/root XENO_CONFIG=$(XENO_DESTDIR)/usr/local/bin/xeno-config) XENO_RTAI_CPPFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --cflags) XENO_RTAI_LDFLAGS=$(shell DESTDIR=$(XENO_DESTDIR) $(XENO_CONFIG) --ldflags) -lrtai

then add XENO_RTAI_CPPFLAGS to your program CPPFLAGS or CFLAGS, and add XENO_RTAI_LDFLAGS to your program LDFLAGS.

Quoted 9 lines
Quoted 2 lines

Oh I see. This is helpful thanks Gilles. I'll give this a try and report back on my progress.

Maybe what you are looking for is the native skin. It is has some similarities with the RTAI API.

And it is documented at:
http://www.xenomai.org/documentation/xenomai-2.5/html/api/group__native.html

See also:
http://www.xenomai.org/documentation/branches/v2.3.x/pdf/Native-API-Tour-rev-C.pdf

p.22

Signature · 1 line
Philippe.