1 Reply Latest reply on Oct 2, 2017 9:40 PM by msur

    How to enable / disable the M4 floating-point unit

    user_1377889

      The M4 internal floating-point unit is disabled by default after startup of the CPU. Are ther any Cy-system calls to enable or disable the FPU?

       

      Bob

        • 1. Re: How to enable / disable the M4 floating-point unit
          msur

          Bob,

           

          PSoC Creator enables the floating point unit automatically, if you enable floating point code compilation (compiler command line input). And by default PSoC Creator enables the floating point code compilation to compiler parameters for M4. You can check that in "Project > Build settings > CM4 > Compiler" and then looking at the compiler parameters generated in grey box on the bottom right side pane. The below line instructs the compiler to compile the code for a device with FPU (the one available in M4). softfp parameter uses normal CPU registers(Rx) for floating point argument passing to a function, where as hardfp use floating point registers(Sx) for floating point argument passing. softfp typically compiles with most floating point libraries (already compiled and linked libraries - like sin/cos libraries). hardfp require hardfp libraries for proper compilation.

           

          "-mfloat-abi=softfp -mfpu=fpv4-sp-d16" - for GCC

           

          The floating point enable code is available in "system_psoc63_cm4.c" file - Cy_SystemInitFpuEnable() function. Note that this function will only enable FPU if compiler is instructed to generate floating point code as mentioned above and is automatically called from the CM4 startup code. You can refer to the function implementation for enabling /disabling the FPU in you application.

           

          Let me know if this helps.

           

          Regards,

          Meenakshi Sundaram R