cancel
Showing results for 
Search instead for 
Did you mean: 

Next or previous statement

-----????_---- ---??as
Associate III
Posted on September 08, 2017 at 11:38

Simply I want to know when the hardfault occured(code statement)?I cant use debug so If I try to read program counter in hardfault function this returns me hardfault program counter.How can I know where Hardfault occurs by reading its program counter?So I must find previous statement when It is in the hardfault?At least I must know next statement(program counter's) in hardfault in case it is impossible to know previous statement.

#program-counter
1 ACCEPTED SOLUTION

Accepted Solutions
AvaTar
Lead
Posted on September 08, 2017 at 12:24

This is a pretty good description on how to work 'backwards' on hardfaults, including how to decode the SCB registers:

https://duckduckgo.com/?q=keil%20hardfault%20pdf+site:www.keil.com&t=hb

http://www.keil.com/appnotes/files/apnt209.pdf

PS: Links use to make post go into moderation ...

View solution in original post

2 REPLIES 2
AvaTar
Lead
Posted on September 08, 2017 at 12:24

This is a pretty good description on how to work 'backwards' on hardfaults, including how to decode the SCB registers:

https://duckduckgo.com/?q=keil%20hardfault%20pdf+site:www.keil.com&t=hb

http://www.keil.com/appnotes/files/apnt209.pdf

PS: Links use to make post go into moderation ...

Posted on September 08, 2017 at 12:56

[shameless self-advertisement]... and for those who like one-page cheatsheets,

http://www.efton.sk/STM32/Cortex_M4_faults.pdf

...[/shameless self-advertisement]