This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

f28335 floating point

I am trying to time the following code

GpioDataRegs.GPACLEAR.bit.GPIO31 = 1;
for (i=0; i<25; i++)
{
xdata *= 1.001;
}
GpioDataRegs.GPASET.bit.GPIO31 = 1;

It seems to take over 20 usec on a F28335 controlCARD (which is ridiculous).  Even though I believe I have hardware floating point selected in the compiler it still seems to be calling fs_mpy28() which looks like a software implementation.  For my project, to get it to compile I have to select Generic C28xx Device.  If I select Experimenter's Kit Defino F28335 or just F28335 I get all kinds of memory map errors.

  • Hi James,

    Which CCS version are you using? Secondly, you can check the Project -> Properties whether fpu32 is enabled or not. Go through all the menu items in properties.

    Regards,
    Gautam
  • Hi Gautam,
    CCS 6.0.1.00040
    fpu32 is checked.
    Why do I have to use Generic C28xx Device?
  • That's fine. Also, I would like you to check the timings using Profile Clock by using step into function during debugging.

  • I am not really using profiling. I am clearing and setting a GPIO and watching it on a scope. If I let optimization occur, the code runs faster but I cannot set a breakpoint on the multiply instruction, so I question whether the optimizer just got rid of the code since it doesn't actually do much. I suspect it has something to do with Properties-General-Main Generic C28xx Device?
  • Mr. Quinn,

    What CPU frequency are you running at?  20 usec would be 3000 instructions at 150 MHz (assuming zero wait states), or 120 instructions per iteration of your loop.  I would expect more like 6-8 cycles per loop iteration.  It should be very similar to the time required for integer multiplication.

    Regards,

    Bill

  • Bill,

    I am running at 150MHz.  When I put a breakpoint at the multiply and stepped into the operation it was very apparent that it was using the software routine instead of the FPU, even though I had fpu32 selected under processor options.  When I added --float_support=fpu32 under C2000 Compiler the execution time dropped to under 4 usec and the breakpoint shows a floating point instruction.  

    I cannot explain why it needs both, but under General if I try to use anything other than Generic C28xx Device, I get error complaining about memory section overlaps.  I am using a simple DOCK with a F28335 controlCARD.