AnsweredAssumed Answered

Using structure causes Hardfault exception

Question asked by yi.fan.001 on Jul 23, 2014
Latest reply on Jul 24, 2014 by yi.fan.001
Hi everybody,
I'm trying migrate a program from 28335 to stm32f407. I was using a structure to store some data, and passing the pointer to this structure to a function.
Now I find that if I define the structure variable as global before main, it will always cause Hardfault exception. If I define it in main, a Hardfault exception will happen if I call the function that will use the structure variable in main.
In both situation, the Hardfault exception happens once the main is entered, that is, after the startup file's jump instruction (BX) and the first { after main(void), before any statement in main. So am I using the structure wrong?
Thank you!

Outcomes