Hello, I am using Keil uVision V 5.15.
Controller is STM32f070cb.
I am using STM32 discovery board as debugger.
While debugging the device the PC reached to HardFault_Handler in start up file of the controller.
A Hard Fault handler should be able to determine the instructions causing the fault. Look at the stacked context, and registers, then look at the surrounding instructions against that context.
Other frequent causes of Hard Fault are touching memory inappropriately, or attempting to run ARM 32-bit code, often in external libraries. On the Cortex-M0 watch also for memory alignment faults, it can't load unaligned 32-bit values.
Use a proper Hard Fault Handler to dump the context, and look at the faulting code.
This is a topic I've covered here hundreds of times, please review some of the other threads.
A better fault handler and error handler?
Retrieving data ...