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.

TM4C123GH6PM: FPU calculations

Part Number: TM4C123GH6PM

hello,

i have an issue using the FPU with keil uvision 5,

when i define a local variable the FPU calculations are done and i could see the results in the float registers, but the value of the declared variable remains 0,

but works just fine if it's a global variable, array,  or if i used the volatile keyword with local variables.

what i'm missing here?

  • I am not familiar with the Keil compiler, but from your description it sounds as though it was not necessary to store the result in your local variable for the code to make the correct comparison and return the status. This is probably just the optimizer being efficient. Other than being able to examine the result in the local variable, is the function returning the correct response?
  • Thanks,

    No the function doesn't return the correct response, and the optimization level is 0.

  • It is highly unlikely that this is a Cortex M4 FPU issue. If you think it is a coding problem, can you provide a small test case? If you think it is a compiler issue, you need to contact Keil.
  • i followed the numbers through the FPU register and found out that it actually performs all the calculations in the code correctly and it actually returns the correct values they are just not available in the watch window for some reason, so i will contact Keil.

    Thanks for your help.