What is allowed in HardFault_Handler?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What is allowed in HardFault_Handler?

714件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Muis on Mon Jan 21 12:17:48 MST 2013
I'm having trouble to understand what is (and what is not) allowed in a HardFault_Handler. Can you do anything you would do in normal code, for example: write the error to a log-file in a sd-card? And is the only restriction that you may not leave the interrupt? Or are you not supposed to touch any variabeles and only use printf() for example?
0 件の賞賛
返信
2 返答(返信)

652件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Brutte on Tue Jan 22 03:47:12 MST 2013

Quote: MikeSimmonds
[FONT=Tahoma][SIZE=1]This is a bit of an open ended question.
[/SIZE][/FONT][FONT=Tahoma][SIZE=1]You shotld not expect to recover from a hard fault -- so you can do what you like to your own program variables.

Sorry if this is a bit vague, but so are the posibilities.

[/SIZE][/FONT]

[FONT=Tahoma][SIZE=1]

To be more precise:

[/SIZE][/FONT]
Quote: ARMv7M-ARM HardFault definition

HardFault is the generic fault that exists for all classes of fault that cannot be handled by any of the other exception mechanisms. HardFault will typically be used for unrecoverable system failure situations, though this is not required, and some uses of HardFault might be recoverable.


I think it is a good place to make a dump of RAM and registers and to display a nice BSOD with your logo :)
0 件の賞賛
返信

652件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by MikeSimmonds on Mon Jan 21 16:05:40 MST 2013
[FONT=Tahoma][SIZE=1]This is a bit of an open ended question.

Theoretically, you can do whatever you like in the H/F handler PROVIDED that you do not cause
any other faults (unaligned access, memory management, usage). This will lead to lockup and the cpu will reboot.
I.e. be careful about memory read/write, stack space etc.

You can even call subroutines.

However, no other interrupts will occur - so nothing may rely on this. E.g. all I/O must be polled. No timer, SPI/I2C/SD card etc. interrupts.

There is a page on code red site that shows how to get registers and fault status; you could then send these to a uart.
([/SIZE][/FONT][FONT=Tahoma][SIZE=1]http://support.code-red-tech.com/CodeRedWiki/DebugHardFault[/SIZE][/FONT][FONT=Tahoma][SIZE=1])
Maybe you can adapt it to write logs.

You shotld not expect to recover from a hard fault -- so you can do what you like to your own program variables.

Sorry if this is a bit vague, but so are the posibilities.

Mike




[/SIZE][/FONT]
0 件の賞賛
返信