[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [BusyBox] difftime and strtod question...
From: "Bob Winslow" <Bob.Winslow () sevis ! com>
Date: 2005-03-29 0:02:36
Message-ID: 5DDB491476FA71428249D37C08D6547806D493 () dcsevis02 ! sevis ! com
[Download RAW message or body]
Hi all,
couple of questions for you all.. maybe someone can point out the stupid thing I am \
doing..
(probably more of a question for Wolfgang Denk... I know he reads the list but \
figured I would push it out to everyone to see if someone knows what I did wrong...)
My system is a board we made, with a power pc MPC8280 chip on it. we are using the
kernel(think it is 2.4.24) and eldk 3.0 from DENX (www.denx.de).
[]$ ppc-linux-gcc --version
ppc-linux-gcc (GCC) 3.2.2 20030217 (Yellow Dog Linux 3.0 3.2.2-2a_1)
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
ALL has been working pretty good including busybox on it(gotta plug the busybox \
folks :-) )..
except two things I have found:
1. the difftime function (found in login.c and others) doesn't seem to work. it is \
returning 0 all the time, thus a failed password when logging is not timing out at \
the FAIL_DELAY(3 seconds) time.
2. in top.c, there is a function strtod which gets the time out of the /proc/uptime \
file... it also is returning 0 so top is spinning real hard in that loop. (the \
buffer passed in to the strtod function has the numbers in it from the /proc/uptime \
file..)
I don't think it is a busybox issue... functions don't work in simple little c \
programs either but hoping someone else has run into this.
I am compiling like so:
env variable: CROSS_COMPILE=ppc_p2xx-
make TARGET_ARCH=ppc CROSS=/tools/eldk3_0/usr/bin/ppc-linux-
and haven't changed anything in the busybox makefiles....
should I be compiling differently??
I tried a simple little c program which tests the strtod function and it doesn't \
work... I then tried replacing it with sscanf(buf,"%lf", string) this too doesnt \
work until I pass -msoft-float on the compile line(that turns on floating point via \
the kernel doing it if I understand correctly)
are the eldk3_0 libs compiled with hardware floating point??? or am I not linking in \
the right ones? the mpc8280 has a FPU as far as I know...
Below the stupid little C program(its ugly I know..) with the output:
(oh anyone know why I can convert the value_1 to int and see the 33 ok without the \
-msoft-float but it goes to zero when I do use the -msoft-float function..)
strtod function didn't work with the -msoft-float option either...
thanks in advance for any help/suggestions..
Bob
[]$ ppc-linux-gcc -o iii iii.c; cp iii /tim/blah/iii
# iii
hello
test_string:343434.22 5575534.12
value_1 (int): 33
test val (double): 0.00
value_1 (double): 0.00
value_2: 0.000000
bobvalue : 0.000000
[]$ ppc-linux-gcc -msoft-float -o iii iii.c; cp iii /tim/blah/iii
hello
test_string:343434.22 5575534.12
value_1 (int): 0
test val (double): 123.46
value_1 (double): 33.44
value_2: 55.660000
bobvalue : 343434.220000
#include <stdio.h>
int main(int argc, char ** argv)
{
char test_string[20] = "343434.22 5575534.12";
double value_1, value_2, bobvalue_1, bobvalue_2;
int intvalue_1;
value_1 = 33.44;
value_2 = 55.66;
intvalue_1 = (int)value_1;
printf("hello\n");
printf("test_string:%s\n", test_string);
// bobvalue = strtod(test_string,0);
// printf("bobvalue : %lf \n", bobvalue);
printf("value_1 (int): %d \n", intvalue_1);
printf("test val (double): %'.2lf \n", 123.456);
printf("value_1 (double): %'.2lf \n", value_1);
printf("value_2: %f \n", value_2);
sscanf(test_string, "%lf %lf", &bobvalue_1, &bobvalue_2);
printf("bobvalue : %lf \n", bobvalue_1);
fflush(stdout);
return 0;
}
_______________________________________________
busybox mailing list
busybox@mail.busybox.net
http://codepoet.org/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic