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: Log custom messages and read them in code direcly

Other Parts Discussed in Thread: EK-TM4C129EXL

Tool/software: Code Composer Studio

Hello,

I would like to use Log in my application to save error codes and custom diagnostic data then make these records available via HTTP server. What do you recommend? I have implemented everything for the HTTP GET / POST, but before I implement my own ring buffer I would like to ask is there any RTOS-based implementation that I can use for my purpose?

Thank you!

  • Hi Daniel,
    What device are you working with?

    Thanks
    ki
  • Hello,

    Thank you for your reply! I am using EK-TM4C129EXL. I don't want to see logs in the UIA only a variable arguments system printf-like function is needed over a kind of ring-buffer.
  • Thanks. I will move the thread to the device forum. The Tiva experts there can guide you best.

    ki

  • Hi Daniel,
    Have you tried System_printf or Log_info1 or you can display the data via the UART to PC's virtual COM port?
  • Hello Charles,

    Thank you for your reply. Yes, and they are working as I expected.

    But what I really need is to access those messages later from an internal buffer is there is any. Please see my original question. If TI RTOS has a kind of list-buffer that stores my System_printf, or Log_info1 content I may reuse it query them when a proper http get request arrives. for example: api/log.cgi  Does RTOS has some API to access them?

    Thank you.

  • Hi Daniel,
    I'm not aware of such capability but I will pass your question to your TI-RTOS experts.
  • For System data, In SysMin, you can provide a outputFxn callback. This allows you to get the characters in the internal buffer when a System_flush is called.

    For Logging,

    1. with ti/uia/loggers/LoggerMin, you can use LoggerMin_getContents to get the contents.
    2. with xdc/runtime/LoggerBuf, you can call LoggerBuf_getNextEntry. Note LoggerBuf is not supported by System Analyzer though.

    Todd
  • Thank you for your help! Todd, u have saved the day again! ;)
  • Always glad to help:)
  • One last question. I have found several examples how to set up LoggerBuf, but I haven't any that uses the LoggerBuf_writex. I am interested in the IArg argument.

  • Hi Daniel,

    You can add this (and remove LoggingSetup if you have it).

    BIOS.logsEnabled = true;

    var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');

    var Defaults = xdc.useModule('xdc.runtime.Defaults');

    var loggerBufParams = new LoggerBuf.Params();

    loggerBufParams.bufType = LoggerBuf.BufType_CIRCULAR; // most recent state

    loggerBufParams.numEntries = 2048;

    var logger0 = LoggerBuf.create(loggerBufParams);

    Defaults.common$.logger = logger0;

    Task.common$.diags_USER1 = xdc.module("xdc.runtime.Diags").ALWAYS_ON;

    Task.common$.diags_USER2 = xdc.module("xdc.runtime.Diags").ALWAYS_ON;

    //other modules as needed.

    This makes one logger instance that all modules use. You can look in the cdoc for a module to see what diags mask needs to be enabled. For example, here is the Task context switch 

    Note: LoggerBuf is not supported by LoggingSetup. When you use LoggerBuf, you have to manually do all the things that LoggingSetup was doing for you (e.g. creating logger instances, enabling module's diag mask, etc. 

    Note: you can use multiple logger instances and assign then specifically to certain modules. That's what LoggingSetup does (xdc.runtime.Main gets one, BIOS's Load module gets one and the rest of the BIOS modules get one). This is controlled by the <Module>.common$.logger field. If it is not explicitly set, it inherits from xdc.runtime.Defaults.

    Note: the runtime code does not change. It still uses Log_XYZ.

    Todd