Page 1 of 1

#include math.h on LPC175x

Posted: Thu Dec 17, 2015 7:56 pm
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?

Re: #include math.h on LPC175x

Posted: Fri Dec 18, 2015 12:29 am
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?

Re: #include math.h on LPC175x

Posted: Fri Dec 18, 2015 11:32 am
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.

Re: #include math.h on LPC175x

Posted: Fri Dec 18, 2015 11:42 am
by danlee58
The subtraction is OK, it must be something else in the program causing a problem.