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.

Redirecting CCS console printf to user defined function



hi,

I have my own print function which logs prints to memory.

I have implemented it using vsprintf and va_args

This function by itself works fine.

Now when I call printf (BIOS6) or System_printf (XDC), instead of the print going to CCS console I want my custom function to be called.

How can I do this ?

I use bios_6_31_00_18 and xdctools_3_20_05_76 on TI816x platform.

Thanks and regards
Kedar

 

 

  • Hi Kedar --

    Redirect of printf() can be done by writing a device driver to plug into the C RTS library.   See this doc for an example.

    http://focus.ti.com/general/docs/litabsmultiplefilelist.tsp?literatureNumber=spra861

    For System_printf(), you can use the SysMin module instead of the SysStd module.   SysMin will output characters to a circular buffer (buffer size is configurable),  See xdc.runtime.SysMin cdoc for more info (search SysMin in eclipse help to find SysMin doc quickly).   See this screenshot for the code to add the the .cfg (hello.cfg edit window) and also how to view the output in ROV.

    var System = xdc.useModule('xdc.runtime.System');
    var SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;

     

     

    SysMin also has a configuration parameter to specify how the characters will be output if System_flush() is called.  The default is to output these to stdout (CIO window in CCS).   See screenshot below.

     

     

  • hi Karl,

    Thanks for the info.
    The SysMin in XDC sounds straightforward to use for this purpose.

    I understand whatever we print via System_printf will goto SysMin
    Will the print during assert() API call from <assert.h> also goto SysMin ?
    What about prints during exception's, example when code crashes and it prints PC, Stack pointer value, will these prints also goto SysMin ?

    Thanks and regards
    Kedar