cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476 nucleo and Truestudio , how to force Truestudio to use the FPU?

Mich1
Associate III

Hello,

I have the following basic code calls every 20msec.

    double test = 2.80009;
		
    TESTA11_ON;
    for (i=0; i < 500; i++)
    {
        test *= test;
    }
    TESTA11_OFF;

When I compile and link with or without the FPU I always have the same processing time and current consumption.

Here below are the two Truestudio configurations:

With FPU set in Assembler, Compiler and Linker target:

0690X000006DC5PQAW.jpg

Without FPU set in Assembler, Compiler and Linker target:

0690X000006DC55QAG.jpg

What am I wrong?

Why does these options have no effect?

How can I force the FPU usage?

Best regards

Mich

3 REPLIES 3
Kraal
Senior III

Hi there,

Your first message used double which would require soft libraries, but then you changed to float...

In case it is really a float, maybe the code is being trashed because you are not doing something useful with the variable test, and the compiler is optimizing too much...

Could you give us more info on the compiler options ?

Edit: you seem to have changed back to double. The FPU on L4 is single precision only, aka float, not double. If you change the variable to float do you still see the issue. In any case, a look at the disassembly would tell you immediately if instructions with starting with the letter V are present.

AvaTar
Lead

The M4 FPU supports only double transfer instructions, but no double operation at all.

Use only float, and compare the timings.

BTW, "2.80009" is a double constant, not a float constant. Changing only the variable type will nonetheless involve a double->float conversion.

Mich1
Associate III

You are fully right.

No difference between with or without FPU on double variable.

Improvement x12 with FPU compared to without on float variable.