I have, for some time, been planning to complement my development bench with a JTAG "dongle", but this got me thinking:
In another thread (https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=26492&start=15), which I did not want to hi-jack lfmorrison claims that
Don't forget, though -- When you're stepping through code with an ICE, you're actually re-flashing the chip on a repeated basis, inserting breakpoints. So it actually will contribute to wearing out your micro more quickly.
Is this really true?
I have done some reading of other threads here and found nothing conclusive.
I just browsed the JTAG section of the ATmega16 data sheet, and although I have to admit I really don't understand all of it yet (and probably need to read it a few times more) I rather get the impression (eg. figure 112 on page 221) that the JTAG part of the chip monitors the program counter in the AVR core and breaks when it "hits" a breakpoint address.
If so, this would not need any re-flashing of the chip, would it?
Stepping through code would then be implemented as setting a breakpoint at the next "step-stop" and when hitting that removing it and setting a new breakpoint at the next-next "step-stop" and so on.
An alternative to this model of having a parallell system monitoring the processor proper would be to have a special breakpoint instruction that is being inserted into the machine code being executed, and this would indeed require a re-flash every time a break-point is inserted or deleted. This would, however put no low restriction on the number of possible breakpoints but the data sheet talks about a maximum of four. So this also contradicts the notion of re-flashing for manipulating break-points.
So how does this really work? Are JTAG breakpoints implemented as special machine instructions in FLASH?