AP32401 MTV Introduction 180207
AP32401 MTV Introduction 180207
An introduction to MTV
Multi-Core Debug Solution (MCDS) Trace Viewer
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
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’.
Note: Other controls not listed in this table are described in the next chapter where a first data trace is
set up and performed.
2 First trace
In order to perform the first trace, some settings are required. These basic settings will be described in this
section.
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.
Figure 4 ‘Reset Device First’ option turned on with the appropriate radio button
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).
Code Listing 1
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.
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).
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.
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.
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.
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.
After the tracing has finished, the trace data view will be displayed. For example:
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).
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.
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.
Note: Please read the DAS Release notes that are included in the DAS installation.
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.
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)
Revision history
Document Date of release Description of changes
version
V1.0 February 2018 First release
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.