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.

Using the FPU on the Tiva Launchpad

Hello,

I wanted to start a project using the Floating Point Unit on the Tiva Launchpad (TM4C123GXL). I looked at the official workbok and copied the FPU-example. But there is something i dont understand. If I measure the clock cycles like described in the workbook i get  34790 clock cycles.

If i comment out the functions  ROM_FPULazyStackingEnable() and ROM_FPUEnable() and restart the Launchpad the FPU should be turned off. But if i measure the clock cycles with disabled FPU I get 34392 clock cycles!

I thought the FPU would speed up the floating point arithmetics, but my program even needs some more clock cycles  with the FPU turned on. 

Did I unterstand something wrong about the FPU or are there some Compiler settings missing or something?

If you can explain me this behaviour I would be thankful.

Thank you for your answer.

 

(Link to the workbook:  http://software-dl.ti.com/trainingTTO/trainingTTO_public_sw/GSW-TM4C123G-LaunchPad/TM4C123G_LaunchPad_Workshop_Workbook.pdf , Lab 9)

  • Ken Dert said:
    If i comment out the functions  ROM_FPULazyStackingEnable() and ROM_FPUEnable() and restart the Launchpad the FPU should be turned off.

    The runtime startup routine enables the FPU by default. Just for reference try ROM_FPUDisable() to see what happens. It should end up in a fault handler when the first FPU instruction gets executed.

    The --float-support (Project properties -> Build -> ARM Compiler -> Processor Options) option is what tells the compiler what code to generate and the TI linker has some "automagical" support to link (and build!) in the correct runtime library. By default it uses FPv4SPD16. To remove FPU instructions, you can try the vfplib option. Pretty sure the vfplib is a soft FPU library, but I haven't looked very hard. How well supported or functional vfplib is on Tiva parts, I have no idea. I suspect there is no reason to use it...

    I just rebuilt the the lab9 project with --float-support=vfplib and got a Count Event    204022

  • Thank you for your answer. That really makes sense. I thought the FPU would be disabled by default because thats what is written in the workbook...