xenomai on mini2440 errors

dragilla
Attachment: xeno-test_output.txt (13.44 KB)
Hey I get strange errors running xenomai on my mini. 
The result of an example run of xeno-test is attached. It prints out:

/usr/xenomai/bin/xeno-load: line 247: /usr/xenomai/bin/latency: not found

(and same for other executables).

The files are there:
/usr/xenomai/bin # ls -al latency
-rwxr-xr-x    1 root     root         29528 Nov  1  2011 latency

The only suspition I have is that I build the xenomai exectubales wrong and
they wont start...

This is the way I build xenomai:
./configure CFLAGS="-march=armv4t" LDFLAGS="-march=armv4t"
--build=i686-pc-linux-gnu --host=arm-none-linux-gnueabi
--enable-arm-mach=at91rm9200 --enable-arm-tsc --enable-arm-eabi
make DESTDIR=../xenami-2.5.6-target install 

Any ideas?

davef
What is --enable-arm-mach=at91rm9200?

Looks like an ATMEL part.

Have you done a readelf on the binaries?

dragilla
Attachment: readelf_xenomai.txt (33.04 KB)
From the xenomai configure --help:


--enable-arm-mach       Select for which machine we are compiling. Valid
                          machines are at91rm9200, at91sam926x, at91sam9,
                          generic, generic-vfp, imx, imx21, imx51,
integrator,
                          ixp4xx, mx2, mx3, mx5, omap3, orion, pxa, pxa3xx,
                          s3c2410, sa1100.

Should I use something different? I must choose something, otherwise it
screams:

checking for ARM machine... configure: error: Selecting a machine with
--enable-arm-mach is mandatory

Attaching full result of readelf -a latency
Any particular part I should look at?

davef
Tag_CPU_name: "4T"
 Tag_CPU_arch: v4T

Looks good.

The s3c2410 looks more appropriate, at least it is a Samsung part.

davef
We use the s3c2410 in our embedded product.  It is the predecessor to the
s3c2440.

dragilla
Gonna give it a try.

dragilla
same result :(

davef
Should have had a look at the first file you attached.  To my untrained eye
it looks like most of it worked, just the error you state.

/usr/xenomai/bin/latency: not found

Just guessing here, what about permissions for this file?  Does it get
written to?

davef
either the machine type is not important or maybe the one for s3c2410 is
not good enough??

Recalling the BIG book, at work, on the s3c2410 is calls it a ARM920T
something or other, which is what the s3c2440 is.

dragilla
/usr/xenomai/bin/latency is an executable binary. I don't think it gets
written to.
The xeno-test is just a sh script that runs different binaries. Well, tries
to run them, becasue it fails with the above error.

davef
Another long shot . . . what happens if you go into /usr/xenomai/bin and do
./latency?

dragilla
Same error message: ./latency: not found

davef
I mean ./latency

davef
I would have thought if it was an executable file that ./latency would do
something. But,I know nothing about xeonami and only a little bit more
about running executables!

dragilla
I bed it would do something if it started :)
I almost sure it's not starting because of either bad arch or bad linkage
(to some nonexistand libraries).
But no idea how to check that on mini. Maybe I can install strace...

dragilla
I bed = I bet

davef
It's "I bed" for me, had a rough day sorting out phase noise issues on a
Frac-N synth.

CUtomorrow

dragilla
Serg_io - maybe you can help with finding the error?

serg_io
Frankly I have no ideas, all what I would like to check already checked by
davef. I just can send you my binary of latency, but not now, only after
5-6 hours

dragilla
If you would. thankx.

serg_io
Only one think, may be it can't find Xenomai's libraries. Did you added
that folder to LD_LIBRARY_PATH ?

dragilla
I didn't change anything, so no.
Also nobody told me nor the xenomai docs mention that :)
But that's a good idea, will try that.

serg_io
Usually if application can't find some libraries then it tells explicitly
to user about error, but who know...

dragilla
Hm, strace doesn't help...


/usr/xenomai/bin # strace -f -F -v /usr/xenomai/bin/latency 
868   execve("/usr/xenomai/bin/latency", ["/usr/xenomai/bin/latency"],
["USER=root", "OLDPWD=/", "HOME=/", "TERM=vt100",
"PATH=/sbin:/usr/sbin:/bin:/usr/b"..., "SHELL=/bin/sh",
"PWD=/usr/xenomai/bin"]) = -1 ENOENT (No such file or directory)
868   write(2, "strace: exec", 12)      = 12
868   write(2, ": ", 2)                 = 2
868   write(2, "No such file or directory", 25) = 25
868   write(2, "\n", 1)                 = 1
868   exit_group(1)                     = ?

