This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TM4C129ENCPDT: UARTprintf vs. printf - how does printf send data to CCS Console?

Part Number: TM4C129ENCPDT


I have used UARTprintf, connected a USB CDC, and opened the corresponding serial port in CCS Terminal. In that scenario, I understand exactly how the data gets from the firmware to the screen. The source for UARTprintf is provided.

I also recently noticed that printf output will appear in the CCS Console. I cannot find the source for printf, and I want to understand how the data is getting across the connection to the computer. Can anyone shed light on this?

On a related note, I'd like to disconnect this Console output and ensure that my own printf is used. After searching this forum, the recommended settings are not visible in my project, so I don't know where else to look.

  • Hi Brian,
    The printf function that prints to the Code Composer Studio console window uses a breakpoint and JTAG to transfer characters from the device to the PC. It is for debug pruposes. Here is a link with some more information:
    processors.wiki.ti.com/.../Tips_for_using_printf
    I will keep following this thread, but will pass it off to the compiler team as they will be better able to answer your follow on questions.
  • Brian Willoughby18 said:
    I cannot find the source for printf, and I want to understand how the data is getting across the connection to the computer. Can anyone shed light on this?

    CIO System Call Protocol has some detail on the protocol when using the TI ARM compiler. When using the GCC ARM compiler the Semihosting protocol is used.

    For the TI ARM compiler the source files for printf and supporting functions are in the <css_install_root>/ccsv8/tools/compiler/ti-cgt-arm_<version>/lib/src directory. trgmsg.c is the source file containing the low-level __TI_writemsg() and __TI_readmsg() which communicate between the program on the target and the CCS debugger as part of the CIO protocol.

    Brian Willoughby18 said:
    On a related note, I'd like to disconnect this Console output and ensure that my own printf is used.

    The CIO console only appears in the CCS debugger when the target attempts to use CIO (and the debug project properties have been selected the "Enable CIO function use (requires setting a breakpoint)" option). Do you mean you are creating a replacement printf and want the output of that to appear in the CIO console of the CCS debugger?

  • Chester Gillon said:
    The CIO console only appears in the CCS debugger when the target attempts to use CIO (and the debug project properties have been selected the "Enable CIO function use (requires setting a breakpoint)" option). Do you mean you are creating a replacement printf and want the output of that to appear in the CIO console of the CCS debugger?

    No, I want to avoid the CIO Console and make sure my Flash binary doesn't include any of that code.

    I was confused because,

    1) I didn't know that the CIO Console existed

    2) We started using UARTprintf() at the beginning of the project

    3) We eventually wrote our own uart_printf()

    4) We then used a preprocessor macro to #define printf() as either UARTprintf() or uart_printf() on a project by project basis

    5) Finally, as a test, I left out our macro and noticed that there is a printf() around, and then was concerned that I had no way to remove that.

    Thanks for pointing out the "Enable CIO function use" option in CCS. Older E2E threads pointed in a different direction, and I couldn't find it. For folks who are following along, the option is in the project Properties under Debug and then Program/Memory Load Options.