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.

[FAQ] TI-RTOS-PROC: How do I use custom output functions with SysMin?

Part Number: TI-RTOS-PROC

I have a project that outputs through System_printf() with SysMin, how do I use my own application specific output function?

  • The SysMin module allows users to add their own application specific output function. For example, this can be used to redirect the output to a UART or other peripheral. SysMin buffers data in a circular buffer. When you call System_flush() this data gets pushed to the output function. By default, this output function calls fwrite() (it is actually an internal function used by fwrite in the TI-compiler case) to output the characters to the CIO window in CCS.

    Add this to your .cfg file:

    SysMin = xdc.useModule('xdc.runtime.SysMin');
    System.SupportProxy = SysMin;
    SysMin.outputFxn = "&myOutputFunc";

    And this output function to your .c file. You can replace the call to fwrite() below with a call to the IO operation of your choice.

    #include <stdio.h> // for fwrite()
    
    #include <xdc/std.h>
    #include <xdc/runtime/System.h>
     
    Void myOutputFunc(Char *buf, UInt size)
    {
        fwrite(buf, sizeof(Char), size, stdout);
    }

    The circular buffer is output via the System_flush() API. You can call System_flush() after you call to System_printf() or you can call it in a background thread at lower priority. Note that your output function is called with interrupt disabled so you should be careful with the amount of time that your output function takes.