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.

Using printfs in a F2808 project

I am having a lot of trouble getting printfs to work in a F2808 project. I've followed the tips here but my application executing out of flash seems to hang on the first printf.  I know I am missing something but am now too frustrated to continue!

I would really appreciate if someone could post a flash-based linker command file and sample program that works successfully.

Thank you.

Siraj.

  • I made some basic modifications to the Flash based example project for F2808 to verify that printfs work. The most common reason for printf issues is insufficient heap space.

    I started with the Example_2808_Flash example project for CCS v4 that comes with C280x, C2801x C/C++ Header Files and Peripheral Examples: http://focus.ti.com/docs/toolsw/folders/print/sprc191.html, and made the following changes:

    - Added a printf statement as the first statement within main.
    - Added #include <stdio.h>
    - In Project Build Options->C2000 Linker->Basic Options, set stack size to 0x400 and heap size to 0x800 (this may need to be adjusted/increased depending on the printf requirements for your program)
    - In F2808.cmd, made sure to allocate .sysmem and .esysmem to RAMH0 (PAGE =1)

        .esysmem : > RAMH0 PAGE = 1
        .sysmem   :> RAMH0 PAGE = 1


    - It is best to also add a allocation for .cio section but in this case the default allocation done by the linker works as well. Be sure to check your linker map file after building the project to verify that these sections are being allocated properly to RAM regions.

  • Thanks for the help.

    Following your example, I finally managed to get printfs working but there is an anomaly.  My application performs interrupt driven serial I/O on both UARTs. A  printf while serial output is in progress corrupts the serial data! Can you explain why this occurs?

    The debugger console is very convenient but this issue prevents me from using printfs to the console. An inconvenient alternative is to use one of the UARTs as my console port and use vsprintf to format data.

    Thanks.

    Siraj.