Xenomai for A13 - A10

Started by crubille, February 04, 2013, 10:55:17 PM

Previous topic - Next topic

crubille

Hello.

I just order an A13 board. I need xenomai to some project I have, the first project is to port xenomai on it.

I expect to send you good news in the future.

Paul

----------------------------------------------------------------------------------------------------------
Message edited:

Here is a first port for OLINUXINO A13

http://www.crubille.lautre.net/xenomai_sun5i/ipipe-linuxsun5i-3.4.24.beta.patch

and apply the standart xenomai procedure.

Running it, i get

latency -t 2 -p 100

RTT|  00:00:01  (in-kernel timer handler, 100 us period, priority 99)
RTH|----lat min|----lat avg|----lat max|-overrun|---msw|---lat best|--lat worst
RTD|      5.583|      6.265|     11.167|       0|     0|      5.583|     11.167
RTD|      6.125|      6.258|     10.917|       0|     0|      5.583|     11.167
RTD|      5.500|      6.270|     12.000|       0|     0|      5.500|     12.000


"lat worst" is mostly under 20 us but can go up for 30 ns.

(To get these value, i tune the Olinuxino A13 setting the dram cas to 5).

----------------------------------------------------------------------------------

The patch for the last version is here

http://www.crubille.lautre.net/xenomai_sun5i/ipipe-linuxsun5i-3.4.24.patch

It include :
       - priority based interrupt controller muting
       - (untested as i have no A10 board) support for the sun4i.

To get the sunxi kernel

tar xf linux-sunxi-sunxi-v3.4.24-r2.tar.gz


Have fun.

ehj666

I am trying to do the same thing. So far to not a lot of success since I have yet to get a kernel I built to boot.

Please keep us posted.

crubille


At this point, i load

- xenomai-2.6.2.1 with patchs for 3.0.36 and for 3.4.6.
- the sunxi 3.0 and 3.4 kernels
- the patch 3.4.1 ... up to 3.4.6 seems to be already applied on the 3.4 sunxi kernel. So it is not clear what is the closest linux vanilla kernel version.
- appling the patch from the xenomai distribution on the sunxi kernels, there is not so many fails.
  Here are the files where the patchs cant obviously apply in either kernels:
          saving rejects to file arch/arm/include/asm/cacheflush.h.rej
          saving rejects to file arch/arm/include/asm/pgtable.h.rej
          saving rejects to file arch/arm/kernel/smp.c.rej
          saving rejects to file arch/arm/vfp/entry.S.rej
          saving rejects to file arch/arm/vfp/vfphw.S.rej

  and two more files from the sunxi 3.0.8
          saving rejects to file arch/arm/vfp/vfpmodule.c.rej
          saving rejects to file kernel/sched.c.rej

I start to look at these files.





Tele

Quote from: crubille on February 07, 2013, 12:05:38 AM

At this point, i load

- xenomai-2.6.2.1 with patchs for 3.0.36 and for 3.4.6.
- the sunxi 3.0 and 3.4 kernels
- the patch 3.4.1 ... up to 3.4.6 seems to be already applied on the 3.4 sunxi kernel. So it is not clear what is the closest linux vanilla kernel version.
- appling the patch from the xenomai distribution on the sunxi kernels, there is not so many fails.
  Here are the files where the patchs cant obviously apply in either kernels:
          saving rejects to file arch/arm/include/asm/cacheflush.h.rej
          saving rejects to file arch/arm/include/asm/pgtable.h.rej
          saving rejects to file arch/arm/kernel/smp.c.rej
          saving rejects to file arch/arm/vfp/entry.S.rej
          saving rejects to file arch/arm/vfp/vfphw.S.rej

  and two more files from the sunxi 3.0.8
          saving rejects to file arch/arm/vfp/vfpmodule.c.rej
          saving rejects to file kernel/sched.c.rej

I start to look at these files.

Hi crubille,

Have you tried these things:
https://github.com/linux-sunxi/linux-sunxi/archive/sunxi-v3.0.36-0.tar.gz
https://github.com/linux-sunxi/linux-sunxi/archive/sunxi-v3.0.36-r1.tar.gz

