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.

Custom Diagnostics Mask and Logging

    Hi all,

    I would like to use logging facility of SYS/BIOS.  Instead of just using a single diagnostics bit (like Diags_USER1) to enable the event, I want to be sure that more than one mask is enabled. For example; I want to print a message when BOTH  Diags_ENTRY  and Diags_USER1 [1] enabled in the configuration [2]. However, logger prints the message when EITHER Diags_ENTRY or Diags_USER1 enabled, which is not what I want to do.

   I followed the guidelines to create a custom log event in the example [3]. Is it possible to define more than one message [4] for each Log_Event, like different number/type of arguments or even message texts. Ex:  msg: "Thread %d" and msg: "User %s with ID %d" ?

   Moreover, I wonder if it is possible to define new Diags_XX like Diags_USER1 in order to extend the these mask bits. At least an easy way without modifying the source code of XDCTools and etc.

   Thanks in advance

 

[1]

Log_print0(Diags_ENTRY | Diags_USER1, "Message");

[2]

Main.common$.diags_ENTRY = Diags.ALWAYS_ON;
Main.common$.diags_USER1 = Diags.ALWAYS_ON;

[3]

http://rtsc.eclipse.org/docs-tip/Using_xdc.runtime_Logging/Example_6

[4]

module Events {
    config Log.Event HELLO = {
        mask: Diags.ENTRY,
        msg: "%d: Hello world!"
    };
}
  • Hi,

    Which version of XDC are you using?

    Todd

  • Hi,

    I am using XDCtools 3.22.01 with CCS 5.0.3.

     

  • Deniz, here are some answers:
    [1] There is no syntax for you to specify that the message should be printed only if both bits are enabled. When you specify a mask for your event, that mask is an operand in the bitwise end operation, where another operand is the module's mask. That operation returns 'true' even if only one bit of your mask matches a bit in the module's mask. If you don't mind some additional code, there is a function Diags_query, which you can call with one bit as an argument and invoke Log_print() with another bit as the event condition:

    if (Diags_query(Diags_ENTRY)) {
       Log_print0(Diags_USER1, "Message");
    }

    [4] You can't do that either without changes in XDCtools. But, why would you want to? Why is one event with two messages better than two different events?

    The dIagnostics mask is 16-bit long. If you wanted to change that, you would have to change source code in the package xdc.runtime. While it's doable, it would be a very advanced XDCtools project. Can you tell us what are you trying to achieve? There could be an easier way to do it, with the available user-defined six bits (USER1 - USER6).