I asked this question in a thread last year and didn't really get an answer, and it's come up again.
I'm tracking down a hard fault in my code and even when I'm in instruction stepping mode, the hard fault appears to occur at the same innocuous add instruction. If I turn on the instruction trace I can see that it's getting an EWM interrupt (expected since it's timing out while debugging) and executing another 8000 instructions.
What I want is to always execute one instruction at a time, even if there's an interrupt. Is this even possible?
The code I'm stepping through is not in a critical section but the EWM interrupt occurs always at the same instruction. I've been told that interrupts are masked while instruction stepping, but that doesn't seem to be the case here. If they weren't masked at all I'd expect the EWM interrupt to happen on the first line stepped through, but it's acting like it's masked up until the add instruction. The add instruction comes immediately after a branch out of a for loop, so maybe that means something.
How do I ensure that I can always step through to the next instruction? Or failing that, how do I ensure that interrupts are consistently masked during instruction stepping?