[Rxtx] Kaffe & rxtx & armv5b
Trent Jarvi
taj at www.linux.org.uk
Sat May 21 12:34:45 MDT 2005
On Sat, 21 May 2005, Maxwell Zempftman wrote:
> >On Wed, 1 Dec 2004, Jari Korva wrote:
>
> > On Wed, 24 Nov 2004, Dalibor Topic wrote:
> > > >
> > > > Thanks, this helped! Kaffe and rxtx seem to work for me without any
> > > > problems now.
> > > >
> > > > - Jari
> > > >
> > > > PS. Using an older armv5b gcc version, the compile failed because of
> > > > undefined SSIZE_MAX in RS485Imp.c, I2CImp.c and RawImp.c. Luckily, this
> > > > was easy to fix based on an example I found from SerialImp.h.
> > >
> > > Wow, that's fantastic! A lot of people have been asking for that.
> > >
> > > Could you please, please write a FAQ.rxtx for Kaffe's documentation on how to
> > > go about it? I'd love to merge rxtx into kaffe eventually, as it would be a
> > > wonderful tool to have on embedded systems.
> >
> > OK, here's a short description of what I did:
> >
> > ----
> >
> > You need a version of RXTX which is *newer* than 2.1-7pre17.
> > Currently (2004-12-01) such a version has not been released but you have
> > to get it from cvs:
> >
> > # export \
> > CVSROOT=:pserver:anonymous at cvs.milestonesolutions.com:/usr/local/cvsroot
> > # cvs login
> > (password is mousy)
> > # cvs checkout -r commapi-0-0-1 rxtx-devel
> > # cd rxtx-devel
> >
> > Then build the sources:
> >
> > # ./configure
> > # make
> >
> > Ïf you are cross compiling, remember to specify the compiler and the
> > architecture (these commands are for big endian ARM/XScale, i.e. armv5b):
> >
> > # export CC=armv5b-softfloat-linux-gcc
> > # ./configure --host=i686-linux --target=armv5b-softfloat-linux
> > # make
> >
> > If the compiler complains about undeclared SSIZE_MAX, add the following
> > lines to those C-files which failed to compile:
> >
> > #ifndef SSIZE_MAX
> > # define SSIZE_MAX INT_MAX
> > #endif
> >
> > After a successful compile, install the files into your Kaffe directory
> > (again, these commands are for armv5b architecture, remember to adjust the
> > directories for your architecture):
> >
> > # mv armv5b-softfloat-linux-gnu/.libs/*.so /usr/local/jre/lib/arm
> > # cp RXTXcomm.jar /usr/local/jre/lib
> >
> > Finally, add RXTXcomm.jar to your classpath
> >
> > # export CLASSPATH=${CLASSPATH}:/usr/local/jre/lib/RXTXcomm.jar
> >
> > Now you should be able to access your serial ports from Kaffe! Note that
> > RXTX 2.1 uses gnu.io package name instead of javax.comm.
> >
> > ----
> >
> > I'm not sure if the instructions are optimal (e.g. does Kaffe have a
> > similar ext directory for jars as SUN JRE so that I wouldn't need to
> > define CLASSPATH?), but they did the trick for me :)
> >
> ------------------------------------------------------------------------------------------------------
>
> >Yep. The CVS material should fix many JRE segfaults people ran into with
> >kaffe, on bsd, .... I just finished teaching classes here and have a
> >couple things to add for further baud rate control then we will release it
> >at rxtx.org.
>
> >The code from there should make it over to the classplathx project which
> >has their own upper level classes in javax.comm and no license agreements
> >with Sun. Kaffe had some upper level classes too at one time the source
> >could work in.
>
> >Anyhow people will be able to use that code in javax.comm name spaces.
> >Just not from rxtx.org unless they obtain the wrapper classes from Sun,
> >kaffe, or classpathx. Classpathx makes the most sense to me as it is an
> >extension API.
>
> Hey, I'm new to the mailing list so I don't know if I'm posting this
> the right way.
>
> Basically, I'm trying to run Kaffe and rxtx on a small device (128mb
> ram, 32mb flash drive) running embedded linux on Intel XScale IXP 422.
>
> So far I have successfully cross-compiled Kaffe (CVS-2004-11) to run
> HelloWorld. The main application I want to run requires rxtx, so I
> followed the guide above, and cross-compiled rxtx-devel (full
> replacement version for Sun's commapi). I loaded it onto the XScale
> device with Kaffe and attempted to run the application:
>
> java -Xbootclasspath/a:/usr/kaffe/jre/lib/RXTXcomm.jar MainApp
>
> Without any arguments, this returned the Usage message ("MainApp
> USAGE: MainApp /dev/ttyxx").
> As soon as I gave any arguments, such as "/dev/ttyS0", "/dev/ttyM0",
> the application crashed with a NullPointerException. I looked in the
> code, and I could see that the application was failing because it was
> trying to print the contents of an uninitialized variable. In other
> words, the code basically looked like this:
>
> 1: class serialPort serialPort;
> 2: class outputStream outCOMstream;
> 3: outCOMstream = serialPort.getOutputStream();
> 4: outCOMstream.write(bytes);
>
> Step 3 does not happen. I'm not sure what the problem is exactly, but
> outCOMstream remains null, so step 4 fails as well with
> NullPointerException.
>
> This isn't my code, so I don't completely understand it, but it worked
> find with Sun's commapi on a RedHat Linux i686 box with Sun jdk1.4.2.
> It also worked with rxtx-devel (full Sun commapi replacement) on the
> Linux i686 box with Sun jdk1.4.2. Thus far, I have not gotten it to
> run with any rxtx version using Kaffe on the i686. This results in a
> segfault, so I believe the problem is with a miscompiled Kaffe, not an
> rxtx problem.
>
> Essentially, I need help trying to understand why the comm-enable
> application is failing on the XScale device. It does not segfault, and
> I do not know what is the cause of the NullPointerException. Are the
> rxtx libraries not working? Is it a java code issue?
>
> Also, does anyone know or think it is possible to run Sun's commapi on
> XScale with rxtx?
>
I'm not sure what is wrong in the first part. It sounds like your
application may be swallowing an exception while trying to enumerate the
port or open it. The usual mistake made it not having permissions to
either open the port or create the lockfile. There should be examples in
the contrib directory you can try that enumerate and open ports. Maybe
that will give you some hints.
It is possible to use rxtx 2.0 with Sun's Commapi. There is nothing in
Sun's code limiting you there though you do need to compile and install
rxtx for the XScale with Sun's Commapi.
--
Trent Jarvi
tjarvi at qbang.org
More information about the Rxtx
mailing list