I need to do some heavy calculation with a lot of sin() and cos(). I found that sin() and cos() is costing me 20us per calculation, which is much much more than the 50ish cycles stated in documentation. I did some experiment and found that floating plus and multiply are ok, which cost me about 0.4us, but float dividing and sin() cos() cost me 20us. This makes me doubt that I have not utilize FPU at all.
I have "-v28 -ml -mt --float_support=fpu32" in my compiling options, I have rts2800_fpu32_fast_supplement.lib and rts2800_fpu32.lib in project options->Build->C2000 Linker->File Search Path. Is there anything else I need to set?
MPU is F28335, configured at 40MHz.
I uses code below to check the timing on oscilloscope. (uncomment each line in the loop to check timing)
====================
int i;
float xr, yr, csr, ssr;
GpioDataRegs.GPASET.bit.GPIO10 = 1;
for(ii = 0; ii < 1000; ii++)
{
//csr += cos(xr);
//csr += ii / 10.3;
//csr += ii * 10.3;
}
GpioDataRegs.GPACLEAR.bit.GPIO10 = 1;