Detect if a debugger is connected in firmware.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Detect if a debugger is connected in firmware.

742 Views
markthedark
Contributor III

Hello,

 

In our code, we use the HALT assembly instruction of the ColdFire in our ASSERT statements to stop our debugger to alert the developer of a serious error. Although ASSERT code should be removed when not debugging, sometimes it can be missed, causing our devices to inadvertently halt when an assert occurs.

 

If it's possible, it would be great if the firmware could detect whether a debugger is connected, and if it is not, then to branch around the HALT instruction and take alternate action.

 

Is anyone aware of whether this is possible? Do any of the BDM registers contain such information?

 

Thanks,

Mark

Labels (1)
0 Kudos
4 Replies

554 Views
miduo
NXP Employee
NXP Employee

Hi,

I am really appreciated the method Tom provided, it is much useful!! For ColdFire V1 itself it is not possible for the processor to detect when the BDM is attached. The pins related with the BDM are out of the memory map so the processor cannot read those pins. And there has no register bit for this purpose. So customer should consider other way to do that.

0 Kudos

554 Views
TomE
Specialist II

Search this forum for the last time this same question was asked.

https://community.nxp.com/message/624440?commentID=624440#comment-624440

It would help if you said WHICH chip you're using. They're not all the same (MCF51 vs MCF54 etc).

Tom

0 Kudos

554 Views
markthedark
Contributor III

Hi Tom,

Thanks for the reply. The MCU is the MCF51MM256. Your clever suggestion in the other post to use a special RAM location is a good idea. I'll give that a try.

It's a shame there isn't a register that the firmware could read.

Thanks,

Mark

0 Kudos

554 Views
TomE
Specialist II

I had this problem on an MPC860 a very long time ago (when the MPC860 was a new chip :-).


When the debugger was connected, some of the debug registers changed from being read/write to read-only, and I detected that. The Debug controller in the ColdFire chips doesn't have that feature (or a lot of other useful ones the MPC860 had). The MPC860 Data Sheet was at Revision 5 in 2001, so that's a long time ago.

Make that "RAM Location" a named global in your program. That should be in the symbol table, so you should be able to set that variable by name to something other than the default value it is loaded with from the debugger. If the Debugger is scriptable, you should be able to "hook the load" so it writes to this variable after downloading the code. Don't use uninitialised static RAM for this, as it could initialise with any value.

Tom

0 Kudos