0% found this document useful (0 votes)
18 views24 pages

AP32401 MTV Introduction 180207

The document describes an introduction to the MTV tool for analyzing multi-core debug traces. It covers installing and starting MTV, describes the basic trace table interface, and provides an example of tracing data inside an interrupt handler by configuring trace buffers, observation points, and triggers.

Uploaded by

menel2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views24 pages

AP32401 MTV Introduction 180207

The document describes an introduction to the MTV tool for analyzing multi-core debug traces. It covers installing and starting MTV, describes the basic trace table interface, and provides an example of tracing data inside an interrupt handler by configuring trace buffers, observation points, and triggers.

Uploaded by

menel2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

AP32401

An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer

About this document


Scope and purpose
This Application Note describes the basic usage of the MCDS (Multi-Core Debug Solution) Trace Viewer (MTV)
tool.
Non-intrusive, parallel trace with MCDS is a very powerful tool to analyze and debug a hard real-time system in
full operation.

Note: MTV can only be used with Emulation Devices (ED) and production devices with miniMCDS.

Intended audience
This Application Note is intended to introduce MTV to first-time users.

Disclaimer

Note: MTV is a free tool without support, and does not cover the complete MCDS functionality. For a tool
with full MCDS support please contact Infineon tool partners.

Table of contents
About this document ......................................................................................................................... 1
Table of contents .............................................................................................................................. 1
1 Getting started......................................................................................................................... 3
1.1 Installation............................................................................................................................................... 3
1.2 First start-up ............................................................................................................................................ 3
1.3 The trace table......................................................................................................................................... 4
2 First trace ................................................................................................................................ 5
2.1 Connect the Device ................................................................................................................................. 5
2.2 Load the Executable and Linking Format file ......................................................................................... 6
2.3 ‘Reset Device First’ option ...................................................................................................................... 6
2.4 Starting the trace..................................................................................................................................... 7
3 Example: Data Tracing inside an Interrupt.................................................................................. 8
3.1 Trace setup .............................................................................................................................................. 8
3.1.1 Trace buffer settings .......................................................................................................................... 8
3.1.2 Observation point setting ................................................................................................................ 11
3.1.2.1 Program trace ............................................................................................................................. 12
3.1.2.2 Program Trigger .......................................................................................................................... 13
3.1.2.3 Data Trace ................................................................................................................................... 14
3.2 Tracing the ISR....................................................................................................................................... 15
4 Common errors and further hints .............................................................................................18
4.1 No data traced or wrong data traced ................................................................................................... 18

Application Note Please read the Important Notice and Warnings at the end of this document V1.0
www.infineon.com page 1 of 24 2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Table of contents

4.1.1 Halted CPU ....................................................................................................................................... 18


4.1.2 Volatile programming ...................................................................................................................... 18
4.1.3 Wrong trigger .................................................................................................................................... 18
4.2 Zero ticks ............................................................................................................................................... 18
4.3 Negative stack level............................................................................................................................... 19
4.4 Unable to connect the device ............................................................................................................... 19
4.5 Tooltips .................................................................................................................................................. 20
4.6 File handling .......................................................................................................................................... 20
4.7 Address qualification – Function not found ......................................................................................... 21
5 Acronyms ...............................................................................................................................22
Revision history ...............................................................................................................................23

Application Note 2 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Getting started

1 Getting started
1.1 Installation
MTV is part of the DAS installation. DAS can be downloaded at http://www.infineon.com/DAS.
Once DAS is installed, MTV can be found in the start menu or inside the DAS installation directory. For example
‘C:/Program Files/DAS/clients/mcds_trace_viewer.exe’.

1.2 First start-up


At MTV start-up the main GUI appears, providing some controls and the trace table. The trace table is of course
empty at first start-up, and no content is displayed (Figure 1 item (5)).
If a device is connected to the PC (such as a USB cable to a TriBoard or with a DAP miniWiggler), a standard
trace can be immediately generated by just pressing the record button (4).

Figure 1 Main MTV GUI

The important controls to first take note of are the following:


