Immediate hardfault

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

Immediate hardfault

3,624 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by micrio on Thu Apr 08 06:40:56 MST 2010
I am using LPCXpresso on a target with a LPC1113 processor. I can sometimes get it to work prefectly. My code executes properly. Other times (like now) I get an immediate hardfault after reset. This seems to happen before the initialization runs. How can I interpert the core registers to find the problem? Is the value of the PC saved anywhere so I can find the offending opcode?
0 项奖励
回复
6 回复数

3,569 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Apr 08 08:16:40 MST 2010
I've attached a screenshot of the VECTPC being shown when a hard fault is encountered on LPC11. It looks like you are executing an instruction that causes a hard fault on the LPC11 before the debugger can take action to display VECTPC.

Try setting a breakpoint in the startup code (ie inside cr_startup_lpc11.c, say on the call to SystemInit() ) - this might then allow your code to load without the hard fault being triggered. You should then be able to single step / run until the cause of the hard fault is hit. Hopefully you will then see VECTPC displayed.

Regards,
CodeRedSupport
0 项奖励
回复

3,569 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Apr 08 08:13:31 MST 2010
VECTPC is the address if the instruction (the PC) that caused the fault. So, 0xfffffff8 was the address. Obviosuly that address doesn't exist (which is why you get the fault), so something caused the PC to jump to that address.

Possible reasons include:
- stack corruption - overwriting the stack with data
- calling a function pointer with an invalid address
0 项奖励
回复

3,568 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by micrio on Thu Apr 08 08:10:04 MST 2010
Here is another hardfault that does have the VECTPC.   What does 0xfffffff8 mean?
0 项奖励
回复

3,568 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by micrio on Thu Apr 08 08:00:01 MST 2010
Here is a screenshot of the hardfault.
0 项奖励
回复

3,568 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by micrio on Thu Apr 08 07:47:25 MST 2010
I do not see VECTPC in the core registers pane, or in the peripherals pane either. Is this something that I have to turn on? Does the LPC1113 provide this information?
0 项奖励
回复

3,568 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Apr 08 07:37:03 MST 2010
If you look in the Core Registers view after the hard fault is encountered, a pseudo-register called VECTPC is displayed.

This is your pointer back to the cause of the hard fault - match this address up to the code as shown in a disassembly of the .axf file. Information on how to create a disassembly can be found at:

http://lpcxpresso.code-red-tech.com/LPCXpresso/node/29

Regards,
CodeRedSupport.
0 项奖励
回复