AVR Studio 6 + JTAG ICE 3 = resets SREG:I

Go To Last Post
8 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It appears that when debugging ATmega64 targets using JTAG interface with the new JTAG ICE 3 in AVR Stuido 6 it looses the global interrupts enable bit sometimes when singlestepping?

Running 6.0.1966 sp2.
I do not have any code that ever permanently disables interrupts again but I do have a few routines using the ATOMIC macro. sei() happens after init and there is no use of cli() yet when i debug with run to breakpoint and then continue everything is fine, but singlestep over a simple "if (var==1)"-like test the sreg:i is cleared upon completion of step.
It doesn't always happen, but like every 1 of 4 steps or less.

I have a ISR ticking away in the background at every 20ms and it updates some counters and returns. It should not interfere with singlestep except cause it to take a detour, or atleast it used to do this on old debuggers/studio releases. I suspect debugger uses a workaround to this by disabeling the interrupts for the singlestep but fails to re-enable. Or something of that sort...

I definately suspect a bug here...
Can someone confirm?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is a known fault in SP2. The bottom line is never single-step an instruction that changes the I bit in SREG (SEI, CLI, RETI, BSET, BCLR).

I'd like to say that this was fixed in the newly released 6.1Beta but it actually appears to be worse. I've found there (in the simulator but I think it's across everything) that the I bit is just changing sometimes completely randomly.

As the current issue of 6.1 is a "Beta" I'm hoping that Atmel can sort this one before the final 6.1 release as it makes interrupt using code almost completely impossible to debug.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the feedback clawson. Good to know and I guess I can use breakpoint and run to bypass for now.
Wish it didn't take me so long to figure it out though...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

I'd like to say that this was fixed in the newly released 6.1Beta but it actually appears to be worse. I've found there (in the simulator but I think it's across everything) that the I bit is just changing sometimes completely randomly.

Please file it as a bug in the tracker - that's a blocker bug that would absolutely be fixed before the final release.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Whoops, I thought this was for 6.1. This should be fixed already then.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Indeed, a quick, embarrased, look at the code reveals that the I flag does not get restored on AVR8 after a singlestep.
For the simulator, which uses a different code path, I've found a race condition which explains the wierdness.
The workaround for both is to turn off "Interrupt free stepping" in Tools | Options.

Both are filed as a blocker bug AVRSV-4474.

Dan

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As long as there is a workaround and it will be fixed I am very happy!

S6 is the best studio so far and combined with astyle plugin it is awsome. Keep up the good work!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:

S6 is the best studio so far and combined with astyle plugin it is awsome. Keep up the good work!

Try the Naggy plugin too - it's not perfect as it can get confused by some of the GCC specific language extensions, but it works great for detecting errors early.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!