Hi!

On Wed, 2 Dec 2009, sissou wrote:

> Hello,
>
> In fact, it does not need to add the lm flags since it is already in the
> makerules but there is a problem with the math library and telosb.
> for example, this program :
>
> implementation{
>       event void Boot.booted()
>       {
>               uint8_t a;
>               uint8_t b;
>               uint8_t c;
>
>        b = 2;
>        c = 5;
>        a = pow(b,c);
>
>       }
> }
>
> compiled perfectly for mica2 but with telosb there is an error:
> undefined reference to `pow'
> I don't know why.

The libc library for MSP430 is not complete. Only some functions 
and sometimes only variants of them are implemented. In case of pow only 
powf is implemented. Here is a way I found out this:

        $ find /usr/msp430/lib/ | grep libm
        /usr/msp430/lib/msp1/libm.a
        /usr/msp430/lib/libm.a
        /usr/msp430/lib/msp2/libm.a

        $ nm /usr/msp430/lib/msp1/libm.a | grep pow
        ef_pow.o:
        0000008a T __ieee754_powf
        00000084 T powf

        $ nm /usr/msp430/lib/msp2/libm.a | grep pow
        ef_pow.o:
        0000008a T __ieee754_powf
        00000084 T powf

        $ nm /usr/msp430/lib/libm.a | grep pow
        ef_pow.o:
        0000008a T __ieee754_powf
        00000084 T powf
        $

The includes is another place to take a look.

--
Razvan ME

> On Tue, 2009-12-01 at 21:42 -0600, Paul Johnson wrote:
>> Kartik,
>>
>> In your local makefile add something similar to this:
>> CFLAGS+=-lm
>>
>> CFLAGS is a variable that make stores and passes to ncc when it compiles.
>>
>> That should do it for you.
>>
>> Cheers,
>> -Paul
>>
>> Kartik Siddhabathula wrote:
>>> Hi All,
>>>
>>> I need help with the maths library.
>>>
>>> In the tutorial, it says to pass -lm option to ncc.
>>>
>>> How am I supposed to do that?
>>>
>>> make telosb -lm doesn't work nor the various combinations.
>>>
>>> Please help,
>>>
>>> Kartik
>>>
>>>
>>
>
>
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to