Nothing here...
libraries for latency:
/usr/xenomai/bin # ldd latency 
checking sub-depends for '/usr/xenomai/lib/libnative.so.3'
checking sub-depends for '/usr/xenomai/lib/librtdm.so.1'
checking sub-depends for '/usr/xenomai/lib/libxenomai.so.0'
checking sub-depends for '/lib/libpthread.so.0'
        libdl.so.0 => /lib/libdl.so.0 (0x82b000)
        libc.so.0 => /lib/libc.so.0 (0x836000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x81c000)
checking sub-depends for 'not found'
checking sub-depends for 'not found'
        libnative.so.3 => /usr/xenomai/lib/libnative.so.3 (0x00000000)
        librtdm.so.1 => /usr/xenomai/lib/librtdm.so.1 (0x00000000)
        libxenomai.so.0 => /usr/xenomai/lib/libxenomai.so.0 (0x00000000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00000000)
        libm.so.6 => not found (0x00000000)
        libc.so.6 => not found (0x00000000)
        /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000)
/usr/xenomai/bin #

How do I add this folder to the path?
export LD_LIBRARY_PATH=/usr/xenomai/bin ?
this variable is exmpty.

Also the whole library configuration (/etc/ld.so.conf /etc/ld.so.conf.d) is
empty. But when I run ldconfig it says:
ldconfig: skipping /usr/X11R6/lib: No such file or directory

So it must be compiled with the library list.
The question is how to set this list in buildroot - I couldn't find such
option in make xconfig.

serg_io
export LD_LIBRARY_PATH=/usr/xenomai/bin
it's right, but why bin? Are libraries in bin folder?
Second question why libm.so.6 => not found (0x00000000) ?
and the last are your compiler uses uClibc instead of glibc? 
What compiler do you use?

dragilla
The export line - my fault - it's lib of course.
I have libs in the lib folder.
Exporting doesn't help as I said anyway.

Why libm.so.6 not found? No idea, will have to ask buildroot ;)
I will see if there's an option to enable that.

for building buildroot I chose buildroot toolchain, so he (buildroot)
downloaded what he wanted. For xenoami I think the sourcery toolchain is
used... maybe this is the problem... ?

serg_io
Seems here is the problem, try to build all with codesourcery tolchain.
Different compilers - different libraries.

dragilla
ye. thanks.

dragilla
It works!
I'm measuring latency now :)
So far I can see 107.734 us

dragilla
that was periodic user-mode task.
In in-kernel periodic task I got 60.189

All test done 1000us period, priority 99

dragilla
For in-kernel timer 13.874us!

serg_io
107.734 us is very similar to result I have got. About in-kernel and
in-kernel timer I didn't understand exactly how that function could be used
in user space application. It's very similar to some test code, not usable
in real application. But I could be wrong

davef
"Different compilers - different libraries."

After about a year or so of playing with the mini2440 I was exposed to this
concept as a source of some of my difficulties.

Since I have been building programs using the Pengutronix's BSP toolchain
only, the process seems to be much more reliable.

So, the machine type didn't make any difference?

I might be useful for you to write up the procedure and publish it for
others to review and use.

Sounds like you "cut your teeth" on a rather complex first go at Linux.
Congrats for sticking with it!

dragilla
Actually I'm not new to linux in general. My working station is linux.
Now the plan is to compile the new kernel for xenomai 2.6. The bug I had
during compilation is the missing struct declaration in their class.
They're fixing a patch.
Next step is to configure nfs boot and start development :)

