Difference between revisions of "Xenomai"

From ArmadeusWiki
Jump to: navigation, search
m (Links)
(Installing Xenomai)
 
(66 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Under Construction}}
+
==What is Xenomai ?==
  
 +
Xenomai is a real time co-kernel which cooperates with Linux via Adeos. With its help, hard real time applications can be developed and run on the Armadeus boards.<br>
  
<span style="font-size: 2em; font-weight:bold;"> How to manually install Xenomai on your board </span>
+
Thanks to Adeos, Xenomai will receive the interrupts first and decide to handle them or not. If not, they will then be transfered to the regular Linux kernel. Also, Xenomai provides a framework to develop applications which can be easily moved between the Real Time Xenomai environment and the regular Linux system.<br>
<br />
+
<br />
+
<br />
+
<br />
+
  
==What is Xenomai==
+
Moreover, Xenomai provides a set of APIs (called "skins") that emulate traditional RTOSes such as VxWorks and pSOS and implement other APIs such as POSIX. Thus, porting third party real time applications to Xenomai is a fairly simple process.
  
Xenomai is a real time co-kernel which cooperate with Linux via Adeos.<br />
+
==Installing Xenomai==
Hard real time applications can be developped and run on the Armadeus
+
board. Thanks to Adeos, Xenomai will receive the interrupts first and decide
+
to handle them or not. If not, they will then be transfered to the regular
+
Linux kernel. Also, Xenomai provides a framework to develop applications which
+
can be easily moved between the Real Time Xenomai environment and the regular
+
Linux system. Moreover, Xeno provides a set of APIs (called "skins") that
+
emulate traditional RTOSes such as VxWorks and pSOS and implement other APIs
+
such as POSIX. Thus, porting third party real time applications to Xenomai is
+
a fairly simple process.
+
  
 +
{{Note|Xenomai has only be really tested on [[APF9328]] and [[APF27]] with 2.6.29 kernel. APF28 with 3.4 kernel and APF6/APF27 with 3.10 kernel are [[Talk:Xenomai|WiP]].}}
 +
===Lazy users===
 +
* Starting from armadeus-6.0, some configurations are available to build Xenomai without configuring anything:
 +
<pre class="host">
 +
$ make apf9328xenomai_defconfig
 +
or
 +
$ make apf27xenomai_defconfig
 +
or
 +
$ make apf27xenomaimainline_defconfig
 +
or
 +
$ make apf6xenomai_defconfig
 +
</pre>
  
==Explanation of the process used to install & deploy Xenomai==
+
===Manual installation===
 
+
Because Xenomai has not (''yet'') been integrated into the project, we will
+
have to install it manually.
+
 
+
 
The main steps are:
 
The main steps are:
* Installation of Adeos, an interrupt pipeline
+
* selection of Xenomai package on the Buildroot menuconfig,
* Creation of the Xenomai project directories used for this tutorial
+
* selection of Xenomai features in Kernel menuconfig,
* Downloading of Xenomai, extract & patch the sources
+
* compilation of the new version,
* Preparation of the Armadeus Linux kernel to support Xenomai
+
* validation of the Xenomai behaviour.
* Compilation of Xenomai
+
* Deployment of the Xenomai user space applications into the target root file system
+
* Validatation of the installation
+
  
 +
{{Note|These steps must be done with a fresh view or, at least, after having deleted ''buildroot/output/build/linux-x.y.z'' directory.}}
  
Naming conventions :
+
===Selecting Xenomai package===
In this document, the following naming conventions will be applied :
+
* Xeno or xeno will be used to reference Xenomai
+
* $ARMADEUS_ROOT will be used to reference the root directory of the Xenomai project
+
  
==Install Adeos==
+
* First of all, you need to select Xenomai package and Adeos patch in Buildroot menuconfig:
 +
<pre class="host">
 +
$ make menuconfig
 +
</pre>
 +
<pre class="config">
 +
...
 +
