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.
struct MyComp_info_t {
int version;
int channels;
int buffersize;
};
struct MyComp_info_t MyComp_info;
void MyComp_initialize (void) {
EvrMyCo_InitEntry();
MyComp_info.version = 3;
MyComp_info.channels = 1;
MyComp_info.buffersize = sizeof(MyComp_data.buf);
EvrMyCo_InitStatus(1);
}
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:
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.
struct MyComp_data_t {
char buf[256];
int is_free;
};
struct MyComp_data_t MyComp_data;
void MyComp_initialize (void) {
EvrMyCo_InitEntry();
memset (&MyComp_data, sizeof(MyComp_data), 0);
MyComp_data.is_free = 1;
EvrMyCo_InitStatus(1);
}
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 ? "Free" : "Busy"]"/>
</item>
</out>
</object>
</objects>
This results in the following output:
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 ("os_active_TCB")"> <!-- small group -->
<item property="Tick Timer" value="%T[((float) clockrate / 1000)] mSec" />
</item>
<item property="Wait" cond="TCB.State == Thread_CB:State:WaitingMailBox" value="%S[TCB.p_rlnk]" />
<item property="State" cond="TCB.State == Thread_CB:State:WaitingMailBox" value="%E[TCB.State]" />
<item property="%S [TCB.Entry] : %d[TCB.Task_ID]" value="" >
<item property="Tick Timer" value="%T[((float) clockrate / 1000)] mSec" />
<read name="USB_Desc" type="uint8_t" symbol="usb_desc" size="128" const="1" />
...
<item property="USB_Desc" value="%U[USB_Desc]" />
</item>
</out>
</object>