dragilla
As for the tutorial... I wouldn't know where to start...
I could provide you with ready to port uImage/jffs2 files for xenomai 2.5.6
and 2.6.0 (when it's ready).
But then it's not enough as one has to modify kernel sources to match
partitions on nand ... but we can make assumptions (that we use default
partitions created by dynpart) + I can make two versions of jffs2 images -
for 64MB and for larger nands.

What do you say?

dragilla
Maybe when I have some more time I can think of a guide... but for now I
have to leave my mini alone for a while and as I have to catch up with my
job and family stuff.

davef
dragilla,

You found out what worked in the end. Even though I am not planning to
replicate the feat, perhaps a summary of the major steps is likely to be of
benefit to others.

Some unanswered questions:

- was machine type important in the end?
- which toolchain did you eventually use to consistently compile everything
(codesourcery version)?
- brief explanation of any deviation from a standard buildroot process

I think the general opinion is that it is better that people generate their
own binaries.

Even just a summary posting in your own good time, highlighting the major
issues.

Cheers,
Dave

dragilla
Sure. Maybe during the weekend.

dragilla
Serg_io. Despite the ECC errors I get on xenomai-2.6.0-rc5 and kernel
2.6.38.8 I managed to run xeno-test on the board. The results where similar
to running linux-2.6.35.9 together with xenomai 2.6.5.

On the regular latency test I got 90us. But when I inserted the SD-card
during the test (automount) it jumped to 115us.

With xeno 2.6.5 inserting the sd card did not increase the max latency. It
was still 107us.

Juergen Beisert
SD card framework is known to break the RT preempt as well.

ahmet
hi 
I can use gpio control in console but ı don't know to use gpio in Qt
widget project. I need some tutorial and example project.
other problem how I count gpio number.

davef
ahmet,

Do not clutter the forum with multiple posts on the same topic.  In your
case I would suggest starting a new thread with a topic specific to your
problem(s).

Your post has nothing to do with xenomai

ahmet
thanks

dragilla
Juergen Beisert :"SD card framework is known to break the RT preempt as
well."

SD card framework? What do you mean? Only in this kernel (2.6.38.8)? Or in
general? Because I didn't see any increase in max latency on kernel
2.6.35.9. Or maybe you mean kernel v.3?
Would writing to already mounted SD break latency/RT preempt?

serg_io
I don't know how it's in theory, but in practice with Xenomai SD or USB
disk IO increases latency near to the value dragila has written. I tested
it very careful because in my project it's really imporant.

Juergen Beisert
"SD Framework" means not the SDHC drivers for example, it means a
different, but generic layer which handles the SD cards. It comes with
various hard coded delays and has tainted the latencies in some of our
projects. But it should be solvable.

qing86
hi
I try to patch mini2440 with Xenomai,my linux kernel is linux-2.6.31.1.
when I start the system,it stop here:

 load Image of Linux...Uncompressing Linux.................
................................................................................

................................................ done, booting the kernel.
Linux version 2.6.31.1 (root@localhost.localdomain) (gcc version 4.3.2
(Sourcery
 G++ Lite 2008q3-72) ) #33 PREEMPT Mon Nov 21 21:26:36 HKT 2011
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: FriendlyARM Mini2440 development board
ATAG_INITRD is deprecated; please update your bootloader.
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock3 init=/linuxrc
console=ttySAC0
PID hash table entries: 256 (order: 8, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 59884KB available (4096K code, 626K data, 132K init, 0K highmem)
SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:85
irq: clearing subpending status 00000002
I-pipe 1.16-01: pipeline enabled.
Console: colour dummy device 80x30
console [ttySAC0] enabled
Calibrating delay loop... 201.93 BogoMIPS (lpj=504832)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
I-pipe: Domain Xenomai registered.
Xenomai: hal/arm started.
Xenomai: scheduling class idle registered.
Xenomai: scheduling class rt registered.
Xenomai: real-time nucleus v2.5.3 (Hordes Of Locusts) loaded.
Xenomai: starting native API services.
Xenomai: starting POSIX services.
Xenomai: starting RTDM services.
Xenomai: starting RTAI emulator.
JFFS2 version 2.2. (NAND) &#28431; 2001-2006 Red Hat, Inc.
ROMFS MTD (C) 2007 Red Hat, Inc.
yaffs Nov 21 2011 21:18:11 Installing.
msgmni has been set to 117
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 60x53
fb0: s3c2410fb frame buffer device
backlight       initialized
adc     initialized
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
dm9000 Ethernet Driver, V1.31
eth0: dm9000e at c48b4300,c48b8304 IRQ 51 MAC: 08:90:90:90:90:90 (chip)
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c24xx-nand s3c2440-nand: Tacls=3, 29ns Twrph0=7 69ns, Twrph1=3 29ns
s3c24xx-nand s3c2440-nand: NAND soft ECC
NAND device: Manufacturer ID: 0xec, Chip ID: 0xda (Samsung NAND 256MiB 3,3V
8-bi
t)
Scanning device for bad blocks
Bad eraseblock 1046 at 0x0000082c0000
Creating 5 MTD partitions on "NAND 256MiB 3,3V 8-bit":
0x000000000000-0x000000040000 : "supervivi"
0x000000040000-0x000000060000 : "param"
ftl_cs: FTL header not found.
0x000000060000-0x000000560000 : "Kernel"
0x000000560000-0x000040560000 : "root"
mtd: partition "root" extends beyond the end of device "NAND 256MiB 3,3V
8-bit"
-- size truncated to 0xfaa0000
ftl_cs: FTL header not found.
0x000000000000-0x000040000000 : "nand"
0x000000000000-0x000040000000 : "nand"
-- size truncated to 0x10000000
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
mice: PS/2 mouse device common for all mice
s3c2410 TouchScreen successfully loaded
input: s3c2410 TouchScreen as /devices/virtual/input/input0
i2c /dev entries driver
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
cpuidle: using governor ladder
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver

who can help me solve this problem? thank you!