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.


1 Answer 1


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.

  • \$\begingroup\$ This solution has a draw back. If you single step, the debugger sets a temporary breakpoint (BP) at the next code line and starts the CPU. If you step over a function call that passes the prepared BP, the debugger deletes the temporary BP after reaching the prepared BP. The effect is that the execution doesn't stop at the next line. So single stepping is not reliable anymore. Unfortunately I don't have a better proposal. \$\endgroup\$
    – harper
    Commented Aug 3, 2020 at 6:33

Your Answer

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

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