Detecting debug mode at run-time

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

Detecting debug mode at run-time

ソリューションへジャンプ
1,325件の閲覧回数
dwhite
Contributor I

MC9S12XDT256

P&E USB ML12 and True-Time debugger

 

I need to determine at run-time if my debugger is in control. I have an external watchdog that resets the CPU when it hits a breakpoint but the external watchdog can be disabled during initialization if the firmware can reliably determine when it is in debug mode. So, I need to determine if the debuger MIGHT stop the CPU later and disable the watchdog in my powerup code.

 

I have a solution that reads the DBGC1 register to determine the mode. I found that this register is either 0x00 when not debugging or 0xB0 or 0xBC when the debugger is connected. I have read the ref manual on the Debug module but I'm not sure I understand it very well. It doesn't look like I can rely on more than three bits to be in a known state in all debug modes. So right now this is my solution:

 

if((DBGC1 & 0xB0) == 0xB0)

 

Since the reliability of this watchdog is critical, I need to make sure that the solution is foolproof.

 

If anyone can confirm my findings or suggest a better solution to my problem, I would appreciate it.

ラベル(1)
0 件の賞賛
1 解決策
310件の閲覧回数
kef
Specialist I

Unless you are using hotplug debugging, almost every debug session happens in special single chip mode. To distinct special from normal mode, you can use MODE register MODC bit.

 

if( MODE & MODE_MODC_MASK )

{

    //normal mode detected, BKGD pin wasn't pulled low on reset

}

 

元の投稿で解決策を見る

0 件の賞賛
1 返信
311件の閲覧回数
kef
Specialist I

Unless you are using hotplug debugging, almost every debug session happens in special single chip mode. To distinct special from normal mode, you can use MODE register MODC bit.

 

if( MODE & MODE_MODC_MASK )

{

    //normal mode detected, BKGD pin wasn't pulled low on reset

}

 

0 件の賞賛