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.

MSP432E401Y: Optimization Issue

Part Number: MSP432E401Y

Hi all ,

 

We are using the MSP432E401Y microcontroller in our project . We are facing a issue with Release Build( level 2 optimization is selected ).

 

In a Function, we are doing some computation.

 

#define a (19.6)
#define b (0.003)
Lets say Eg : uint16_t var = (uint16_t)((a * b) / 0.005)-1;
Compiler is giving advise : detected floating point oprations.  Recommended moving them to RAM during run time or not using as these are processing/power intensive.

 

in debug build (no optimization) --> works fine

 

in release build (with level 2 optimization) --> the compiler is not generating any code. While optimization this line is getting removed.
This i can see in disassembly code generated.

 

 

Can anyone suggest why it didn't worked after optimization.

  • Just a few thoughts:
    The 432 has hardware floating point support, so simple float arithmetic should not be much of an issue.
    The expression - as you have shown it - can be evaluated at compile time. Could that be what is happening?
    The compiler won't usually throw code away unless it is not being called.
    Can you show the assembler generated?
    Hope that helps

    Jim

  • For code similar to ...

    #define a (19.6)
    #define b (0.003)
    Lets say Eg : uint16_t var = (uint16_t)((a * b) / 0.005)-1;

    ... if var is not used later on (i.e. passed to another function or something similar), then the compiler removes var and all the computation associated with it.

    Thanks and regards,

    -George

  • Also: The FPU on the MSP432E is single-precision, and the expression you suggest is double-precision, so (if executed on the MCU) it will be done in software. That might be what triggers the "advice".