segfault?

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Post Reply
haarts
Posts: 26
Joined: Wed Jan 03, 2007 1:14 pm

segfault?

Post by haarts »

Hi all,

My problem is twofold, I am terrible with c so the Java implementation was very welcome. However when running the example from the SDK package:

Code: Select all

 java -jar samples.jar
I get the following output:

Code: Select all

Sample Application for the Iowkit-library
Checking Library Version...The IowKit plattform-library was not found!
Digging into the source code I noticed that this message comes from the a failed IowKit.version() call. So a made a very simple c program to verify the success of the version() call in c;

Code: Select all

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>

#include "iowkit.h"

int main(int argc, char* argv[]) {
        printf('%s\n', IowKitVersion());
        return 0;
}
And although this program compiles it segfaults when I try to run it. Am I missing something blatantly obvious? I noticed in the documentation that it should return "IO-Warrior Kit V1.4" but I installed the latest 1.5. Does it have to do with that?

I am running all this on a ARM processor with SableVM and gcc (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21). The iowkit lib is located in /usr/lib.

Thanks for any suggestions!

Harm
Robert Marquardt
Posts: 543
Joined: Mon Dec 01, 2003 6:09 pm

Post by Robert Marquardt »

Which kernel version is that? 32 bit or 64 bit?
Did you successfully install driver and iowkit?

IowKitVersion() should report 1.5. The documentation is obviously in error.

We have only tested on x86 architecture so there may still be bugs.
haarts
Posts: 26
Joined: Wed Jan 03, 2007 1:14 pm

Post by haarts »

It is an ARM processor. And I have no idea whether it is 32 or 64 bit but I am willing to bet it is 32. From /proc/cpuinfo:

Code: Select all

Processor       : XScale-IXP42x Family rev 1 (v5l)
BogoMIPS        : 266.24
Features        : swp half fastmult edsp 
CPU implementer : 0x69
CPU architecture: 5TE
CPU variant     : 0x0
CPU part        : 0x41f
CPU revision    : 1
Cache type      : undefined 5
Cache clean     : undefined 5
Cache lockdown  : undefined 5
Cache format    : Harvard
I size          : 32768
I assoc         : 32
I line length   : 32
I sets          : 32
D size          : 32768
D assoc         : 32
D line length   : 32
D sets          : 32

Hardware        : Linksys NSLU2
Revision        : 0000
Serial          : 0000000000000000
The library installed OK so I strongly suspect that the IowKitVersion method is not functioning properly(on my ARM processor(?)). I unzipped the samples.jar, modified the IoBlink.java to skip the version() method. Then recompiled and ran it(with -Djava.library.path=/usr/lib). This time I got some nice blinking lights on my IOW24. Awesome! So I'll steer clear of the version method as of now.

Thanks for the fast response!
haarts
Posts: 26
Joined: Wed Jan 03, 2007 1:14 pm

Post by haarts »

Hmmm, I might be mistaken. I just retried the version() method in my Java class and it works fine now. I added -Djava.library.path=/usr/lib to the invocation. Still don't know what went wrong with the C implementation. <shrugs>
towaibw
Posts: 198
Joined: Sat Dec 27, 2003 10:55 pm
Location: Berlin / Germany
Contact:

Linux

Post by towaibw »

Which firmware exactly do you use for the NSLU2?
Robert Marquardt
Posts: 543
Joined: Mon Dec 01, 2003 6:09 pm

Post by Robert Marquardt »

I wanted to know the kernel version. The XScale should not be 64 bit.
IowKitVersion is the only function i expect no problems at all with. It simply returns a static text.

Maybe replace the files jni.h and jni_md.h by the version from your Java installation on that machine and recompile/reinstall libiowkit.so. I have added the files because for Windows they are not easy to get and i hate it to get complaints about missing files.
wayoda
Posts: 362
Joined: Fri Dec 19, 2003 12:00 pm
Location: Wuppertal/Germany

Post by wayoda »

Hello haarts,
haarts wrote:Hmmm, I might be mistaken. I just retried the version() method in my Java class and it works fine now. I added -Djava.library.path=/usr/lib to the invocation. Still don't know what went wrong with the C implementation. <shrugs>
A nifty little "C"-error (happened to me many times...)

You put single-quotes around around the '%s\n' part in the printf statement.

With double quotes

Code: Select all

//compile with gcc -liowkit -o little_test little_test.c
printf("%s\n",IowKitVersion());
it works. :-)

Eberhard
Robert Marquardt
Posts: 543
Joined: Mon Dec 01, 2003 6:09 pm

Post by Robert Marquardt »

Argh, did not see it either. Too much Pascal.
haarts
Posts: 26
Joined: Wed Jan 03, 2007 1:14 pm

Post by haarts »

Aha! My C n00bness strikes again. Thanks a lot. If still of interest here is my kernel version:

Code: Select all

Linux slug 2.6.18-4-ixp4xx #1 Thu Feb 22 14:00:55 UTC 2007 armv5tel GNU/Linux
I am running Debian testing.
Post Reply