Kernel --->
 +
    Linux Kernel Extensions  --->
 +
        [*] Adeos/Xenomai Real-time patch
 +
        (ftp://ftp2.armadeus.com/armadeusw/adeos-ipipe-2.6.29-arm-1.13-05.patch) Path/url for Adeos patch file
  
First of all, you need to deploy a working Adeos on your board.
+
Target packages  --->
This can easily be done by following [[Adeos  | these instructions]].
+
    Real-Time --->
 +
        [*] Xenomai Userspace
 +
        (2.4.9) Custom Xenomai version                                for APF9328 & APF27
 +
        (--enable-arm-mach=mx2) Additionnal configuration options    for APF27, on APF9328 use --enable-arm-mach=imx
 +
...
 +
</pre>
 +
{{Note|It's possible to enable (or not) some skins in Real-Time menu.}}
 +
* Exit and save your configuration
 +
* If you plan to use ''xeno-test'' (Xenomai performance tool) then CONFIG_ASH_GETOPTS should be activated in Busybox:
 +
<pre class="host">
 +
$ make busybox-menuconfig
 +
</pre>
 +
<pre class="config">
 +
Shells  --->
 +
        Choose your default shell (ash)  --->
 +
    --- ash
 +
    ---  Ash Shell Options
 +
          ...
 +
          [*]   Builtin getopt to parse positional parameters
 +
</pre>
  
==Create your Xenomai project folder architecture==
+
* Exit and save your configuration
 +
* rebuild Busybox & Buildroot:
 +
<pre class="host">
 +
$ make busybox-clean && make
 +
</pre>
  
Xenomai will create some files to be deployed. By default, the command
+
===Kernel greater than 2.6.29===
''make install'' will copy the files into the following directories :
+
* ''/usr/xenomai/*'' contain test programs, includes, ...
+
* ''/usr/share/xenomai/*'' contain the documentation.
+
  
To have a clean but integrated folder architecture, we will create some specific
+
====2.6.38====
directories to install theses files. Later, we will copy them into the board's
+
<pre class="config">
root filesystem so Xenomai testing programs  will be available on the apf.
+
Kernel --->
 
+
    Linux Kernel Extensions --->
Also, because Xenomai documentation installed is quite huge (several Mb), we
+
        [*] Adeos/Xenomai Real-time patch
will avoid to copy it on the board.
+
        (http://download.gna.org/adeos/patches/v2.6/$(BR2_ARCH)) Adeos patch URL
 
+
        (adeos-ipipe-2.6.38.8-arm-1.18-09.patch) Path for Adeos patch file
$ mkdir $ARMADEUS_ROOT/xenomai
+
</pre>
$ mkdir $ARMADEUS_ROOT/xenomai/root_dir
+
$ mkdir $ARMADEUS_ROOT/xenomai/root_dir/xenodoc
+
 
+
''$ARMADEUS_ROOT/xenomai/root_dir/usr'' will contain all Xenomai target specific
+
files. This directory will be transfered to the board.
+
 
+
''$ARMADEUS_ROOT/xenomai/root_dir/xenodoc'' will contain Xenomai documentation
+
that won't be transfered to the board.
+
 
+
==Download & patch==
+
 
+
Well, let's start by downloading Xenomai sources.
+
 
+
$ cd $ARMADEUS_ROOT/xenomai
+
$ wget http://download.gna.org/xenomai/stable/xenomai-2.4.3.tar.bz2
+
  $ tar xvjf xenomai-2.4.3.tar.bz2
+
 
+
 
+
 
+
To compile Xenomai-2.4.3 with the current uClibc used within the Armadeus project
+
(uClibc-0.9.29), we will have to patch :
+
* Xenomai sources (See [[https://mail.gna.org/public/xenomai-help/2008-03/msg00043.html | here]])
+
* uClibc sources (See [[http://sourceforge.net/mailarchive/forum.php?thread_name=4803E169.30708%40free.fr&forum_name=armadeus-forum | this thread]])
+
 
+
 
+
To patch Xenomai sources :
+
 
+
$ cd $ARMADEUS_ROOT/xenomai/xenomai-2.4.3
+
$ wget https://mail.gna.org/public/xenomai-help/2008-03/bin5IoYobpAwu.bin
+
$ patch -p0 < bin5IoYobpAwu.bin
+
  patching file src/skins/posix/thread.c
+
 
+
 
+
To patch uClibc :<br />
+
This patch has been inserted into the Armadeus project, starting from revision
+
799. Update your svn tree to make sure it will be applied.
+
 
+
 
+
 
+
 
+
==Compilation==
+
  
 +
* If you plan to use a 2.6.38 kernel you have to delete the following patches :
 +
$ cd patches/linux/2.6.38.8
 +
$ rm 401-armadeus-fix_clock_tree.patch
 +
$ rm 419-armadeus-mx5fb-add_ipu_clock_polarity_support.patch
  
 
===Xenomai kernel space support===
 
===Xenomai kernel space support===
 +
*At first time, to have Linux kernel patched with Xenomai and Adeos patches, you must type:
 +
<pre class="host">
 +
$ make
 +
</pre>
 +
*If the script prepare-kernel.sh is missing, you can resolve this issue by:
 +
$ make xenomai
 +
Then resume the compilation:
 +
$ make
 +
'''kernel-2.6.38'''
 +
* If the compilation stops, which is probably the case for the first time, apply the following patches in : buildroot/output/build/linux-2.6.38.8
 +
http://sourceforge.net/mailarchive/forum.php?thread_name=CAP%2B5e19GT6g%3Dx1zdTan7maz28qsJNRoNYpDz7w-BNWAgR5WO4w%40mail.gmail.com&forum_name=armadeus-forum
 +
** adeos-00-avoid_kernel_panic.patch :
 +
--- a/arch/arm/plat-mxc/time.c 2012-09-01 16:06:04.000000000 +0200
 +
+++ b/arch/arm/plat-mxc/time.c 2012-09-01 16:01:17.000000000 +0200
 +
@@ -405,7 +405,8 @@
 +
 +
if (timer_is_v1()) {
 +
tsc_info.u.counter_paddr = phys + MX1_2_TCN;
 +
- tsc_info.counter_vaddr =(unsigned long)(phys + MX1_2_TCN);
 +
+ //tsc_info.counter_vaddr =(unsigned long)(phys + MX1_2_TCN);
 +
+ tsc_info.counter_vaddr =(unsigned long)(timer_base + MX1_2_TCN);
 +
} else {
 +
tsc_info.u.counter_paddr = phys + V2_TCN;
 +
tsc_info.counter_vaddr = (unsigned long)(timer_base + V2_TCN);
 +
** xenomai-00-move-irq_to_desc-export.patch :
 +
diff -ru '--exclude-from=linux-2.6.38.8/Documentation/dontdiff' linux-2.6.38.8/kernel/irq/irqdesc.c linux-2.6.38.8.new/kernel/irq/irqdesc.c
 +
--- a/kernel/irq/irqdesc.c 2012-08-25 14:44:30.000000000 +0200
 +
+++ b/kernel/irq/irqdesc.c 2012-08-25 12:17:44.000000000 +0200
 +
@@ -268,13 +268,13 @@
 +
}
 +
return arch_early_irq_init();
 +
}
 +
-EXPORT_SYMBOL_GPL(irq_to_desc);
 +
 +
#ifndef CONFIG_IPIPE
 +
struct irq_desc *irq_to_desc(unsigned int irq)
 +
{
 +
return (irq < NR_IRQS) ? irq_desc + irq : NULL;
 +
}
 +
+EXPORT_SYMBOL_GPL(irq_to_desc);
 +
#endif /* CONFIG_IPIPE */
 +
 +
struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node)
  
Xenomai is a co-kernel cooperating with Linux. This suite is made of two parts :
+
==Configuring Xenomai==
* The Xenomai kernel: It is provided as a patch to the regular Linux kernel and can be compiled as a full part of the kernel or as a regular module.
+
* Xenomai user space data: This set of file contains:
+
** header files used to compile Xenomai applications
+
** Binary files to validate and measure the performace of Xenomai
+
 
+
This section describe how to compile the kernel space for Xenomai.
+
 
+
Here we will patch the Armadeus Linux kernel to add Xenomai features.
+
This is automatically done via the Xenomai script ''prepare-kernel.sh''
+
 
+
$ cd $ARMADEUS_ROOT/xenomai/xenomai-2.4.3
+
$ ./scripts/prepare-kernel.sh --linux=$ARMADEUS_ROOT/buildroot/build_arm/linux-2.6.24.3/ --arch=arm
+
 
+
* ''--linux'' is used to specify which kernel we want to patch
+
* ''--arch'' is used to specify for which platform we want to patch (arm in our case)
+
 
+
Let's configure the Xenomai kernel :
+
  
$ cd $ARMADEUS_ROOT
+
* You can configure the Xenomai kernel options from Linux menuconfig:
 +
<pre class="host">
 
  $ make linux-menuconfig
 
  $ make linux-menuconfig
 +
</pre>
  
 
You should see the new entry :
 
You should see the new entry :
 +
<pre class="config">
 
  Real-time sub-system  --->
 
  Real-time sub-system  --->
 +
</pre>
  
 
Enter in it and check the following to compile Xenomai as a part of the Linux kernel :
 
Enter in it and check the following to compile Xenomai as a part of the Linux kernel :
 +
<pre class="config">
 
  [*] Xenomai
 
  [*] Xenomai
 
   <*> Nucleus  
 
   <*> Nucleus  
Line 151: Line 165:
 
       Interfaces  --->
 
       Interfaces  --->
 
       Drivers  --->
 
       Drivers  --->
 +
</pre>
  
Additionaly, to enable / disable the different available skins, go into "''Interfaces  --->''" :
+
Additionaly, to enable / disable the different available skins, go into <b>''Interfaces  --->''</b> :
 +
<pre class="config">
 
  <*> Native API  --->
 
  <*> Native API  --->
 
  <*> POSIX API  --->
 
  <*> POSIX API  --->
Line 161: Line 177:
 
  < > RTAI emulator  --->
 
  < > RTAI emulator  --->
 
  <*> Real-Time Driver Model  --->
 
  <*> Real-Time Driver Model  --->
 +
</pre>
  
Finally, compile Xenomai:
+
Finally, to build your changes:
  $ make
+
<pre class="host">
 
+
  $ make linux && make
===Xenomai User Space support===
+
</pre>
 
+
Because we need to cross compile Xenomai applications for ARM, we will use the
+
cross compilations tools provided by Armadeus/Buildroot.<br />
+
 
+
Let's update our PATH accordingly :
+
$ export PATH=$ARMADEUS_ROOT/buildroot/build_arm/staging_dir/bin:$PATH
+
 
+
We are now ready to start the user space compilation.
+
 
+
First, let's configure Xeno and create the makefiles :
+
$ cd $ARMADEUS_ROOT/xenomai/xenomai-2.4.3
+
$ ./configure --enable-arm-mach=imx --host=arm-linux --datarootdir=/xenodoc
+
 
+
* ''--enable-arm-mach'' : We want to build Xeno for the i.MX (ARM) architecture
+
* ''--host'' :  Prefix used for all compilation tools
+
* ''--datarootdir'' :
+
 
+
Finally, compile user space utilities.
+
$ make
+
  
 
==Deploy==
 
==Deploy==
 
First, install Xenomai data in $ARMADEUS_ROOT/xenomai/root-dirs/target
 
$ cd $ARMADEUS_ROOT/xenomai/xenomai-2.4.3
 
$ make DESTDIR=$ARMADEUS_ROOT/xenomai/root-dir install
 
 
 
This command will install all Xenomai data in $ARMADEUS_ROOT/xenomai/root-dir.
 
Have a look in this directory. Note that it contains two sub directories,
 
''xenodoc'' and ''usr''. ''xenodoc'' contains all documentation regarding
 
Xenomai. As said previously, we will not copy xenodoc on the board.
 
Instead, we will only transfert the required files to run Xeno applications
 
on the APF. These files are located under ''usr/xenomai''.
 
 
 
Before modifying the board's root filesystem, we will first make a backup of it.
 
$ cp -R $ARMADEUS_ROOT/buildroot/project_build_arm/armadeus/root $ARMADEUS_ROOT/buildroot/project_build_arm/armadeus/root.orig
 
 
We can now copy Xeno data to the board's root filesystem:
 
$ cp -R $ARMADEUS_ROOT/xenomai/root-dir/usr/* $ARMADEUS_ROOT/buildroot/project_build_arm/armadeus/root/usr/
 
 
And generate the target filesystem
 
$ cd $ARMADEUS_ROOT
 
$ make
 
  
 
You can now [[Target_Software_Installation | transfer]] the rootfs and the kernel
 
You can now [[Target_Software_Installation | transfer]] the rootfs and the kernel
Line 216: Line 191:
 
==Validate the installation==
 
==Validate the installation==
  
Boot the APF and logon as root.<br>
+
* Boot the APF and logon as root.
 
+
* You can double check Xenomai is installed correctly:
You can double check Xeno is installed correctly :
+
<pre class="apf">
 
  $ dmesg | grep Xenomai
 
  $ dmesg | grep Xenomai
 
   I-pipe: Domain Xenomai registered.
 
   I-pipe: Domain Xenomai registered.
Line 226: Line 201:
 
   Xenomai: starting POSIX services.
 
   Xenomai: starting POSIX services.
 
   Xenomai: starting RTDM services.
 
   Xenomai: starting RTDM services.
 +
</pre>
 +
* Now we can run the overall+performance test provided by Xenomai:
 +
<pre class="apf">
 +
# modprobe xeno_irqbench
 +
# modprobe xeno_klat
 +
# modprobe xeno_switchtest
 +
# modprobe xeno_timerbench
  
 +
# xeno-test
 +
</pre>
 +
* On APF27 you have to unlock access to debug registers before launching these tests:
 +
<pre class="apf">
 +
BIOS> run unlock_regs
 +
</pre>
  
We will now update our environment to add Xenomai features. On the APF, run the following commands:
+
===Results===
$ export LD_LIBRARY_PATH=/usr/xenomai/lib:$LD_LIBRARY_PATH
+
* latency (Sampling period: 100 us, test mode: periodic user-mode task, all results in microseconds)
$ export PATH=/usr/xenomai/bin:$PATH
+
{| border="1" cellspacing="0" cellpadding="10"
 +
! Board ( Linux / xenomai )
 +
! best
 +
! average
 +
! worst
 +
|-
 +
| [[APF27]] (2.6.29 / 2.4.9)
 +
| 4.7 uS
 +
| 52.4 uS
 +
| 145.4 uS
 +
|}
  
To make the changes permanent, add ''/usr/xenomai/lib'' to ''$ARMADEUS_ROOT/buildroot/project_build_arm/armadeus/root/etc/ld.so.conf''
+
==Deinstalling or disabling Xenomai==
 +
There are two parts needed for disabling Xenomai features
  
Now we can run the performance test provided by Xenomai:
+
===Kernel===
$ xeno-test
+
For disabling kernel part, two solutions are available
  
==Links==
+
* The first solution is to unselect kernel's features :
* [http://www.xenomai.org Xenomai main page ]
+
<pre class="host">
 +
$ make linux-menuconfig
 +
</pre>
 +
And disable following options:
 +
<pre class="config">
 +
Real-time sub-system --->
 +
    [ ] Xenomai
  
 +
and
 +
 +
Kernel Features --->
 +
    [ ] Interrupt pipeline
 +
</pre>
 +
 +
* The second solution is to destroy the kernel tree :
 +
<pre class="host">
 +
$ make linux-dirclean
 +
</pre>
 +
 +
===Userspace / package===
 +
For disabling userspace/package part :
 +
<pre class="host">
 +
$ make menuconfig
 +
</pre>
 +
and disable Xenomai
 +
<pre class="config">
 +
Package Selection for the target --->
 +
    [ ] Xenomai
 +
</pre>
 +
 +
then use the dirclean command:
 +
<pre class="host">
 +
$ make xenomai-dirclean
 +
</pre>
 +
 +
==Going further==
 +
* [[Xenomai:examples usage | Using Armadeus Xenomai custom examples]]
 +
* [[Xenomai:Blinking LEDs | Xenomai tutorial (blinking LED)]]
 +
 +
==Links==
 +
* [http://home.gna.org/adeos/ Adeos website]
 +
* [http://www.xenomai.org Xenomai website]
 +
* [[Adeos | Adeos installation]]
 +
* [[Xenomai manual installation]] (for reference)
 +
* [http://doc.fedora-fr.org/wiki/Mise_en_œuvre_de_Xenomai_pour_créer_un_noyau_Temps_Réel_dur Mise en œuvre de Xenomai pour créer un noyau Temps Réel dur - Fedora (french)]
 +
* [http://lwn.net/images/conf/rtlws11/papers/proc/p11.pdf Latencies measurements on ARM platforms]
  
 
[[Category:Software]]
 
[[Category:Software]]
 
[[Category:Real-Time]]
 
[[Category:Real-Time]]

Latest revision as of 13:41, 30 April 2014

What is Xenomai ?

Xenomai is a real time co-kernel which cooperates with Linux via Adeos. With its help, hard real time applications can be developed and run on the Armadeus boards.

Thanks to Adeos, Xenomai will receive the interrupts first and decide to handle them or not. If not, they will then be transfered to the regular Linux kernel. Also, Xenomai provides a framework to develop applications which can be easily moved between the Real Time Xenomai environment and the regular Linux system.

Moreover, Xenomai provides a set of APIs (called "skins") that emulate traditional RTOSes such as VxWorks and pSOS and implement other APIs such as POSIX. Thus, porting third party real time applications to Xenomai is a fairly simple process.

Installing Xenomai

Note Note: Xenomai has only be really tested on APF9328 and APF27 with 2.6.29 kernel. APF28 with 3.4 kernel and APF6/APF27 with 3.10 kernel are WiP.

Lazy users

  • Starting from armadeus-6.0, some configurations are available to build Xenomai without configuring anything:
 $ make apf9328xenomai_defconfig
or
 $ make apf27xenomai_defconfig
or
 $ make apf27xenomaimainline_defconfig
or
 $ make apf6xenomai_defconfig

Manual installation

The main steps are:

  • selection of Xenomai package on the Buildroot menuconfig,
  • selection of Xenomai features in Kernel menuconfig,
  • compilation of the new version,
  • validation of the Xenomai behaviour.
Note Note: These steps must be done with a fresh view or, at least, after having deleted buildroot/output/build/linux-x.y.z directory.


Selecting Xenomai package

  • First of all, you need to select Xenomai package and Adeos patch in Buildroot menuconfig:
 $ make menuconfig
...
Kernel --->
    Linux Kernel Extensions  --->
        [*] Adeos/Xenomai Real-time patch
        (ftp://ftp2.armadeus.com/armadeusw/adeos-ipipe-2.6.29-arm-1.13-05.patch) Path/url for Adeos patch file

Target packages  --->
    Real-Time --->
        [*] Xenomai Userspace
        (2.4.9) Custom Xenomai version                                for APF9328 & APF27
        (--enable-arm-mach=mx2) Additionnal configuration options     for APF27, on APF9328 use --enable-arm-mach=imx
...
Note Note: It's possible to enable (or not) some skins in Real-Time menu.
  • Exit and save your configuration
  • If you plan to use xeno-test (Xenomai performance tool) then CONFIG_ASH_GETOPTS should be activated in Busybox:
 $ make busybox-menuconfig
Shells  --->
        Choose your default shell (ash)  --->
    --- ash
    ---   Ash Shell Options
          ...
          [*]   Builtin getopt to parse positional parameters 
  • Exit and save your configuration
  • rebuild Busybox & Buildroot:
$ make busybox-clean && make

Kernel greater than 2.6.29

2.6.38

Kernel --->
    Linux Kernel Extensions  --->
        [*] Adeos/Xenomai Real-time patch
        (http://download.gna.org/adeos/patches/v2.6/$(BR2_ARCH)) Adeos patch URL
        (adeos-ipipe-2.6.38.8-arm-1.18-09.patch) Path for Adeos patch file
  • If you plan to use a 2.6.38 kernel you have to delete the following patches :
$ cd patches/linux/2.6.38.8
$ rm 401-armadeus-fix_clock_tree.patch
$ rm 419-armadeus-mx5fb-add_ipu_clock_polarity_support.patch

Xenomai kernel space support

  • At first time, to have Linux kernel patched with Xenomai and Adeos patches, you must type:
 $ make
  • If the script prepare-kernel.sh is missing, you can resolve this issue by:
$ make xenomai

Then resume the compilation:

$ make

kernel-2.6.38

  • If the compilation stops, which is probably the case for the first time, apply the following patches in : buildroot/output/build/linux-2.6.38.8

http://sourceforge.net/mailarchive/forum.php?thread_name=CAP%2B5e19GT6g%3Dx1zdTan7maz28qsJNRoNYpDz7w-BNWAgR5WO4w%40mail.gmail.com&forum_name=armadeus-forum

    • adeos-00-avoid_kernel_panic.patch :
--- a/arch/arm/plat-mxc/time.c	2012-09-01 16:06:04.000000000 +0200
+++ b/arch/arm/plat-mxc/time.c	2012-09-01 16:01:17.000000000 +0200
@@ -405,7 +405,8 @@

	if (timer_is_v1()) {
		tsc_info.u.counter_paddr = phys + MX1_2_TCN;
-		tsc_info.counter_vaddr =(unsigned long)(phys + MX1_2_TCN);
+		//tsc_info.counter_vaddr =(unsigned long)(phys + MX1_2_TCN);
+		tsc_info.counter_vaddr =(unsigned long)(timer_base + MX1_2_TCN);
	} else {
		tsc_info.u.counter_paddr = phys + V2_TCN;
		tsc_info.counter_vaddr = (unsigned long)(timer_base + V2_TCN);
    • xenomai-00-move-irq_to_desc-export.patch :
diff -ru '--exclude-from=linux-2.6.38.8/Documentation/dontdiff' linux-2.6.38.8/kernel/irq/irqdesc.c linux-2.6.38.8.new/kernel/irq/irqdesc.c
--- a/kernel/irq/irqdesc.c	2012-08-25 14:44:30.000000000 +0200
+++ b/kernel/irq/irqdesc.c	2012-08-25 12:17:44.000000000 +0200
@@ -268,13 +268,13 @@
	}
	return arch_early_irq_init();
}
-EXPORT_SYMBOL_GPL(irq_to_desc);

#ifndef CONFIG_IPIPE
struct irq_desc *irq_to_desc(unsigned int irq)
{
	return (irq < NR_IRQS) ? irq_desc + irq : NULL;
}
+EXPORT_SYMBOL_GPL(irq_to_desc);
#endif /* CONFIG_IPIPE */

struct irq_desc *irq_to_desc_alloc_node(unsigned int irq, int node)

Configuring Xenomai

  • You can configure the Xenomai kernel options from Linux menuconfig:
 $ make linux-menuconfig

You should see the new entry :

 Real-time sub-system  --->

Enter in it and check the following to compile Xenomai as a part of the Linux kernel :

 [*] Xenomai
   <*> Nucleus 
   [*]   Pervasive real-time support in user-space
   [ ]     Interrupt shield support
   [*]     Priority coupling support
   [*]   Optimize as pipeline head
   (32)  Number of pipe devices
   (512) Number of registry slots
   (128) Size of the system heap (Kb)
   (32)  Size of the private stack pool (Kb)
   [*]   Statistics collection
   [ ]   Debug support
   [ ]   Shared interrupts
      Timing  --->
      Scalability  --->
      Machine  --->
      Interfaces  --->
      Drivers  --->

Additionaly, to enable / disable the different available skins, go into Interfaces ---> :

 <*> Native API  --->
 <*> POSIX API  --->
 < > pSOS+ emulator  --->
 < > uITRON API  --->
 < > VRTX emulator  --->
 < > VxWorks emulator  --->
 < > RTAI emulator  --->
 <*> Real-Time Driver Model  --->

Finally, to build your changes:

 $ make linux && make

Deploy

You can now transfer the rootfs and the kernel on the APF.

Validate the installation

  • Boot the APF and logon as root.
  • You can double check Xenomai is installed correctly:
 $ dmesg | grep Xenomai
  I-pipe: Domain Xenomai registered.
  Xenomai: hal/arm started.
  Xenomai: real-time nucleus v2.4.3 (Back to Shalla-Bal) loaded.
  Xenomai: starting native API services.
  Xenomai: starting POSIX services.
  Xenomai: starting RTDM services.
  • Now we can run the overall+performance test provided by Xenomai:
# modprobe xeno_irqbench
# modprobe xeno_klat
# modprobe xeno_switchtest
# modprobe xeno_timerbench

# xeno-test
  • On APF27 you have to unlock access to debug registers before launching these tests:
BIOS> run unlock_regs

Results

  • latency (Sampling period: 100 us, test mode: periodic user-mode task, all results in microseconds)
Board ( Linux / xenomai ) best average worst
APF27 (2.6.29 / 2.4.9) 4.7 uS 52.4 uS 145.4 uS

Deinstalling or disabling Xenomai

There are two parts needed for disabling Xenomai features

Kernel

For disabling kernel part, two solutions are available

  • The first solution is to unselect kernel's features :
 $ make linux-menuconfig

And disable following options:

Real-time sub-system --->
    [ ] Xenomai

and

Kernel Features ---> 
    [ ] Interrupt pipeline
  • The second solution is to destroy the kernel tree :
 $ make linux-dirclean

Userspace / package

For disabling userspace/package part :

 $ make menuconfig

and disable Xenomai

Package Selection for the target ---> 
    [ ] Xenomai

then use the dirclean command:

 $ make xenomai-dirclean

Going further

Links