sunxi-3.0 and sunxi-3.4 are not the best idea because they are always the last versions,
currently (9th of February)
3.0 -> 3.0.57
3.4 -> 3.4.29

And they are changing, tomorrow they can be newer and newer.

ehj666

#4
FWIW, here is what I have managed so far.

Notes:

The latest kernal on which Xenomai appears to work is 3.0.36. Here are the build instructions up to needing to implement a high res timer.


mkdir kernel
cd kernel
git clone https://github.com/linux-sunxi/linux-sunxi linux-sunxi
git checkout v3.0.36
cd ..

mkdir xenomai
cd xenomai
wget http://download.gna.org/xenomai/stable/LATEST_IS-v2.6.2.1.tar.bz2
tar -jxf LATEST_IS-v2.6.2.1.tar.bz2
cd xenomai-2.6.2.1

scripts/prepare-kernel.sh --arch=arm \
  --adeos=/ksrc/arch/arm/patches/adeos-ipipe-3.0.36-arm-* \
  --linux=../../kernel/linux-sunxi


Now copy a13_defconfig referenced above to kernel/arch/arm/configs.

I will include the next make command below, but this blow out on an error because it needs a high res timer.


cd ../..
cd kernel/linux-sunxi
make ARCH=arm CROSS_COMPLIE=arm-linux-gnueabi- a13_defconfig


I am now working my way through this:
http://www.xenomai.org/index.php/I-pipe-core:ArmPorting#Hardware_timer

To figure out how to do that. If anyone has already done this for the A13-olinuxino (ARM A8) or has any insight to simplify the process, I am all ears.

My blog on this can be found here:
http://lcncolinuxino.blogspot.com/

crubille

Hello

Tele, you are right but it is very easy to correct the very littles problems patching the 3.4 sunxi kernel from the xenomai patch for 3.4.6. I will try the patched kernel (without ipipe of course on the arm) soon, but after testing the unpatched one.

I still attempt to patch the 3.0.36 stable version but i have to fixe the patch for arch/arm/vfp/vfphw.S : the modification in the patch are already partially applied, but not in the same order ...


ehj666: really, you get the sunxi kernel patched just fine with the standart xenomai patch?
No .rej files anywhere? I test exactly what you do.

I know the tutorial to port xenomai on arm platform and sure we have to use it.



Tele

Quote from: ehj666 on February 10, 2013, 02:55:57 AM
FWIW, here is what I have managed so far.

Notes:

The latest kernal on which Xenomai appears to work is 3.0.36. Here are the build instructions up to needing to implement a high res timer.


mkdir kernel
cd kernel
git clone https://github.com/linux-sunxi/linux-sunxi linux-sunxi
git checkout v3.0.36
cd ..



My blog on this can be found here:
http://lcncolinuxino.blogspot.com/

Hi Eric and Crubille,

Sry Eric, I think you are not on the right way. Yet.
Because you download the vanilla v3.0.36 kernel from github. Its not modified for sunxi yet. There is no Allwinner A10 or A13 configuration inside, so it wont work on Olinuxino A13. Try 'make menuconfig' and you will see. This is why you can patch it with the adeos-ipipe-3.0.36*.patch without any error. You have found the original kernel, I think.
Sunxi guys modified it and released the sunxi-3.0.36 kernel (2 versions of that) , what I have shown to Crubille before.
And the adeos-ipipe*.patch fails on sunxi-3.0.36-r1, at about 10 places. Just like Crubille pointed that. Thats the real problem.
Our task is obvious I think. We have to find the difference between 'v3.0.36' and 'sunxi-3.0.36-r1' and we have to modify the adeos-ipipe*.patch to work on sunxi-3.0.36-r1 (or maybe on sunxi-3.0.36-0 would be nice also).
Those problems you mentioned, (high res timer...so on) will be walk in the park you will see.

You can find all downloadable kernels here:
https://github.com/linux-sunxi/linux-sunxi/tags
If a kernel marked only with 'v' and a version number that one is a vanilla thingy, (like v3.0.36)
Later on the list you can find stuffs like 'sunxi-3.x.y'...those are the real things for A10,A13.

