Instruction stepping with interrupts

cancel
Showing results for 
Search instead for 
Did you mean: 

Instruction stepping with interrupts

346 Views
scottm
Senior Contributor I

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?

Thanks,

Scott

Labels (1)
0 Kudos
6 Replies

122 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

I tested it on K22. I use twrk22f120m_ewm demo and MCUXpresso 10.3. But I didn't see the problem. What IDE do you use? Can you give ax example?

Regards,

Jing

0 Kudos

122 Views
scottm
Senior Contributor I

P&E just gave me a gdb plugin update that fixed one of my problems.  As soon as I come across another good example of the interrupt stepping issue I'll get a capture of it.

In the meantime, can you tell me how it's supposed to work?  Should instruction stepping mode always suppress interrupts?  Is there a way to instruction step into an ISR short of setting a breakpoint in the ISR?

0 Kudos

122 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Scott.

What's your chip part number?

can you please provide us demo project to reproduce your issue?

Best Regards

Jennie Zhang

0 Kudos

122 Views
scottm
Senior Contributor I

At the moment I'm using the MK22FN1M0AVLH12.  The project I'm working on is moderately complex and doesn't run without modification on any evaluation board.  Before I spend a lot of time preparing a simplified example, can you tell me what the expected behavior is?  Should the debugger always suppress interrupts while in instruction stepping mode?  Should it follow into ISRs?

0 Kudos

122 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Scott,

Entry to debug mode has no effect on the EWM.
• If the EWM is enabled prior to entry of debug mode, it remains enabled.
• If the EWM is disabled prior to entry of debug mode, it remains disabled.

I think you can disable EWM when debug.

Regards,

Jing

0 Kudos

122 Views
scottm
Senior Contributor I

Hi Jing,

My question is not about the EWM - that was just an example of an interrupt occurring during debug.  My question is what the expected behavior is for the debugger when it's in instruction stepping mode and an interrupt occurs.  I'd really like to be able to always step to the next instruction, regardless of where it is, but the interrupt is happening between steps and I'm not able to see what's happening.

Scott

0 Kudos