Reputation: 21
I am developing a program on the STM32F4Discovery board using GCC, GDB and OpenOCD.
I can compile everything just fine, but when I start debugging, the program goes straight to the HardFault Handler, instead of going to the Reset_Handler.
Also, I frequently experience problems when writing to the flash. It usually takes me two tries to successfully write my program in the flash.
Has anyone else ever had this kind of issue with this or any other cortex M4 processor?
Upvotes: 2
Views: 1257
Reputation: 4994
I already had the same problem with an STM32F1, I was using gdb and OpenOCD and the debugger was directly jumping in the hard fault handler when starting to debug. In my case the problem was that the entry point was not defined in the LD linker script. I defined it with the ENTRY directive and then it worked. Without that ENTRY directive I needed to manually do set $pc=Reset_Handler
in GDB (set program counter to the reset handler) to be able to debug.
Another problem can be how OpenOCD is configured to reset the microcontroller, you need to pass the correct command line parameter when starting OpenOCD, have a look here:
Upvotes: 2