[Tinyos-help] IBM JDK segfaults on libtoscomm.so
David Gay
dgay42 at gmail.com
Tue Jun 5 13:37:48 PDT 2007
On 6/2/07, Ákos Maróy <darkeye at tyrell.hu> wrote:
> Aurélien Francillon wrote:
> > IIRC (not sure), i tracked it back to some known regression of gcc 4.1.x ...
> > it works fine with gcc-3.x
>
> I tried with gcc-3.x, and while it doesn't crash - it doesn't work either.
>
> by that I mean that the mote stops sending as soon as TestSerial starts
> up (the TX flashes before that, doesn't flash afterwards), and the mote
> doesn't react to the data sent by TestSerial either (it should change
> it's LEDs AFAIK)
Hmm, trying this on an x86_64 kernel, I did find one bug which is
fixed by the following patch (the change to the Makefile is necessary
to keep Sun's JDK happy at least):
cvs diff: Diffing .
Index: Makefile.am
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/java/serial/Makefile.am,v
retrieving revision 1.3
diff -u -r1.3 Makefile.am
--- Makefile.am 9 Jan 2007 23:45:17 -0000 1.3
+++ Makefile.am 5 Jun 2007 20:36:36 -0000
@@ -19,7 +19,7 @@
TOSComm_wrap.cxx
libtoscomm.so: $(libtoscomm_so_SOURCES)
- $(CXX) -O2 -shared -fPIC "-I$(JDK)/include" "-I$(JDK)/include/linux" \
+ $(CXX) -m32 -O2 -shared -fPIC "-I$(JDK)/include"
"-I$(JDK)/include/linux" \
-o $@ NativeSerial_linux.cpp
toscomm.dll: $(toscomm_dll_SOURCES)
Index: NativeSerial_linux.cpp
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tools/tinyos/java/serial/NativeSerial_linux.cpp,v
retrieving revision 1.4
diff -u -r1.4 NativeSerial_linux.cpp
--- NativeSerial_linux.cpp 12 Dec 2006 18:23:02 -0000 1.4
+++ NativeSerial_linux.cpp 5 Jun 2007 20:36:36 -0000
@@ -351,19 +351,21 @@
while( m_wait_for_events && (m_fd != -1) && (m_events_out == 0) )
{
+ int fd = m_fd;
+
FD_ZERO( &input );
- FD_SET( m_fd, &input );
+ FD_SET( fd, &input );
tv.tv_sec = 0;
tv.tv_usec = 100*1000; // 1ms is the minimum resolution, at best
- if( select( m_fd+1, &input, NULL, NULL, &tv ) == -1 )
+ if( select( fd+1, &input, NULL, NULL, &tv ) == -1 )
{
if( errno == EINTR )
break;
errno_wrap( true, "waitForEvent.select" );
}
- if( FD_ISSET( m_fd, &input ) )
+ if( FD_ISSET( fd, &input ) )
m_events_out |= DATA_AVAILABLE;
}
However it's not clear to me that this is the same problem.
David Gay
More information about the Tinyos-help
mailing list