ts-7000
[Top] [All Lists]

[ts-7000] Floating Point problems with supplied JFFS2 image

To:
Subject: [ts-7000] Floating Point problems with supplied JFFS2 image
From: "genosensor" <>
Date: Sun, 27 Mar 2005 06:33:55 -0000

Has anyone else tried running applications use floating
point under the minimal JFFS2 Linux distro supplied with
the TS-7200?

I've been unable to get much of any non-trival floating
point operations work in this environment, even using the
compiler toolchain binaries provided on the CDROM.

I'd be very grateful if a few people could run this test
program on their TS-7200's can get back to me.

Remember, it works fine under Debian.  Boot from the
JFFS2 image to see the failures.  If anyone _can_ get this
to work in that environment, _please_ do tell me all
about your toolchain and/or any other relevant voodoo.

Thanks :-)

I build with:

$ /arm/bin/gcc -o fptest -lm fptest.c

Substitute the path to your arm gcc for /arm/bin/gcc

On the TS-7200, run it with:

$ fptest -4.3

The correct output follows.
Note that under the JFFS2 image, a few of the
functions return bogus results and the exp() fn usually
causes a segfault.


atof(-4.3) = -4.3 = 33 33 11 c0 33 33 33 33
sscanf(-4.3, "%f", &f) assigns f = -4.3 = 9a 99 89 c0
(int)-4.3 = -4 = fc ff ff ff
fabs(-4.3) = 4.3 = 9a 99 89 40
ceilf(-4.3) = -4 = fc ff ff ff
ceil(-4.3) = -4 = 50 8e 00 00
exp(-4.3) = 0.0135686 = a7 4e 5e 3c

-----------------
fptest.c
-----------------

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void dumphex (void *adr, size_t sz)
{
  char *ch = adr;
  printf (" =");
  do
    printf (" %02x", *ch++ & 0xff);
  while (--sz);
  puts ("");
}

int main (int argc, char **argv)
{
  if (argc > 1) {
    double d = atof (argv[1]);
    float f, f2, f3;
    int i, i2, i3;
    printf ("atof(%s) = %g", argv[1], d);
    dumphex (&d, sizeof(d));
    sscanf (argv[1], "%f", &f);
    printf ("sscanf(%s, \"%%f\", &f) assigns f = %g", argv[1], f);
    dumphex (&f, sizeof(f));
    printf ("(int)%g = %d", f, i=(int)f);
    dumphex (&i, sizeof(i));
    printf ("fabs(%g) = %g", f, f2=fabs(f));
    dumphex (&f2, sizeof(f2));
    printf ("ceilf(%g) = %d", f, i2=ceilf(f));
    dumphex (&i2, sizeof(i2));
    printf ("ceil(%g) = %d", f, i2=ceil((double)f));
    dumphex (&i3, sizeof(i3));
    printf ("exp(%g) = %g", f, f3=exp((double)f));
    dumphex (&f3, sizeof(f3));
    return 0;
  }
  return 2;
}






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU