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.

printf to console

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C1294XL

Device: tm4c123gh6pm (TM4C123G launchpad)

IDE: Code Composer Version: 6.1.1.00022

I am able to see output on the debug console window with the puts statement ( ex - puts("Hello, world!"); ).

However, I do not see output with the printf statement ( ex - printf("Hello world Again!"); ).

I have the following settings

Project->Properties->CCS Build->ARM Compilier->Advanced Options->Library Function Assumptions  Level of printf/scanf support required: full

Project->Properties->Debug  *checked* Enable CIO function use.

Any idea on what I could be missing?

  • Hello Vincent,

    Moving it to CCS Forum

    Regards
    Amit
  • Vincent Gagliardo said:
    However, I do not see output with the printf statement ( ex - printf("Hello world Again!"); ).

    printf is line-buffered, so the output doesn't appear until either a \n or an explicit fflush(stdout)

  • Chester,

    Thank you for your quick response.  "\n" works.

    I tried calling fflush(stdout) and it did not work.  Is there something special I need to do to call it explicitly?

  • Vincent Gagliardo said:
    I tried calling fflush(stdout) and it did not work.  Is there something special I need to do to call it explicitly?

    I just tested this small example on a EK-TM4C1294XL and it worked as expected, in that the fflush(stdio) caused the preceding text to be output on the CIO console:

    #include <stdio.h>
    
    /*
     * hello.c
     */
    int main(void) {
    	printf("Hello");
    	fflush (stdout);
    	printf(" World!");
    	fflush (stdout);
    	
    	return 0;
    }
    

    This was with CCS 6.0, TI ARM compiler v5.2.4 and the stack and heap size both set to 512 bytes.

  • Interesting.... If I remove the first printf statement it doesn't work.

    Does it do the same for you?

    BTW, thank you for your responses. You've been very helpful.
  • Vincent Gagliardo said:
    Interesting.... If I remove the first printf statement it doesn't work.

    Does it do the same for you?

    I commented out the first printf statement, and it still worked (in that the text from the second printf was output by the following fflush(stdio) call.

    Not sure what is causing your problem, but in my case I am running an older CCS 6.0.1.00040.

    My complete CCS project is attached. CIO_flush.zip