Event Recorder  Version 1.0.0
MDK Debugger Views for Status and Event Information
 All Files Functions Macros Groups Pages
Format output

The elements event and item can contain the attributes property and value that can be used to format the output of the element in the Component Viewer window. Formatting is done using format specifiers that are available for the different data types.

Format Specifiers

A format specifier starts with a percent sign followed by a format selector followed by a bracket enclosed expression.

<item property="State" cond="TCB.State == Thread_CB:State:WaitingMailBox" value="%S[TCB.p_rlnk]" />

<value> will take a symbolic name, for example, Waiting, Running, ...

Output decimal number %d

Format Specifier Description
%d Decimal number

Example:

The following C code shows a component that is using a struct for the component information.

/// Component information
struct MyComp_info_t {
int version; ///< component version
int channels; ///< number of communication channels available
int buffersize; ///< size of the communication buffer
};
struct MyComp_info_t MyComp_info;
void MyComp_initialize (void) {
EvrMyCo_InitEntry(); // Record Event
MyComp_info.version = 3; // Set information
MyComp_info.channels = 1;
MyComp_info.buffersize = sizeof(MyComp_data.buf);
EvrMyCo_InitStatus(1); // Record Event
}

To print the MyComp_info in the Component Viewer as a decimal number, use the following code in the SCVD file:

<objects>
<object name="MyComponent">
<read name="MyComp_info" type="MyComp_info" symbol="MyComp_info"/>
<out name="MyComponent Overview">
<item property="Generic">
<item property="Version" value="%d[MyComp_info.version]"/>
<item property="Channels" value="%d[MyComp_info.channels]"/>
<item property="Max. Transmit Size" value="%d[MyComp_info.buffersize] Bytes"/>
</item>
</out>
</object>
</objects>

This results in the following output:

form_spec_decimal.png

Output literal characters %t

Format Specifier Description
%t Literal character

Example:

The following C code shows a component that is using a struct for the component information.

/// Component data
struct MyComp_data_t {
char buf[256]; ///< communication buffer
int is_free; ///< flag: 0=buffer occupied, 1=buffer free
};
struct MyComp_data_t MyComp_data;
void MyComp_initialize (void) {
EvrMyCo_InitEntry(); // Record Event
memset (&MyComp_data, sizeof(MyComp_data), 0); // Zero initialize
MyComp_data.is_free = 1;
EvrMyCo_InitStatus(1); // Record Event
}

To print the MyComp_msg and MyComp_data in the Component Viewer as a decimal number, use the following code in the SCVD file:

<objects>
<object name="MyComponent">
<read name="MyComp_data" type="MyComp_data" symbol="MyComp_data"/>
<read name="MyComp_msg" type="uint8_t" symbol="MyComp_data" size="48"/>
<out name="MyComponent Overview">
<item property="Current State">
<item property="Last Message" value="%t[MyComp_msg]"/>
<item property="Channel 1 State" value="%t[MyComp_data.is_free ? &quot;Free&quot; : &quot;Busy&quot;]"/>
</item>
</out>
</object>
</objects>

This results in the following output:

form_spec_text.png

Output hexadecimal number %x

Format Specifier Description
%x Hexadecimal number. Depending on the resulting expression type, one of the following format is used: 0x%04X or 0x%08X

Example:

Output symbolic enumerator value %E

Format Specifier Description
%E Resolve to a symbolic enumerator value

Example:

Output IPv4 address %I

Format Specifier Description
%I IPV4 address (example: 192.168.150.99)

Example:

Output IPv6 address %J

Format Specifier Description
%J IPV6 address (example: 2a00:ee0:d::13)

Example:

Output MAC address %M

Format Specifier Description
%M MAC address (example: 1E-30-6C-A2-45-5F)

Example:

Output symbolic name %S

Format Specifier Description
%S Resolve to a symbolic name, if it fails then use 0x%08X format

Example:

Output the result of an expression %T

Format Specifier Description
%T Use result type from expression (0x%02X / 0x%04X / 0x%08X / 0xI64X / %.3f / g)

Example:

Output USB descriptor %U

Format Specifier Description
%U USB descriptor

Example:

Output percent sign %%

Format Specifier Description
%% Output %

Example:

Example:

<object>
<out name="System and Threads"> <!-- Window title -->
<item property="System"> <!-- Creates a group item for the following items -->
<item property="SystemTimer" cond="__Symbol_exists (&quot;os_active_TCB&quot;)"> <!-- small group -->
<item property="Tick Timer" value="%T[((float) clockrate / 1000)] mSec" />
</item>
// The "SystemTimer" property is only created when the condition is true,
// that is when the user symbol "os_active_TCB" exists. Otherwise
// the property is not created and any nested statements are skipped.
<item property="Wait" cond="TCB.State == Thread_CB:State:WaitingMailBox" value="%S[TCB.p_rlnk]" />
// The property name will be 'Wait', if the condition yields true, then
// the property value will be the symbolic representation of the 'p_rlnk' member
// or a 0x%08X value if no matching symbol can be found.
<item property="State" cond="TCB.State == Thread_CB:State:WaitingMailBox" value="%E[TCB.State]" />
// The property name will be 'State', if the condition yields true, then
// the TCB.state value will be resolved to a enumerator name defined in the
// enumerator section of a <member> of a <typedef>.
// In general, enumerators are specified by using:
// <typedef-name> : <member-name> : <enumerator-name>
// within expressions.
<item property="%S [TCB.Entry] : %d[TCB.Task_ID]" value="" >
// %S [expression] will first evaluate the expression, then find a symbol representing
// the expression result. If a symbol matches, then the output will be
// something like 'Thread_B : 3' with the value property left empty.
<item property="Tick Timer" value="%T[((float) clockrate / 1000)] mSec" />
// The property name will be 'Tick Timer' and the value will be formatted based
// on the type of the expression which is type 'float' in this example.
// The property value output will be something similar to '5.00 mSec'
<read name="USB_Desc" type="uint8_t" symbol="usb_desc" size="128" const="1" />
...
<item property="USB_Desc" value="%U[USB_Desc]" />
// The property value will show a Keil-USB descriptor using the format -
// { length, type, "descriptor_name" }, e.g. { 10, 3, "Keil" }.
</item>
</out>
</object>