Im working on it because I want xenomai kernel as well. I keep you guys posted. I expect the same from you both.

ehj666

I guess I should have realized that was too easy. I assumed the v just meant version. I also got a bunch of errors when trying to apply the Xenomai patch to the 3.0.57 version.

crubille

ehj666, i send you a private message with my mail adress.


uMinded, if you want and if you have a board, if you can check if timer2 and timer4 behave as described in this doc: http://linux-sunxi.org/A10/TIMER
An another point is: is there problems or constraints using PLL6 as base clock for the xenomai clock?


The linux sunxi kernel use timer0 as linux timer and timer2 as clock.

the points are:
- timer3 is 32khz only, so nothing to do with it.
- timer4 is ok but cant use the PLL6 base, so it can be user as xenomai timer wih 24MHz base
- timer2 can be used as xenomai clock either at 24Mhz or at PLL6/6 (in 150-200 MHz) so it can be used as xenomai clock.

What do you think about these ideas?

Paul

uMinded

#9
Here is a copy of the adeos patch for 3.0.36-r1 I used the following:

sunxi-v3.0.36-r1
xenomai-2.6.2.1

adeos-ipipe-3.0.36-arm-1.18-11.patch.fixed

I can do:
make ARCH=arm menuconfig

And I get the real time options. I will test a build once I have the arm tool chain set up.

uMinded

My steps:

$ cd xenomai-2.6.2.1
$ ./scripts/prepare-kernel.sh --arch=arm \
  --adeos=./ksrc/arch/arm/patches/adeos-ipipe-3.0.36-arm-1.18-11.patch.fixed \
  --linux=../linux-sunxi-sunxi-v3.0.36-r1
$ cd ../linux-sunxi-sunxi-v3.0.36-r1


These two commands do the same thing, the Xenomai documentation makes it sound like the second version will build and then config but it only spits out a .config for me.

$ make ARCH=arm a13_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- a13_defconfig


So then I usses a uImage build like normal for a uboot setup:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage


My error I get:

In file included from kernel/xenomai/arch/generic/hal.c:44:0:
/home/uminded/Downloads/A13-RT-Kernel/sunxi-xenomai/arch/arm/include/asm/xenomai/hal.h:99:2: error: #error "Unsupported ARM machine"


I assume this is because we need to port a high resolution timer for Xenomai and add the timer definitions to this hal.c file.

Other than that it compiles with the same warnings as a vanilla sunxi kernel.

uMinded

I have ported over IPIPE for the sun5i architecture using Timer2 with PLL6/4 as its source giving a 300MHz tick. I can compile to an error free uImage but I have no hardware so no idea if it will even boot.

I will fork the linux-sunxi 3.0.36 to my own git and compile patches or even just incorporate the changes completely (Xenomai uses symbolic links to its own directory which is a pain)

Would anybody be willing to give my kernel a try? I think I am going to try and get a board next week if I can but it will be two weeks at best before I know if it works without any help.

ehj666

Quote from: uMinded on February 14, 2013, 11:15:25 PM
Would anybody be willing to give my kernel a try? I think I am going to try and get a board next week if I can but it will be two weeks at best before I know if it works without any help.

I am quite happy to give it a shot.

Tele

Quote from: uMinded on February 14, 2013, 11:15:25 PM

Would anybody be willing to give my kernel a try? I think I am going to try and get a board next week if I can but it will be two weeks at best before I know if it works without any help.

Upload it quickly. Quickly. We cant wait for it. I have an Oli Wifi board with NAND.

PS.
And of course: thank you for your great job !!!!!!!!!!

uMinded

Here is my dropbox with the kernels

I am compiling the following for testing:
- vanilla 3.0.36-r1 (To make sure the base is sound)
- Xenomai 2.6.2.1   (If it boots check the kernel logs for 'Xenomai: ' lines)
- IPIPE 1.18-11     (My code to implement a 300MHz counter for the IPIPE service)

I will let you know when the IPIPE one is up for testing, thanks!

https://github.com/iceblu3710/SUNXI_XENOMAI/ is my repo for the project