S12X: Does Reset Change the Stack Pointer?

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

S12X: Does Reset Change the Stack Pointer?

ソリューションへジャンプ
1,397件の閲覧回数
davekellogg
Contributor II

Using S12XE processor, and trying to track down the source of an infrequent COP time-out.

 

I know that the COP timeout forces a reset.  What I'd like to do in the COP ISR is look back at the stack frame when the COP occured, particularly the PC.  Of course, this will work only if the SP 's value is not changed by the reset.

 

So, is the stack pointer unchanged across a COP-induced reset?

 

Thanks!!

Dave Kellogg

ラベル(1)
0 件の賞賛
返信
1 解決策
1,128件の閲覧回数
GordonD
Contributor IV

Dave,

I checked with design and unfortunately, the stack pointer is reset (cleared) for any reset. This it a difficult problem and one that can generally only be solved with the use of a full in-circuit Emulator with external trace memory. However, the on-chip debug module (S12XDBG) could help you. It can be set up for "Pure PC mode" where all program counter addresses are stored in the trace buffer. Since a reset, other than a POR, does not affect the contents of the trace buffer or the DBGCNT register, the COP reset routine could look at the DBGCNT register and read the appropriate number of entries from the trace buffer.

This should allow you to determine where the code was executing when the COP reset occurred.

Best Regards,

Gordon

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
1,129件の閲覧回数
GordonD
Contributor IV

Dave,

I checked with design and unfortunately, the stack pointer is reset (cleared) for any reset. This it a difficult problem and one that can generally only be solved with the use of a full in-circuit Emulator with external trace memory. However, the on-chip debug module (S12XDBG) could help you. It can be set up for "Pure PC mode" where all program counter addresses are stored in the trace buffer. Since a reset, other than a POR, does not affect the contents of the trace buffer or the DBGCNT register, the COP reset routine could look at the DBGCNT register and read the appropriate number of entries from the trace buffer.

This should allow you to determine where the code was executing when the COP reset occurred.

Best Regards,

Gordon

0 件の賞賛
返信
1,128件の閲覧回数
davekellogg
Contributor II

Hi Gordon,

Thanks for your response and insight.  I had totally forgotten about the trace buffer.  The approach makes sense.  When I dragged out my old hard copy of the manual, I found a note I had written several years ago about this possiblity.

Dave Kellogg

0 件の賞賛
返信