AnsweredAssumed Answered

STM32F4 simple math calculation causes hardfault

Question asked by karakaya.mehmet on Mar 21, 2013
Latest reply on Mar 23, 2013 by karakaya.mehmet
float hypo2;
int32_t XH=0,YH=0,ZH=0;
hypo2= (XH*(XH*1.0) + YH*(YH*1.0));

hello forum,

in the above code XH and YH are 32 bit integers
hypo2 is float variable

becouse I want the calculation result to be float
thats why I multiply XH with 1.0 when calculation square of it

however at this point the program crashes and uC goes into hardfault handler

the same code is working at STM32F103 without  error

my compiler is yagarto

please advice , thank you