Hi, Sebasira.
Interesting questions should be answered :smileyhappy:. And here is what I have to say:
Yes, debuggers watchpoint with break condition entered seems slowing execution enormously. But if you read all S12 docs (S12BKPV? module), then you should be aware that S12 breakpoints hardware allows breaking on some certain byte read or written to some certain address. So in theory you can detect and break on PPAGE set to weird value.
But problem is that debugger doesn't support all possible HW breakpoint modes and you need to set up S12BKP hardware "by hand". There are two choices
1) Doing it from code. You hit run in debugger, and your code should execute lines below. Since this will overwrite debuggers breakpoint settings, you shouldn't stop and run again after these lines are executed.
BKP0X = 0; // full PPAGE address, 0x00030
BKP0H = 0;
BKP0L = 0x30;
BKP1H = 9; // Data to be compared. since PPAGE is at even address,
// data to be compared should be placed into H part of
// BKP1
BKPCT1 = BKPCT1_BK0MBH_MASK * 0 // full address match of PPAGE
| BKPCT1_BK0MBL_MASK * 0 //
| BKPCT1_BK1MBH_MASK * 0 // compare high part of data bus, PPAGE is at even address
| BKPCT1_BK1MBL_MASK * 1 //
| BKPCT1_BK0RWE_MASK * 1 // compare R/W signal
| BKPCT1_BK0RW_MASK * 0 // only write cycle is important
| BKPCT1_BK1RWE_MASK * 0
| BKPCT1_BK1RW_MASK * 0
;//
BKPCT0 = 0xE0; // enable breakpoint, full mode, BDM on breakpoint, non tag
At least on S12D64 it is working.
2). It is possible to do the same using debuggers GUI:
1. Go HC12MultilinkCyclonePro -> Set Hardware BP... menu and set Breakpoint Module mode to User Controlled.
2. Go to 22-bits Break Module tab and set it up as attached
What I noticed in CW5.1 debugger, every time you reset target, User Mode BKP settings are not resent to target and you need to open and then close HC12MultilinkCyclonePro -> Set Hardware BP... dialog. After dialog is closed, you hit run and it should break after PPAGE=9.
There's one more problem, debugger seems stopping few instructions past write to PPAGE. It seems that CPU first finishes executing queued instructions, and only then enters active BDM mode.
Hope it helps.