1. File
− The file menu is used to select the appropriate Executable-and-Linking-Format (ELF) file for the target
HW/SW-System. It is also possible to save the current MCDS configuration or load a previously saved
configuration. The trace data can also be saved (see Chapter 4.6).
2. Device
− Under the device menu, MTV can be connected to a specific device. Please make sure that the device is
powered, running and connected with the PC.
3. MCDS
− The MCDS menu is used to set up the complete MCDS on the target system. For example, observation
points, triggers, a trace buffer, and so on.
4. Record
− The record button is used to start and stop the tracing of the target system.
5. Trace table
− The trace table displays the trace data. The information is converted to a human readable format and
arranged in different columns which will be explained in the following section.

Application Note 3 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Getting started

1.3 The trace table

Note: Other controls not listed in this table are described in the next chapter where a first data trace is
set up and performed.

Table 1 Description of the trace table columns


Column header Description
TimeA The timestamp of the trace in nano seconds.
Be aware that the column default width may be too small and hides the first digits
(seconds).
TimeR TimeR displays the accumulation of the Ticks at a given time step.
Ticks The MCDS clock Ticks between trace messages.
Please note that one Tick is equal to two CPU cycles.
Opoint Displays the Observation Point of the trace data. The observation point is the physical
data acquisition point inside the SoC. For example the CPU0, CPU1, SRI bus, and so on.
Origin The origin of the activity. In most cases this is the same as Opoint.
For data trace at busses the Origin column displays the original master.
Data The Data column displays the data written or read.
Operation The operation being executed but not on the level of assembler mnemonics for program
trace. It displays a more abstract type of the operation.
For example; IP CALL, IP RET for program trace or R32, W32, R16, and so on, for data
trace.
Address The address column displays the pointer of the instruction (IP) which is being executed.
If the Operation column displays an R/W Operation, the address column displays the
address where data is read or written to.
Symbol / Label The Symbol and Label column refers to the symbols and labels provided by the ELF file.
Here you can see for instance which function an instruction belongs to.
Note that the function here refers directly to the C-Function. In case that there is no
symbol defined for a certain address range in the ELF file, the name of the HW resource is
displayed (such as memory or peripheral name).
SO Symbol Offset (SO) refers to the executed instruction or a data address.
Code or data symbols in an ELF file have a start address and a range. SO is the difference
to the start address. If there is no symbol defined in the ELF file the offset is displayed for
the associated HW resource.
Comment The Comment column mainly displays the mnemonic of the assembler instruction which
is being executed in this time step.
SL Stack Level (SL) indicates the current position on the stack.
The stack is used to save and restore the context when a function is called or returned.
Please note that the stack level is assumed as 0 at the beginning of the tracing.
Trace This column provides some additional information concerning the tracing. For example,
CFT for (Compact) Function Trace.
CFT JLF / TMF This column contains special information for compact function trace. This is out of the
scope for this basic application note.

Application Note 4 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
First trace

2 First trace
In order to perform the first trace, some settings are required. These basic settings will be described in this
section.

2.1 Connect the Device


As the first step, make sure your device is connected properly via a USB-Cable for a TriBoard, or otherwise via a
DAP miniWiggler.
After connecting the Device to the PC, open the ‘Device’ menu at the top and select ‘Connect Device…’ or press
[ALT]+[D]. A window with all the devices which are connected to the PC is shown (Figure 2).

Figure 2 Device selection window

Identify the correct Device and click the ‘Select’ button to connect to the device. If only one device is connected
to the computer it can be automatically connected by just clicking the record button.

Application Note 5 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
First trace

2.2 Load the Executable and Linking Format file


To get the full information of the trace data, an ELF file is needed. To load this, simply open the ‘File’ menu and
select ‘Open .elf File…’ or press [ALT]+[E]. A file browsing dialog is opened. In this dialog search for the ELF file
which runs on the device and open it (Figure 3).

Figure 3 ELF file browsing dialog

2.3 ‘Reset Device First’ option


This step is not mandatory but offers a reproducible trace behavior while observing the first trace. With this
option, any time a device is being traced, in any state, a reset of the device is performed first and then the
tracing is started. This allows us to see the initialization sequence of the device, which is normally being
executed before the main function after the device start.
To select this option, simply open the ‘Device’ menu and click the radio button control named ‘Reset Device
First’ (Figure 4).

Figure 4 ‘Reset Device First’ option turned on with the appropriate radio button

