Unable to link in math routines (Win and Linux-FC3)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Unable to link in math routines (Win and Linux-FC3)

nimish hirekodi
We had reported a problem on 30 June 2005 regarding
failing to link math routines in msp430-gcc on Windows
platform.

We have not been able to get a solution to that
problem yet.

We subsequently installed msp430-gcc on Linux (FC3)
platform. We have the same problem that math routines
don't get linked. Can anyone help?

We are using msp430-gcc ver 3.4.2 on FC3. We could
complile source code successfully, but could not link
math library.
 
** The source code (main2.c) is below:

#include<msp430x14x.h>
#include<math.h>
main()
{
        double num = 40.0;
        double res;
        res = sqrt(num);
}

** The command we tried:

$msp430-gcc -mmcu=msp430x149 -o main main2.c -lm

** The error message we got:

/tmp/cc4WCY3f.o(.text+0x1c): In function `main':
undefined reference to `sqrt'

Regards,
Guruprasad





               
_______________________________________________________
Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

Re: Unable to link in math routines (Win and Linux-FC3)

Rolf Freitag

Hi,

the problem is that you use a double function but mspgcc has only float functions.
It works when you use floats:

#include<math.h>
main()
{
float num = 40.0;
float res;
res = sqrtf(num);
}

> msp430-gcc -O2 -mmcu=msp430x149 -o main.elf main.c -lm

That's because 99 % of the programs do use no floating point code and from the rest more than 99 %
(.99 %) uses only floats.
That's the reason why no MSP430 compiler has complex numbers (with complex numbers up to
complex long double and complex NANs, complex infs) although it's in C99 and although you can use
complex long double numbers on a PC with gcc.
In ANSI-C that's standard conform because mspgcc is a freestanding implementation.
And because double (and long double, complex long double) operations would be really slow on
MSP430 and require much Flash they don't make much sense.

Regards,

Rolf


[hidden email] schrieb am 07.07.05 15:21:53:

>
> We had reported a problem on 30 June 2005 regarding
> failing to link math routines in msp430-gcc on Windows
> platform.
>
> We have not been able to get a solution to that
> problem yet.
>
> We subsequently installed msp430-gcc on Linux (FC3)
> platform. We have the same problem that math routines
> don't get linked. Can anyone help?
>
> We are using msp430-gcc ver 3.4.2 on FC3. We could
> complile source code successfully, but could not link
> math library.
>  
> ** The source code (main2.c) is below:
>
> #include<msp430x14x.h>
> #include<math.h>
> main()
> {
> double num = 40.0;
> double res;
> res = sqrt(num);
> }
>
> ** The command we tried:
>
> $msp430-gcc -mmcu=msp430x149 -o main main2.c -lm
>
> ** The error message we got:
>
> /tmp/cc4WCY3f.o(.text+0x1c): In function `main':
> undefined reference to `sqrt'
>
> Regards,
> Guruprasad
>
>
>
>
>
>
> _______________________________________________________
> Too much spam in your inbox? Yahoo! Mail gives you the best spam protection for FREE! http://in.mail.yahoo.com
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/mspgcc-users




-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
Reply | Threaded
Open this post in threaded view
|

math routines.....

nimish hirekodi
Hi!
   The math routines are getting linked correctly.
Thank-you.
   We are not able to debug the code both in the
simulator and the debugger. When we simulate using
Insight we get the message “0x113e <unexpected>:
reti”. Previuosly this worked correctly. How to make
it work?

Best Regards,
Nimish

--- [hidden email] wrote:

>
> Hi,
>
> the problem is that you use a double function but
> mspgcc has only float functions.
> It works when you use floats:
>
> #include<math.h>
> main()
> {
> float num = 40.0;
> float res;
> res = sqrtf(num);
> }
>
> > msp430-gcc -O2 -mmcu=msp430x149 -o main.elf main.c
> -lm
>
> That's because 99 % of the programs do use no
> floating point code and from the rest more than 99 %
> (.99 %) uses only floats.
> That's the reason why no MSP430 compiler has complex
> numbers (with complex numbers up to
> complex long double and complex NANs, complex infs)
> although it's in C99 and although you can use
> complex long double numbers on a PC with gcc.
> In ANSI-C that's standard conform because mspgcc is
> a freestanding implementation.
> And because double (and long double, complex long
> double) operations would be really slow on
> MSP430 and require much Flash they don't make much
> sense.
>
> Regards,
>
> Rolf
>
>
> [hidden email] schrieb am
> 07.07.05 15:21:53:
> >
> > We had reported a problem on 30 June 2005
> regarding
> > failing to link math routines in msp430-gcc on
> Windows
> > platform.
> >
> > We have not been able to get a solution to that
> > problem yet.
> >
> > We subsequently installed msp430-gcc on Linux
> (FC3)
> > platform. We have the same problem that math
> routines
> > don't get linked. Can anyone help?
> >
> > We are using msp430-gcc ver 3.4.2 on FC3. We could
> > complile source code successfully, but could not
> link
> > math library.
> >  
> > ** The source code (main2.c) is below:
> >
> > #include<msp430x14x.h>
> > #include<math.h>
> > main()
> > {
> > double num = 40.0;
> > double res;
> > res = sqrt(num);
> > }
> >
> > ** The command we tried:
> >
> > $msp430-gcc -mmcu=msp430x149 -o main main2.c -lm
> >
> > ** The error message we got:
> >
> > /tmp/cc4WCY3f.o(.text+0x1c): In function `main':
> > undefined reference to `sqrt'
> >
> > Regards,
> > Guruprasad
> >
> >
> >
> >
> >
> >
> >
>
_______________________________________________________
> > Too much spam in your inbox? Yahoo! Mail gives you
> the best spam protection for FREE!
> http://in.mail.yahoo.com
> >
> >
> >
>
-------------------------------------------------------
> > SF.Net email is sponsored by: Discover Easy Linux
> Migration Strategies
> > from IBM. Find simple to follow Roadmaps,
> straightforward articles,
> > informative Webcasts and more! Get everything you
> need to get up to
> > speed, fast.
>
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> > _______________________________________________
> > Mspgcc-users mailing list
> > [hidden email]
> >
>
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>
>
>
>
>
-------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux
> Migration Strategies
> from IBM. Find simple to follow Roadmaps,
> straightforward articles,
> informative Webcasts and more! Get everything you
> need to get up to
> speed, fast.
>
http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Mspgcc-users mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>



               
__________________________________________________________
How much free photo storage do you get? Store your friends 'n family snaps for FREE with Yahoo! Photos http://in.photos.yahoo.com


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Mspgcc-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users