Hi, Thanks for your help. But it still didn't work. I tried sqrtf. It is the only one which can be compiled without errors. But the result was totally wrong. So I guess i will give up on the math.h functions. What I can do instead of using pow or sqrt function is to manipulate the bits.
2^1 ----- 2<<0 2 2^2 ----- 2<<1 4 2^3 ----- 2<<2 8 2^4 ----- 2<<3 16 2^5 ----- 2<<4 32 2^6 ----- 2<<5 64 .... But I am still interested in why math.h is not working on Telosb. Some people said it worked on Mica. So I guess it is hardware related problem. But still, why MSP430 has this math.h file but can't be used. Anyone who made it can share some experience? Thanks in advance. Regards, Bai On Wed, Jan 28, 2009 at 3:46 PM, Robert Szewczyk <[email protected]> wrote: > As I recall, the math library on MSP430 supports has a fairly complete > support for single precision variants of the math functions -- try > using powf and sqrtf > > Rob > > On Tue, Jan 27, 2009 at 3:24 PM, BAI LI <[email protected]> wrote: > > HI, > > > > I was trying to use math.h file sitting in the MSP folder to run some > sqrt > > and pow functions. But once I include the file math.h it told me > undefined > > reference to sqrt and pow. The errors shown in the following: > > > > $ make telosb > > mkdir -p build/telosb > > compiling TestAesAppC to a telosb binary > > ncc -o build/telosb/main.exe -Os -O -mdisable-hwmul -Wall -Wshadow > > -Wnesc-all - > > target=telosb -fnesc-cfile=build/telosb/app.c -board= > > -DDEFINED_TOS_AM_GROUP=0x2 > > 2 -DIDENT_APPNAME=\"TestAesAppC\" -DIDENT_USERNAME=\"EIT\" > > -DIDENT_HOSTNAME=\"ws > > n\" -DIDENT_USERHASH=0xa200ffadL -DIDENT_TIMESTAMP=0x497fa030L > > -DIDENT_UIDHASH=0 > > xb441b921L -I/opt/tinyos-2.x/tos/lib/printf TestAesAppC.nc -lm > > /opt/tinyos-2.x/tos/chips/cc2420/lpl/DummyLplC.nc:39:2: warning: #warning > > "*** L > > OW POWER COMMUNICATIONS DISABLED ***" > > /cygdrive/c/DOCUME~1/EIT/LOCALS~1/Temp/cc7jt2Gp.o: In function > > `VirtualizeTimerC > > $0$fireTimers': > > app.c:(.text+0x1494): undefined reference to `pow' > > make: *** [exe0] Error 1 > > > > So can anyone help me out? I searched the list. Sum1 said to use lm to > link > > the math library. How to do it properly? Like make telosb lm? It didnt' > > work. Thanks in advance. > > > > Regards, > > Bai > > _______________________________________________ > > Tinyos-help mailing list > > [email protected] > > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