Application Note 6 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
First trace

2.4 Starting the trace


After all the settings are made, we can start our first trace by simply clicking the button at the top:

This button can have one of three different colors, all indicating the current status of the trace:
 Black
− No tracing is currently running.
− If the button is now pressed, the tracing will be started on the target device.
 Red
− The MTV / device is currently recording.
− If the button is now pressed again, the recording is stopped and the collected trace data will be
displayed.
 Yellow
− If a trigger condition is set for tracing, yellow indicates that the trigger condition was already met, but the
trace is still running until the circular trace buffer is ‘full’. Chapter 3 will cover triggers and go more into
detail on this.
After the trace has finished the trace data is displayed (Figure 5).

Figure 5 The result of the first trace

Here we can observe the start-up function of the target device.


At the Symbol/Label ‘_Core0_start’ (red dotted area) the first call inside the program creates the first CFT
message. This standard configuration trace is on Function level and without data.
The MTV has much more to offer than this basic trace. Therefore the next chapter will cover a more detailed
trace setting for a specific purpose.

Application Note 7 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

3 Example: Data Tracing inside an Interrupt


To demonstrate a more detailed trace setup, the following code snippet is used.

Code Listing 1

// timer initialization missing here


IFX_INTERRUPT(Stm1_Isr, 0, 9) {
uint32 stmTicks = (uint32)(2 * IfxStm_getFrequency(&MODULE_STM1));
IfxStm_increaseCompare(&MODULE_STM1, IfxStm_Comparator_0, stmTicks);
while (__cmpAndSwap(&lock, 1, 0)); // ................. Acquire Lock
for (int pp = 10; pp <= 13; pp++) {
IfxPort_togglePin(&MODULE_P33, pp);
}
lock = 0; // .......................................... Release Lock
}

The code snippet implements an Interrupt Service Routine (ISR) for the STM1 of the device.
Inside the interrupt, firstly the compare value is increased by a calculated value. With this compare value the
timer fires an interrupt every 100 milliseconds.
At each interrupt, 4 LEDs on the TriBoard are toggled inside the for-loop. Due to another interrupt manipulating
the same LEDs, a simple spinlock is implemented in line 4 and 8.
The chosen example goal is to trace the Spinlock-Mechanism inside the interrupt, to see if everything works as
expected. This will be used for introducing MTV in more detail.

3.1 Trace setup

3.1.1 Trace buffer settings


First we have to precisely set-up MTV in order to get the desired trace data. The first steps for the set-up can be
adapted from the previous chapter covering the device connection, ELF file loading, and device reset options.
Next, we want to increase the trace buffer size and set it to a circular buffer, which is stopped by a trigger. The
settings are opened by clicking the ‘MCDS’ menu and clicking ‘General’ or pressing [ALT]+[G]. The window that
appears is shown in Figure 6.
At the top of this window we can set up the trace memory. We want to use one MB of memory, instead of the
default size of 16 kB, which is displayed as ‘16 at 0 XTM’. The ‘at 0 XTM’ refers to the memory which is used to
store the trace data and at which position (0 means start) the trace data section starts. The definition of the
start address is important for TCM (Trace/Common Memory) which can be shared between tracing and
application.
To get 1 MB of trace memory just replace the complete line with ‘1024’ and press [Enter]. MTV now asks if we
want to switch to the ‘TCM’ memory, because the ‘XTM’ memory has only a size of 16 kB. Click ‘Yes’.

Application Note 8 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

Figure 6 Trace buffer settings (Default)

Now we need to set-up the ‘On-Chip Trace Buffer Mode’. As default, the trace buffer is filled with trace data until
it is full and the tracing is stopped automatically (Record until full). We don’t know at which time the interrupt
will occur, and therefore we can’t be sure to get the desired trace data. It could happen that the timer interrupt
of our example is fired after the buffer is full. To address this case we select ‘Circular stopped by trigger’ (see
Figure 7).

Figure 7 Trace buffer settings (Trigger)

