I'm using an MK02FN64VLF10 with KDS, porting an application from an HCS08. I've used the WFI instruction in place of the HCS08's WAIT instruction to pause a loop while waiting for a periodic interrupt. It works fine, but when I'm using the debugger the WFI instruction causes it to stop with a "suspended : signal : SIGTRAP : Trace/breakpoint trap" message. After that it seems to keep running but the debugger is disconnected. My debug connection is via SWD to a P&E Multilink Universal.
It's just a nuisance at this point, but I can't find any information on whether this is the expected behavior and the best way to avoid it. I can just exclude the WFI instruction in the debug build, but then it's a less accurate representation of the system's actual behavior. Is there another way around this?