David VanHorn <[email protected]> wrote: > In the data sheet, they mention that the jtag breakpointing is done > by reprogramming a register.
There's two kinds of breakpoint for JTAG debugging: true JTAG engine breakpoints, and "soft" breakpoints. The JTAG engine itself has 4 breakpoint registers. The ICE reserves one of them for single-stepping, so this leaves three to the user. Out of these, one can be used as a data breakpoint register (a "watch" in GDB terms), optionally combined with a second one specifying the data mask (which only fits into GDB's "watch" model iff the data is properly aligned to fit into the mask). Breakpoint registers not in use for a data breakpoint can be used for code breakpoints. So if no data breakpoints are used, this leaves three JTAG hardware breakpoints to the user. Any further breakpoint requested can be implemented as a "soft" breakpoint (except on the ATmega128 which lacks the BREAK instruction): the ICE transparently reprograms the corresponding flash page, replacing the instruction on the breakpoint address by a BREAK instruction. When the breakpoint is hit, or when the ICE disconnects, the original flash page contents is then restored. (Thus, it is super important to always say "Goodbye!" to the ICE correctly.) Yes, this causes some additional flash wear. OTOH, reprogramming a flash page doesn't require a device erase but is handled by a page erase, which I've been told is much less stressful to the flash than a device erase is, so the expected wearout is way below what is in the specs. Anyway, the general recommendation is to not ship parts to your customers that have been used for soft breakpoint debugging before. In GDB, you can temporarily "disable" all breakpoints you aren't currently using. If the total number of remaining breakpoints is at most three (possibly including the data breakpoint stuff mentioned above), AVaRICE will always request these to be JTAG (hardware) breakpoints. Note that debugWIRE doesn't offer any hardware breakpoint feature, so any breakpoint there is handled as a soft breakpoint. -- cheers, J"org .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/ NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) _______________________________________________ AVR-chat mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/avr-chat