Now the buffer is filled as a circular buffer (if it is full, the oldest trace data will be overwritten).
It is important now to set a trigger in order to stop the tracing. The trigger is set in another menu and will be
covered later.
There are now two settings in this window, the ‘Trigger Trace Position’ and the ‘Ticks/Timestamps’.
The Trigger Position indicates how much data will be traced after the trigger condition has been met. For
example, if ‘40 Bytes before End’ is selected here, the MCDS will trace 40 additional bytes of trace data after the
trigger condition has been met and the tracing stops. This default setting maximizes the trace data before the
trigger condition. In many cases the trigger is on the symptom and the interesting cause is before the trigger.
The small overhang of 40 bytes ensures that relevant data around the trigger point is in the trace buffer before
the trace is stopped.
A more balanced pre and post-trigger setting is the ‘60%’ option. With this setting 40% of the buffer will be filled
with trace data following after the first trigger hit.

Application Note 9 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

The last setting is the setting for the ticks and timestamps of the MCDS. This document will only cover the first
three options:
 Ticks Disabled
− If this setting is used, the MCDS does not give any time or tick information. On the one hand, the trace
data needs less memory but on the other there is no information on timing behavior. There is no
indicator for the elapsed time. The first three columns of the trace data will remain empty.
This option is useful to trace a longer time if no timing information is needed.
 Ticks On
− With this default setting the MCDS shares information about the time behavior of the tracing. If some
timing behaviors have to be observed, this is the right setting.
 Ticks and Timestamps
− This setting is the same as the ‘Ticks On’ setting but with the difference that the MCDS gives an exact
timestamp of the device up-time every 4 kB of trace data. The user can now see that the device is already
running for some time and the trace data is aligned to this time.
Because we don’t want to trace a huge time window, we can leave the setting at the default value ‘Ticks On’. If
everything is set up correct, the general settings for the trace buffer should be the same as those in Figure 7.

Application Note 10 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

3.1.2 Observation point setting


After the trace buffer has been set up correctly, we have to set up the observation point. Here we can set the
trigger condition, the data to be traced, and the memory sections to be observed.
The window can be opened at the ‘MCDS’ menu by clicking on ‘Opoint CPUa’ or pressing [CTRL]+[P].
Right after the window has appeared, click the ‘Trigger Menu’ button at the upper right corner to open the
trigger settings for this observation point. The window presented should appear as follows:

Figure 8 Opoint CPU0 (Default)

In this window are 4 sections:


1. Program Trace / Status Trace
2. Program Trigger
3. Data Trace
4. Data Trigger
To achieve our goal, we need to set up (1), (2) and (3) properly. The ‘Data Trigger’ section will not be covered in
this application note.
Beside these 4 sections, the correct CPU should be selected with the ‘Opoint’ drop down selection. In our case
this will be CPU0.

Application Note 11 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

3.1.2.1 Program trace


The first section defines how detailed and at which memory sections the tracing should be performed.

Level of trace detail


For the level of detail there are three settings:
 Function
− This is the default setting and traces only the calls and returns of functions so that a basic program flow
behavior can be observed. This setting generates the minimum trace data.
 Flow
− This setting keeps track of all instructions being executed. A trace message is generated at points where
the program execution is not sequential. With this setting we can see what is going on inside the traced
functions.
 Instruction
− The Instruction setting will generate as much as possible trace messages for the program execution. This
adds more details for the execution time of instructions. Note that this option needs much more trace
memory than the Flow setting.
We will use the Instruction setting to achieve our goal.

Address qualification
The next important setting is the address qualification. With the address qualification you can specify in which
regions of the program memory the device should be traced. There are three options available:
 No Address Qualification
− With this option the complete program execution is traced.
 In Range Qualification:
− If the In Range Qualification is used, the device is only traced if the Instruction Pointer (IP) points to an
address inside of the configured ranges.
 Out Of Range Qualification
− This is the same option as the In Range Qualification but in reverse. Here the device will only be traced if
the IP is pointing to an address outside of the configured ranges.
To set the range of the address qualification the two text areas below the address qualification setting can be
used.
In these text areas only the first line is used to define the address range. The range can be defined by using two
hexadecimal addresses.
For instance, if one writes ‘0x8000F000 0x8000F010’ in the first line of one of the text areas, the address range
for the qualification is set to ‘0x8000F000’ to ‘0x8000F010’. In the case that an ELF file is loaded, there is an
easier way to set the address qualification. Just type the function name to be traced, and de-focus the text
area. MTV will then automatically replace the function name with the correct address range. The function name
will also be moved to the second line of the text area, showing which function is traced with the address range.
For our goal, we simply write ‘Stm1_Isr’ in the first text area and click on another control (defocus the text
area). The MTV will then automatically set the right address range for us, as seen in Figure 9.

