Xenomai

Dec 16, 2013
2 min read
May 27, 2023 09:13 EEST

Documentation to Start

Xenomai and Freescale MPC-5200

Kernel Part

At first you should be able to boot a kernel with the icecube board, to do this see: IceCube

We need now a special kernel. First download BSP Kernel and Adeos patch . Kernel config file is Linux-2.6.18-lite5200-xenomai.config.txt .

svn co http://svn.gna.org/svn/xenomai/trunk xenomai (I used version 1808 here)
tar xzvf OSELAS.BSP-Phytec-phyCORE-MPC5200B-tiny-4.tar.gz
tar xjvf linux-2.6.18.tar.bz2
tar xjvf xenomai-2.2.5.tar.bz2
cd linux-2.6.18
patch -p1 </usr/local/src/OSELAS.BSP-Phytec-phyCORE-MPC5200B-tiny-4/kernel-patches-target/fec_mpc52xx_bestcomm.diff
patch -p1 </usr/local/src/OSELAS.BSP-Phytec-phyCORE-MPC5200B-tiny-4/kernel-patches-target/fec_mpc52xx.diff
patch -p1 </usr/local/src/OSELAS.BSP-Phytec-phyCORE-MPC5200B-tiny-4/kernel-patches-target/drivers_serial_mpc52xx_uart_fix.diff
patch -p1 </usr/local/src/OSELAS.BSP-Phytec-phyCORE-MPC5200B-tiny-4/kernel-patches-target/mpc5200_physmap.diff
patch -p1 </usr/local/src/adeos-ipipe-2.6.18-ppc-1.5-00.patch (one file make problems, skip it)
cd /usr/local/src/xenomai
scripts/prepare-kernel.sh --arch=ppc --linux=/usr/local/src/linux-2.6.18 --verbose

Now compile the kernel with:

export CROSS_COMPILE=ppc_6xx-
make ARCH=ppc lite5200_defconfig (or use my kernel config)
make ARCH=ppc menuconfig
make ARCH=ppc EXTRAVERSION=-mpc52xx CROSS_COMPILE=ppc-linux- uImage
cp arch/ppc/boot/images/uImage /tftproot/MPC5200
make ARCH=ppc EXTRAVERSION=-mpc52xx CROSS_COMPILE=ppc-linux- modules
make ARCH=ppc EXTRAVERSION=-mpc52xx CROSS_COMPILE=ppc-linux- INSTALL_MOD_PATH=/usr/local/eldk/ppc_6xx modules_install

If the board boots fine we have Xenomai support in the kernel.

User Part

Now we build the userspace part:

mkdir /home/idefix/xenomai
cd /usr/local/src/xenomai
export CROSS_COMPILE=ppc_6xx-
./configure --host=ppc-linux
make
export DESTDIR=/usr/local/eldk/ppc_6xx
make install

Test now if Xenomai works fine. At first we need to edit ld.so.conf on our target, add the line:

/usr/xenomai/lib

After that run

ldconfig

To test now Xenomai:

cd /usr/xenomai/testsuite/latency/
./latency -p0 -t1

You should see an output like:

=====  Sampling period: 100 us
=====  Test mode: in-kernel periodic task
=====  All results in microseconds
warming up...
RTT|  00:00:01  (in-kernel periodic task, 100 us period, priority 99)
RTH|-----lat min|-----lat avg|-----lat max|-overrun|----lat best|---lat worst
RTD|      -0.060|       0.255|      14.091|       0|      -0.060|      14.091
RTD|       0.091|       0.351|      24.091|       0|      -0.060|      24.091
RTD|       0.091|       0.284|      13.061|       0|      -0.060|      24.091
RTD|       0.122|       0.316|      28.061|       0|      -0.060|      28.061
RTD|      -0.060|       0.282|      12.728|       0|      -0.060|      28.061
RTD|       0.091|       0.258|      12.455|       0|      -0.060|      28.061
RTD|       0.091|       0.275|      15.122|       0|      -0.060|      28.061
RTD|       0.091|       0.311|      13.061|       0|      -0.060|      28.061
RTD|      -0.060|       0.299|      13.637|       0|      -0.060|      28.061
RTD|       0.091|       0.259|      23.273|       0|      -0.060|      28.061
---|------------|------------|------------|--------|-------------------------
RTS|      -0.060|       0.289|      28.061|       0|    00:00:11/00:00:11

Xenomai and X86

Kernel Part

cd /usr/src
tar xjvf /usr/local/src/linux-2.6.17.tar.bz2
ln -s linux-2.6.17/ linux
cd /usr/local/src/xenomai
scripts/prepare-kernel.sh --linux=/usr/src/linux-2.6.17 --arch=i686\
 --adeos=/usr/local/src/xenomai/ksrc/arch/i386/patches/adeos-ipipe-2.6.17-i386-1.5-02.patch --verbose
cd /usr/src/linux
make
make install
make modules
make modules_install

User Part

cd /usr/local/src/xenomai
./configure
make
make install

Test Xenomai:

cd /usr/xenomai/bin
./latency -p0 -t1

Examples

http://www.captain.at/xenomai-parallel-port-interrupt.php