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.

CCS/TM4C123GE6PM: Unable to output strings in the CIO console using Printf function, entering FaultISR infinite loop.

Part Number: TM4C123GE6PM

Tool/software: Code Composer Studio

Hi all,

I am an absolute beginner in the embedded system world. I encountered a seemingly simple issue which is the printf functions not triggering the CIO console window. I am using CCS v.9.3.0 on MacOS. I have tried running example projects such as hello and uart_echo but those did not succeed in printing out string outputs in the CIO console. Actually, the CIO console did not even show up.

I have followed troubleshooting guides such as configuring heap size, enabling CIO function, and go over instructions presented here http://software-dl.ti.com/ccs/esd/documents/sdto_cgt_tips_for_using_printf.html

On the Tips for using Printf page, I managed to print out a string "Hello, world" using puts("Hello World") in the CIO console. However, when using printf, the program seems to enter the infinite FaultIRS() loop every time. Also, I got stuck at C I/O Communication Buffer Placement and Special Breakpoints sections since I cannot fully understand where to make the suggested modifications. I guess it has to do with setting up breakpoints, but I do not know exactly where to proceed.

Another inconsistency that I came across is when I used puts function and printf function together. For example

puts("Hello, World");

printf("Hello, World");

In this case, the printf function did print out "Hello, world" string in the CIO console. but if I rearrange the order of the code above to be

printf("Hello, World");

puts("Hello, World");

It will not work.

Here is the screen capture of the linker file.

I would really appreciate it if anyone can help. I have been stuck with this issue for a couple days now.

Boris

  • Sitthichat Sukpholtham said:
    I have tried running example projects such as hello and uart_echo but those did not succeed in printing out string outputs in the CIO console. Actually, the CIO console did not even show up.

    The hello and uart_echo examples in TivaWare are written to print to the UART (using UARTprintf) and not the console view in CCS. For those examples, if you open a terminal (such as Teraterm or the Terminal view in CCS) connected to Virtual Serial Port, you should be able to view the output there.

    Adding printf to the code should print it out to the CCS console.

    I modified the blinky example by doing the following and was able to see the Hello World printed in the Console:

    - In blinky.c: added #include <stdio.h> and added printf(Hello World\n"); before the while loop
    - In linker options, set the heap size to 1024

    In most cases, increasing the heap and stack sizes fixes problems with printf not working. Try increasing your heap size to at least 1024 and see if that helps.

  • Hi,

    I opened the terminal and was able to see strings printed out. Thanks!

    However, when trying using printf to output a string, It still does not work. The code I used is as simple as

    #include <stdio.h>
    
    int main(void){
        printf("Hello, World");
    }

    I increased the heap size to 1024, but the CIO console still did not show up. When run, the software just printed out nothing but kept running. So, I paused the debugger. Then, I found out that it goes into the FaultIRS loop every time I pause the debugger. The loop is in startup_ccs.c file. 

    // This is the code that gets called when the processor receives a fault
    // interrupt.  This simply enters an infinite loop, preserving the system state
    // for examination by a debugger.
    //
    //*****************************************************************************
    static void
    FaultISR(void)
    {
        //
        // Enter an infinite loop.
        //
        while(1)
        {
        }
    }

    Again, with my minimal knowledge, I think it has to do with setting breakpoints?

    Thanks again in advance for your kind help

  • Are you working with the TivaC Launchpad? 

    I am attaching a zip of the project that I ran on a TivaC Launchpad and confirmed that the Hello World is printed to the CCS console. 

    Unzip the attached zip file, import the project into CCS and try running the executable as-is. You can do this by manually launching the debugger, connecting to target and loading the program (details on manual debugger launch can be found here). 

    Once you verify this works, you can try rebuilding the project on your system and then running it.

    Hope this helps in getting things working on your end.

    8738.blinky.zip