Application Note 12 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

Figure 9 Opoint CPU0 (Timer interrupt trace)

3.1.2.2 Program Trigger


We will use the Program trigger to stop the tracing at a certain point. To set up the trigger, select ‘Trigger Trace
Record’ on the top of the Program Trigger section, where ‘Disabled’ is the default. MTV will display a message
regarding the trace buffer mode, if it is still set to ‘Record until full’ (section 3.1.1). In this case MTV
automatically changes the buffer settings for the use of a trigger. Simply close this message.
The second drop down menu can be ignored, because STDSW (STandarD SoftWare) Tasks will not be covered in
this application note.
The third drop down menu is again the range qualification. This time the qualification is used to trigger the
device to stop tracing. If the IP points to this range, the trigger will be fired. For our goal we use the range of the
timer ISR again here. Simply write ‘Stm1_Isr’ and defocus the text area, as done for the Program Trace section.
The result should look like Figure 10.

Application Note 13 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

Figure 10 Opoint CPU0 (Program Trigger)

3.1.2.3 Data Trace


The last section we have to modify is the Data Trace section, because we want to see which data is read and
written. For this purpose select ‘All’ on the drop down menu at the top of the Data Trace section. The other
options are self-explanatory. Use these to see only reads or writes. ‘A’ refers to ‘address’ and ‘D’ to ‘data’. For
instance, ‘A+D Write’ will display address and data of all write operations.
There is also a range qualification possible, to see only reads or writes in specific sections. We will not use this
for now, because we already set the program trace to the ISR so that we only see reads and writes in this ISR.
But we will later use this address qualification to hide some read and write operations inside the traced ISR
function that we do not want to observe.

Note: In AURIX TC2xx only the read address and not the data is available for trace and triggering. In
AURIX TC3xx (after TC39x A-step) also the read data is available.

Application Note 14 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

3.2 Tracing the ISR


Now that we have set everything up, we are able to start the tracing of the timer interrupt by clicking the record
button:

After the tracing has finished, the trace data view will be displayed. For example:

Figure 11 First ISR tracing

The trigger that stopped the tracing is highlighted in grey by MTV.


We can now observe that there are many read and write operations that don’t belong to our goal and that are
making the whole trace data less readable. In this case these read and write operations are from the Context-
Save-Array ‘__CSA0’ and from the stack ‘__USTACK0’. To exclude these two we now use the ‘Out Of Range
Qualification’ of the Data Trace section.
Put ‘__CSA0’ in the first text area and ‘__USTACK0’ in the second and change the qualification to ‘Out Of Range
Qualification’. The trace settings should now look like Figure 12.

Application Note 15 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

Figure 12 Opoint CPU0 (Final)

Now after rerunning the tracing we should be able to get the trace data without the read and write operations
of the context saving and stack operations, and get a clearer view of the instructions belonging to our code
(Figure 13).

Application Note 16 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Example: Data Tracing inside an Interrupt

Figure 13 ISR-Trace without Context Save and Stack operations

The trigger that stopped the tracing is again marked in grey (at the top) by MTV. The area marked with the red
dotted border in the figure above displays the instructions representing the spinlock mechanism. We can
observe that firstly a Compare-And-Swap instruction is executed, which in this case at first attempt acquires
the lock variable.
Right after the Compare-And-Swap instruction a Jump-Not-Equal instruction follows, which would jump back
before the Compare-And-Swap instruction to repeat it, as long as the lock variable is acquired by somebody
else.
While acquiring the lock variable it is set to 1, which can be seen at the W32 command right after the JNE
instruction in line 27. After the critical code section has been executed, the lock variable is set to 0 to release the
spinlock mechanism for the other timer interrupt. The release of the lock variable can be seen at the W32
instruction in line 37.

Note: There can be a certain delay between the data trace messages (here W32) and the associated
instructions (here CMPSWAP and ST.W). This is due to the different stages at the CPU pipeline
where this information is retrieved.

