Electronic – an MCU program trace

debuggingjtagmicrocontroller

I have read in a few places about Atmel's support of program traces on their high-end debugger/MCUs. It seems to be that some of the AVR32 processors can be 'traced' by the AVROne! programmer/debugger. See here or this pdf for mentions of the feature.

Initially I thought this was an atmel specific feature, but after reading more it seems that their nanotrace implementation is atmel specific while the concept of a trace is common to many high-end microcontrollers.

Could somebody explain to me what this is, why it it would be more useful than traditional debugging techniques like logging debug over UART or instruction level stepping, and provide some resources on how to use such a feature? I don't care so much if the resources are for the atmel chips I mentioned as I don't plan on actually using the feature in the near future, I just want to be educated and aware of what it can do.

Best Answer

When you trace a program the debugger records jumps and branches while the program is running. This means that when you stop the program or it hits a breakpoint you can figure out how the program got to this point. Some debuggers can also trace data, which means that you can look at the historical contents of variables, not just the current value. So with "ordinary" debugging you can see that the program crashed because of a "divide by zero" bug in line 432, but with tracing you can see that line 432 was executed because the test in line 411 was true and the branch in 422 was not taken and that the variable n was 12 and 13 before it was finally set to zero.