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.

system_printf() loses messages

Other Parts Discussed in Thread: SYSBIOS

Hi

I use system_printf() to print debug info to the console.  When my program terminates, the system_printf ouput appears but some lines are missing.  I have used ROV with a breakpoint to prove that the 'missing' system_printf statements are actually output.

Why would the system_printf output buffer lose lines?

David

  • David,

    From your description, it sounds like you are using the SysMin module to handle output from System_printf(). This module buffers output in a buffer that "wraps" when it is full. Since SysMin does not send the buffered output to the CCS console until your program terminates, you will need to increase the SysMin buffer size in your configuration .cfg file (SysMin.bufSize documented here: http://rtsc.eclipse.org/cdoc-tip/xdc/runtime/SysMin.html) to hold your program's output. You see the lines in ROV when you hit a breakpoint because the buffer has not wrapped yet.

    Mark

     

  • Mark,

    Thanks, increasing the buffer fixed the problem.  I am new to SYS/BIOS, having used DSP/BIOS in the past.  Why is System_printf() preferred to the old logprintf() ?

    I think that logprintf() had the advantage that it output messages as the program ran, not wating until the program terminates.

    David

  • David,

    We have both kinds of "output". DSP/BIOS has SYS_printf() and LOG_printf, while SYS/BIOS has System_printf() and Log_printf(). In this case of System_printf(), you can choose different output methods depending on your needs/situation. For example, you could switch to SysStd module instead of SysMin. SysStd forces the output across JTAG at runtime so you see the messages as they occur on the target and no buffering is required. However, this mechanism basically stops the processor for the time it takes to send the data across JTAG to CCS/Eclipse - not exactly friendly for real-time - but nice for non-real-time debugging. Other "System provider" modules could be written that output data via a UART or TCP/IP or whatever transport fits your system.

    Mark

  • If you modify your configuration to use the SysStd System provider, the System_printf()s are printed as they occur rather than waiting until the program terminates.

        var System = xdc.useModule('xdc.runtime.System');
        var SysStd = xdc.useModule('ti.sysbios.smp.SysStd')
        System.SupportProxy = SysStd;

    However, the default configuration will result in an assert being raised if System_printf() is invoked from within a Hwi or Swi thread.

    You can overcome this behavior by configuring a different type of 'C Standard Library Lock' from the 'SYS/BIOS Basic Runtime Options' XGCONF GUI page.

    Selecting the 'NoLocking' option will allow System_printf() (as well as ALL other rts library functions) to be called at anytime, but provides no thread safety:

        BIOS.rtsGateType = BIOS.NoLocking;

    Selecting the 'GateHwi' option will also allow System_printf() (as well as ALL other rts library functions) to be called at anytime, and provides maximum thread safety but also globally disables interrupts at key points, which can result in interrupt-latency issues:

        BIOS.rtsGateType = BIOS.GateHwi;

    Selecting the 'GateSwi' option will allow System_printf() (as well as ALL other rts library functions) to be called from within Main, Task, and Swi threads without disabling interrupts:

        BIOS.rtsGateType = BIOS.GateSwi;

    Alan

  • Hi Mark and Alan

    Thanks very much for your answers.

    David