When I enable FPU in compiler option,My equation result is wrong. 0 + 0 = 0 but I see -107374176 ! (byte view: 0xCCCCCCCC)
Code:
typedef struct { uint16_t year; uint8_t tA; uint8_t tB; uint8_t tc; float fl1; float fl2; }mStruct; in my function: { mStruct g1,g2; . . myload(&g1); . g.fl1+= g.fl1 + paramIn; . . . }
RTOS is used too(RTX with cmsis_os). Everything is OK without FPU option.
What is wrong?
Thanks.
sorry.
myload function load last saved value from eeprom and I set fl1 member to zero for testing in this function.
Its my goal:
g.fl1 = g.fl1 + g.fl1 + paramIn; or g.fl1=2*g.fl1 + paramIn ;
g.fl1 is zero when myload function executed. pramIn is zero too(passed parameter to this function.)
result must be zero in this condition but I see that negative large number when fpu is enable.
Thanks again.
When I change my local struct (g1) to static everything is OK.
Is this the alignment problem?