How to get the fault cause on KL03 for a Hard Fault?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to get the fault cause on KL03 for a Hard Fault?

995 次查看
gauravbanyal
Contributor IV

Hello,

 

I am running into some random hard faults and I would like to get more information on whats causing it.

Would be great if I can get a custom HardFault_Handler function that reads the right registers to find the cause of the hard fault.

 

I read many forums posts but haven't got a direct answer.

 

Thanks for your help!

 

Gaurav.

标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

862 次查看
BlackNight
NXP Employee
NXP Employee

Hi Gaurav,

there is a hard fault handler widely used for Cortex-M listed here:

Debugging Hard Faults on ARM Cortex-M

If using gdb, you can use the one listed here with GDB scripts:

Debugging ARM Cortex-M Hard Faults with GDB Custom Command

You can find the hard fault handler on GitHub:

McuOnEclipseLibrary/McuHardFault.c at master · GitHub 

I hope this helps,

Erich

0 项奖励
回复

862 次查看
gauravbanyal
Contributor IV

Hi Erich,

I am using Keil for development on my KL03z and I don't have processor expert mode.

I have actually seen these links before but I couldn't get much out of those.

Would be nice if I could get a HardFault_Handler() function implemented so that it captures the ARM registers just before entering the fault handling and captures the fault status registers.

Thanks,

Gaurav.

0 项奖励
回复