[Tinyos-devel] nx_float

David Gay dgay42 at gmail.com
Fri Sep 19 17:10:59 PDT 2008


[People regularly ask for nx_float support...]

I've just added nx_float support to T2 for atmega128 and msp430 based
platforms, along with an apps/tests/NxFloat test app to test that it's
working (works for me on micaz and telosb...).

The mechanics: each processor arch should define it's functions to
convert floats to and from the wire format for floating point. This
format is defined to be that used by floatToRawIntBits method
(http://java.sun.com/javase/6/docs/api/java/lang/Float.html#floatToRawIntBits(float)),
with the resulting 32-bit number in big-endian format.

Conveniently, on the msp430 and atmega128 we can just use memcpy to do
this conversion ;-)

It would be good if some people out there would fill out the missing
processors...

To use this with mig, you will need the latest nesC from CVS, or just
apply the following patch to /usr/bin/nescc-mig:
barnowl:~/motes/nesc/1.3/tools owl$ cvs diff -u -r1.6 nescc-mig.in
Index: nescc-mig.in
===================================================================
RCS file: /cvsroot/nescc/nesc/tools/nescc-mig.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- nescc-mig.in        2 May 2006 21:56:49 -0000       1.6
+++ nescc-mig.in        19 Sep 2008 23:54:34 -0000      1.7
@@ -185,6 +185,7 @@

     return "PUSH" if $basetype =~ /^AN?[SU]$/;
     return "POP" if $basetype eq "AX";
+    return "F" if $basetype =~ /^Nnx_float/;
     return "U" if $basetype =~ /^Nnxle_u/;
     return "I" if $basetype =~ /^Nnxle_/;
     return "BU" if $basetype =~ /^Nnx_u/;


David


More information about the Tinyos-devel mailing list