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.

Not properly flushing printf() statements in code composer



int main() {

printf("Value1: ");
printf("\nValue2: ");
printf("\nValue3: " );
printf("\nValue4: ");
printf("\nsomething");

return 0; } // This is the output // // [C674X_0] Value1: // Value2: // Value3: // Value4:

// I don't know why it's not printing the last printf statement

// As I step thru the code, I don't see "Value1" get printed till I am on Value3

// Does anyone know what's going on here?

  • Rummy,

    // I don't know why it's not printing the last printf statement


    1. It should print the last statement. Post the screenshot of CCS here and upload your code.

    // As I step thru the code, I don't see "Value1" get printed till I am on Value3

    2. In your post, you mentioned that the text, "Value 1 " gets printed before the text, "Value2"....?

    // Does anyone know what's going on here?


    It must be a simple thing which is solvable if you look into the code line by line.
  • Hi,

    Thanks for your post.

    I don't think, there shouldn't be any issue with code generation compiler tools which is a part of CCS installation and there shouldn't be any chance of compiler tools malfunctioning. I mean, you don't have to suspect printf statements not properly flushing which is part of TI CGT compiler job and comes as part of  CCS installation.

    If you still think, doing some kind of compiler malfunction by code composer studio, may be, you could try uninstall and reinstall CCS and check whether the same issue repeats which would sort out compiler issue, if any.

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Dear Rumman,

    In my opinion, you might have not used linker command file for your projet or .cio section may not be declared and used which is used to print the lines in CCS console.

    processors.wiki.ti.com/.../Tips_for_using_printf
    processors.wiki.ti.com/.../How_Do_Breakpoints_Work
    processors.wiki.ti.com/.../CIO_System_Call_Protocol

    What is your board ?

    I've tested it on C6748 LCDK board and got all the prints which are used in hello.c

    File used:
    hello.c

    #include <stdio.h>

    /*
    * hello.c
    */
    int main(void) {
    printf("Hello World!\n");

    printf("Value1: ");
    printf("\nValue2: ");
    printf("\nValue3: " );
    printf("\nValue4: ");
    printf("\nsomething");

    return 0;
    }

    Linker command file used:
    linker.cmd

    -stack 0x1000
    -heap 0x1000

    // ============================================================================
    // Specify the System Memory Map
    // ============================================================================
    MEMORY
    {
    L1P: o = 0x11E00000 l = 0x00008000
    L1D: o = 0x11F00000 l = 0x00008000
    L2: o = 0x11800000 l = 0x00040000
    DDR2: o = 0xC0000000 l = 0x08000000
    }

    // ============================================================================
    // Specify the Sections Allocation into Memory
    // ============================================================================
    SECTIONS
    {
    .cinit > DDR2 // Initialization Tables
    .pinit > DDR2 // Constructor Tables
    .init_array > DDR2 //
    .binit > DDR2 // Boot Tables
    .const > DDR2 // Constant Data
    .switch > DDR2 // Jump Tables
    .text > DDR2 // Executable Code
    .text:_c_int00: align=1024 > DDR2 // Entrypoint

    GROUP (NEARDP_DATA) // group near data
    {
    .neardata
    .rodata
    .bss // note: removed fill = 0
    } > DDR2
    .far: fill = 0x0, load > DDR2 // Far Global & Static Variables
    .fardata > DDR2 // Far RW Data
    .stack > DDR2 // Software System Stack
    .sysmem > DDR2 // Dynamic Memory Allocation Area

    .cio > DDR2 // C I/O Buffer
    .vecs > DDR2 // Interrupt Vectors
    }
  • Thanks for the response. It turns out that I had to close and open the CCS. I dont know what went wrong but the problem got fixed.

  • Thanks for the response. It turns out that I had to close and open the CCS. I dont know what went wrong but the problem got fixed