We are using the MC9S12XEQ512.
I've had my share of ILLEGAL_BP, but this one I don't understand.
We use the following code that we lifted from the Freescale sample bootloader to do soft reset:
COPCTL = 0x01;
ARMCOP = 0x00;
When inside the debugger, a soft reset or the hard button reset causes an ILLEGAL_BP (the IP is the customary 0xff13), not always, but < 1 / 5 times. If I exit out of the debugger, the target doesn't seem to have any problem with either the soft or the hard reset.
I tried to set up a user-defined end trigger and trace, but I can never get it to work.
If somebody can shed some light, will be greatly appreciated.
The problem is you can't debug properly over resets, or at least I don't know how. All settings made to breakpoint registers are lost. Debugger detects that something happened, but it is not clear what it was.
It would be nice to use MCU built in trace module to trace over resets. But I think this is also not possible.
The weird thing is that I get this even when I don't have any breakpoint set. I just "run". And as mentioned, the ILLEGAL_BP doesn't happen all the time, but < 1 / 5 times with either the "soft" reset or the hard button reset.
You see ILLEGAL_BP when debugger detects something. Debugger can see this "something" when MCU is reset.