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.

MSP432P4xx Driver Library FPU-Example Project - Using on MSP432 Launchpad

Other Parts Discussed in Thread: MSPWARE

Hello dear TI-Support Team,

I am using the new MSP432 P401R Launchpad and want to test the FPU. The given code composer studio 6.1 exampleproject from MSPWare  "fpu_simple_floating_point_operation" in the DriverLibrary for MSP432xx shall show how efficient the FPU is.

Unfortunatelly I can't see any difference in the execution time with/without the FPU enabled by the Driverlib Function "MAP_FPU_enableModule();"

I used the LED on Port 1.0 to indicate the time for the large floatingpoiint calculation:

while(1)
{
     for(ii=0;ii<200;ii++)
     {
      fCalculate = (sin(50.5) * (12.2f / 50.1f) * 10.22f / 3) * ii;
     }
     MAP_GPIO_toggleOutputOnPin(GPIO_PORT_P1, GPIO_PIN0); //should toggle faster when FPU is enabled
}

With the FPU enabled (by a button, like shown in the example) i expect a faster blinking... Is the project running correctly on the MPS432 Launchpad?

Thank you in advance,

Benjamin H.

  • Benjamin!

    That is too fast :-) It has not arrived yet.
    Sure there will be others already playing around with it, too.

    Dennis
  • Hi Benjamin,

    I am seeing issues with this code example as well here on my side - we're going to look into it and may need to change the example. I'll let you know as soon as we have a resolution, and thanks so much for pointing it out.

    Regards,
    Katie
  • Benjamin,

    Thank you for your post. I am confirming a few things with our compiler team right now regarding the usage of FPU functions and assembly that is generated with the FPU settings enabled. As soon as I get an answer, I will update the thread here (and provide a new example if needed).

    Best Regards,
    Tim

  • Hello Katie and Dennis,

    thank you very much so far for your attempts to help. I look forward to use the new Controller with all its nice new features!

    Best regards,

    Benjamin Herzlich

  • Benjamin,

    After doing a little bit of research, I was able to conclude that this code example should be fundamentally changed.

    When the FPU is enabled (by specifying --float_support=FPv4SPD16 in the compiler settings along with having a runtime library that supports the FPU), this means that special "VFP" floating point instructions will be generated by the compiler and used for relevant floating point operations.  The FPU_enableModule/FPU_disableModule functions only enable/disable the floating point coprocessor and obviously have no bearing on what assembly is generated. 

    So, in summary, the short answer is that you should not have to worry about pragmatically enabling/disabling the FPU. This is done by the runtime library and compiler settings depending on what is enabled. The APIs exist for power users that might want to selectively enable/disable the FPU to save on power consumption or configure advanced aspects of the module.

    I will update this example to be more relevant (and correct) and have it fixed in the next release. 

    Best Regards,

    Tim

  • Thank you!
    Best Regards,
    Benjamin
  • On early PCs, the co-processor was more expensive than the whole PC. SO some emulators were written. When an FPU instruction was encountered, an exception interrupt was triggered and the interrupt code was simulating the FPU operation in software. If the FPU was there, the emulator was not active and the code "executed" faster (actually not triggering the interrupt). So the same binary code executed differently depending on the presence of an FPU.
    However, on the 432, the code is compiled for the 432 and the 432 always has an FPU. So, as Timothy correctly stated, the code is compiled to either use the FPU or not. Two different binary codes for two different situations.

    On MSP430 CPUs, the hardware multiplier can't save its state. So during an MPY operation, interrupts have to be disabled, or (in case of lengthy MAC operations that must not block interrupts for too long) the hardware multiplier must not be used inside ISRs. However, this is hardcoded too - either the code is compiled this or that way, depending on compiler switches.
    The reasons for using or not used the FPU may be different for the 432, but the effect is the same.
  • But how could I test the FPU's performance?
  • Compile the program two ways - once with FPU support and once without. Then profile the code to find the performance gain of the FPU.

**Attention** This is a public forum