Application Note 17 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Common errors and further hints

4 Common errors and further hints


This section discusses common errors and gives further hints for the correct usage of the MTV.

4.1 No data traced or wrong data traced

4.1.1 Halted CPU


A common error while using MTV is, that the CPU is halted for instance by another debugging tool. In this case
the record button stays red and no trace data is generated since even the tick message generation only starts
after the first regular trace message.

4.1.2 Volatile programming


While writing and testing software on the SoC, volatile RAM is often used to save limited write cycles of the flash
memory. If MTV is used to collect trace data with the option ‘Reset Device First’, make sure that the software
was written to the permanent flash instead of RAM. Otherwise a reset will result in tracing the execution of the
old software which is stored in the permanent flash.

4.1.3 Wrong trigger


If a circular buffer is used for tracing, meaning that the trace is in an infinite loop until the first trigger condition
is met, MTV can be stuck in an infinite tracing loop. This happens if the trigger is wrong and doesn’t hit. In that
case the tracing will never stop. Another problem might be that there was no trigger set at all.

4.2 Zero ticks


For certain traces the column displaying the ‘Ticks’ of the CPU reads zero. At first this might be confusing and
looks like an error inside the CPU or the MTV but this is not the case.
There are two main reasons why this can happen.
 There may be two different trace units (Program Trace Unit PTU and Data Trace Unit DTU) or even at
different observation points (Core1 and Core2 for example) which are operating independently. Therefore it
will happen that two trace messages are generated at the same time. The second trace message is then
displayed with zero Ticks.
 A second reason belongs to the reduced clock frequency of the MCDS. As mentioned, one Tick is equal to
two CPU cycles, therefore the clock of the MCDS runs with half the frequency of the CPU. Due to this clock
difference, it might happen that there are more trace messages observed at a time. If this happens there are
for instance two trace messages which in reality have different time stamps, but the same timestamp while
being observed by the MCDS. The second trace message then has zero Ticks.

Application Note 18 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Common errors and further hints

4.3 Negative stack level


The Stack Level indicates the current position on the stack for the function context.
Normally the main function is on Stack Level 0. If now a function is called, the context is stored on the stack and
the Stack Level is incremented to 1. After executing the function, a return operation is called which restores the
context of the main function from the stack. This results in a decreasing Stack Level.
Take for instance the following source code:
void func_2() {
calc_something();
}
void func_1() {
func_2();
}
int main(void) {
func_1();
return 0;
}
This generates the Stack Level history in the following table:

Table 2 Stack level history


main func_1 called func_2 called func_2 return func_1 return
SL = 0 SL = 1 SL = 2 SL = 1 SL = 0

If the data tracing is now started without a reset of the device, the Stack Level may be on some higher value
because a function f2 is in execution. In fact the Stack Level observed by the MCDS always starts with 0. If then f2
returns and the context of the function f1, which has called f2, is restored, the Stack Level decreases to -1.

4.4 Unable to connect the device


There may be several reasons why MTV cannot connect to the device:
 The device is not plugged in on the PC or the USB cable is damaged.
 The device is not powered or the power supply is damaged.
 Another debugging tools hardware is connected to the device.
 The required DAS USB drivers are not installed correctly.

Note: Please read the DAS Release notes that are included in the DAS installation.

Application Note 19 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Common errors and further hints

4.5 Tooltips
Most, but not all of the controls in MTV (buttons, text areas, drop down menus, and so on) provide usage-hints
as tooltips. These tooltips are displayed, after a brief pause, when you hover the cursor over a control. An
example is shown in Figure 14.

Figure 14 Tooltips inside the MTV

4.6 File handling


Besides loading an ELF file, it is possible to save the current MCDS configuration and load it again later. The
trace data can also be saved, which can then be processed by other tools, such as Excel or Matlab for example.
If you intend to post-process the data with Microsoft Excel, MTV already provides an appropriate handler for the
copy and paste of trace data. To copy the data open the ‘Edit’ menu and click ‘Select All’, after everything is
selected (the trace data will be highlighted in grey), again open the ‘Edit’ menu and click ‘Copy’. The same
result can be achieved by pressing [Ctrl]+[A] followed by [Ctrl]+[C]. It is also possible to select specific trace
lines or ranges with the mouse by using the normal Windows conventions.
After the trace data has been copied to the clipboard, you can paste it directly into an Excel table. The trace
data is then automatically parsed into several rows and columns within the Excel sheet.

