Content originally posted in LPCWare by lpcxpresso-support on Mon Nov 10 01:16:26 MST 2014
Quote: ArriaLive
I'm trying to use some fairly basic math.h functions (including sinf() and cosf()) in a project that is running on an LPC4330. I am using the FPv4-SP (Soft ABI) floating point library as recommended by these forums. I can work with float numbers--add, subtract, multiply, divide, etc., but when I add the math.h functions (even in single-precision floating-point mode), I get a hardfault with a NoCP (no coprocessor) fault.
If you are getting a hard fault, then you are almost certainly not enabling the floating point unit. This is normally done in the LPCOpen initialisation code, or with LPCXpresso, if you are not using LPCOpen, then in the startup file. Thus if you are not using LPCOpen, or you have incorrect compiler/linker options set, then you can run into problems.
If you need further assistance beyond that provided by other forum contributors, it would be helpful to know what toolchain you are actually using, and also for you to post a simple example showing your problem.
Regards,
LPCXpresso Support