5
\$\begingroup\$

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.

\$\endgroup\$
1

2 Answers 2

6
\$\begingroup\$

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.

\$\endgroup\$
0
0
\$\begingroup\$

The NanoTrace is like a regular trace that dumps to on-chip memory instead of the AUX port so that you can read it off with a low cost (slow) debugger. While this allows you to spend less (~$550) on the debugger it slows down the operation of the target microcontroller . This will only really become a problem if you're trying debug a time critical operation. For most hobbyists this is never a problem.

However, this would be faster than logging debug over UART and instruction level stepping doesn't really enter in to the comparison (though it is usually done through the JTAG interface as well).

Basically, it's a common feature of microcontrollers with a fancy name.

\$\endgroup\$
2
  • \$\begingroup\$ So my question wasn't about nanotrace specifically. I want to know what a "regular trace" can do exactly and when you would use it. What kind of information can you "dump" to the AUX port during a trace that would be helpful for debugging? \$\endgroup\$
    – NickHalden
    May 16, 2013 at 15:00
  • \$\begingroup\$ A trace is like a communication channel with the microcontroller. It can be used for making printf statements in microcontroller code that will be received by the IDE while debugging. It works the other way too, you can change the values of some registers through the debug interface. Basically, it makes the debug process less of a "ok, it's done, how did it go?" and more of a "how are things going this instant?". There is a bit more information here - electronicdesign.com/embedded/… \$\endgroup\$
    – Samuel
    May 20, 2013 at 0:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.