Application Note 20 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Common errors and further hints

4.7 Address qualification – Function not found


It is possible to type the function name into the text area for the address qualification. Under some
circumstances this will fail. The entered name will then disappear and no address range is inserted by MTV. This
happens if the function is existent in the C-Code of the application, but has been removed due to optimizations
performed by the compiler.
Take the following code for instance:
void func() {
calc_something();
}
int main(void) {
func();
}
can be optimized to:
int main(void) {
calc_something();
}
In this case it is not possible to enter ‘func’ as a range qualifier, only ‘main’ or ‘calc_something’ (except
‘calc_something’ has been removed to further optimizations).
To prevent the compiler of removing some specific function, the ‘volatile’ keyword can be used:
volatile void func() {
calc_something();
}
int main(void) {
func();
return 0;
}
With this keyword the return type ‘void’ of the function is marked as ‘volatile’ and the compiler is not allowed to
remove the function ‘func’, because of the volatile return type.
With this trick the function can be used as a range qualifier, even if the compiler wants to remove it due to
optimization reasons.
Obviously an alternative is to turn off the optimization instead of using this solution, but most of the time the
compiler optimization is desired.

Application Note 21 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Acronyms

5 Acronyms
The following table shows the most common acronyms used in the MTV GUI and this document:

Table 3 Acronyms
Acronym Explanation
A Address
A+D Address + Data
CPU Central Processing Unit
DAP Device Access Port
DAS Device Access Server
DMA Direct Memory Access
ELF Executable and Linking Format
EMEM Emulation Memory
GUI Graphical User Interface
INT Interrupt
IP Instruction Pointer
IS See ‘INT TS8_IS’ in the manual
LMU Local bus Memory Unit
MCDS Multi-Core Debug Solution
OCDS On-Chip Debug Support
OLDA Online Data Acquisition
OTGB OCDS Trigger Bus
PMU Program Memory Unit
R/W Read/Write
SMU Safety Management Unit
SP Service Provider
SPA See ‘INT TS8_SPA’ in the manual
SRN Service Request Node
SSI Single Signal Interface
STDSW Task Standard Software Task
TCM Trace and Common Memory (part of EMEM)
TS Trigger Set
XCM Extended Common Memory (part of EMEM)
XTM Extra Trace Memory (part of EMEM)

Application Note 22 of 24 V1.0


2018-02-07
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
Revision history

Revision history
Document Date of release Description of changes
version
V1.0 February 2018 First release

Application Note 23 of 24 V1.0


2018-02-07
Trademarks
All referenced product or service names and trademarks are the property of their respective owners.

IMPORTANT NOTICE
Edition 2018-02-07 The information contained in this application note For further information on the product, technology,
is given as a hint for the implementation of the delivery terms and conditions and prices please
Published by product only and shall in no event be regarded as a contact your nearest Infineon Technologies office
description or warranty of a certain functionality, (www.infineon.com).
Infineon Technologies AG condition or quality of the product. Before
81726 Munich, Germany implementation of the product, the recipient of this
application note must verify any function and other WARNINGS
technical information given herein in the real Due to technical requirements products may
© 2018 Infineon Technologies AG. application. Infineon Technologies hereby contain dangerous substances. For information on
disclaims any and all warranties and liabilities of the types in question please contact your nearest
All Rights Reserved. any kind (including without limitation warranties of Infineon Technologies office.
non-infringement of intellectual property rights of
Do you have a question about this any third party) with respect to any and all
information given in this application note. Except as otherwise explicitly approved by Infineon
document? Technologies in a written document signed by
authorized representatives of Infineon
Email: erratum@infineon.com The data contained in this document is exclusively Technologies, Infineon Technologies’ products may
intended for technically trained staff. It is the not be used in any applications where a failure of
responsibility of customer’s technical departments the product or any consequences of the use thereof
Document reference to evaluate the suitability of the product for the can reasonably be expected to result in personal
AP32401 intended application and the completeness of the injury.
product information given in this document with
respect to such application.

You might also like