2
\$\begingroup\$

Is it possible to configure stderr and/or stdout to make it such that when a printf() is called the string is displayed in the debug console in Atmel Studio?

I do know that it is possible to set everything up so that printf() uses the UART or an LCD or something else.

I have seen hints of this having been possible with AVR32 chips and JTAGICE2 debuggers, but that was back when it was AVR studio and AVR32 Studio as separate IDE's, toolchains, debugging hardware, etc. For the sake of specificity, I would like to do this with an AVR 8-bit chip and an ATMEL ICE (the successor to the JTAGICE3) debugger. I am working with PDI, but an alternative communication protocol (such as JTAG) would be acceptable also.

\$\endgroup\$
6
\$\begingroup\$

You can output messages and values to the output window with Atmel Studio 7 (it might work with other versions but I am running version 7.0.1006 and using Atmel ICE) by doing this:

  1. Create a normal breakpoint where you want the output.
  2. Right-click on the breakpoint and select "Actions".
  3. A window will be displayed under the breakpoint line, if the "Actions" checkbox is not already checked, check it by clicking on the checkbox, but it should be because of step 2.
  4. There is a textbox labeled "Log a message to Output Window", type in whatever you want to output. This works with plain text if you just want to display something like "entered function a" or just put whatever value you want in brackets. An example of outputting a variable value: "The value of x is {x}", where x is the variable name.
  5. If you don't want the execution to stop check "Continue execution" and the program will not actually stop at the breakpoint (like it normally would).

Also, watch out for optimization! You might need to completely turn it off for your debug build to see certain values or states.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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