#include math.h on LPC175x

Questions about the BASICtools and MakeItC
Post Reply
danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

#include math.h on LPC175x

Post by danlee58 »

I am having a problem with a subtraction of 20 bit numbers. I'm wondering if I have floating point. I don't see math.h in the list of included components. I have the following statement in my header.

#ifdef USE_FLOAT // for the LPC175x you must also add to USERargs "-mfpu=vfp"
#include <math.h>
#endif

Where do the USERargs belong?



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: #include math.h on LPC175x

Post by basicchip »

It is in the compiler options, normally it is one of the defaults.

Does the Csample compile with -DUSE_FLOAT set as a User compile option?

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: #include math.h on LPC175x

Post by danlee58 »

basicchip wrote:It is in the compiler options, normally it is one of the defaults.

Does the Csample compile with -DUSE_FLOAT set as a User compile option?

Yes, with a couple of Warnings, this is one of those:

C:/PROGRA~2/Tools/CMSIS/Csample.c:24:0: warning: "USE_FLOAT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition

-mfpu=vfp s in the compiler options.

danlee58
Posts: 210
Joined: Thu Jan 17, 2013 2:29 am

Re: #include math.h on LPC175x

Post by danlee58 »

The subtraction is OK, it must be something else in the program causing a problem.

Post Reply