mcds trigger programming - lauterbach · 2014-11-11 · mcds trigger programming 3 introduction...

23
MCDS Trigger Programming 1 ©1989-2014 Lauterbach GmbH MCDS Trigger Programming TRACE32 Online Help TRACE32 Directory TRACE32 Index TRACE32 Documents ...................................................................................................................... ICD In-Circuit Debugger ................................................................................................................ Processor Architecture Manuals .............................................................................................. TriCore ...................................................................................................................................... MCDS Trigger Programming ............................................................................................... 1 Introduction ....................................................................................................................... 2 Program Structure ............................................................................................................. 4 Input Events 5 Conditions 6 Levels 7 Programming Examples ................................................................................................... 8 Example 1: Core Trigger - Break on Function Entry 9 Example 2: Bus Trigger - Break on Bus Access 10 Example 3: State Machine - Selective Recording 11 Common Reference .......................................................................................................... 13 Sources 13 Value Options 14 Declaration Reference ...................................................................................................... 15 DATAADDRESSREAD Data read address as input event 15 DATAADDRESSWRITE Data write address as input event 15 DATAVALUEREAD Data read value as input event 16 DATAVALUEWRITE Data write value as input event 16 PROGRAMADDRESS Program address as input event 17 VAR.DATAADDRESSREAD Variable read as input event 17 VAR.DATAADDRESSWRITE Variable write as input event 18 Instruction Reference ....................................................................................................... 19 BREAK Stop program execution 19 GOTO Level switching 19 TRACE Control trace packet generation 20 Trigger Programming Language Syntax ......................................................................... 22

Upload: others

Post on 13-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

MCDS Trigger Programming

TRACE32 Online Help

TRACE32 Directory

TRACE32 Index

TRACE32 Documents ......................................................................................................................

ICD In-Circuit Debugger ................................................................................................................

Processor Architecture Manuals ..............................................................................................

TriCore ......................................................................................................................................

MCDS Trigger Programming ............................................................................................... 1

Introduction ....................................................................................................................... 2

Program Structure ............................................................................................................. 4

Input Events 5

Conditions 6

Levels 7

Programming Examples ................................................................................................... 8

Example 1: Core Trigger - Break on Function Entry 9

Example 2: Bus Trigger - Break on Bus Access 10

Example 3: State Machine - Selective Recording 11

Common Reference .......................................................................................................... 13

Sources 13

Value Options 14

Declaration Reference ...................................................................................................... 15

DATAADDRESSREAD Data read address as input event 15

DATAADDRESSWRITE Data write address as input event 15

DATAVALUEREAD Data read value as input event 16

DATAVALUEWRITE Data write value as input event 16

PROGRAMADDRESS Program address as input event 17

VAR.DATAADDRESSREAD Variable read as input event 17

VAR.DATAADDRESSWRITE Variable write as input event 18

Instruction Reference ....................................................................................................... 19

BREAK Stop program execution 19

GOTO Level switching 19

TRACE Control trace packet generation 20

Trigger Programming Language Syntax ......................................................................... 22

MCDS Trigger Programming 1 ©1989-2014 Lauterbach GmbH

Page 2: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

MCDS Trigger Programming

Version 11-Nov-2014

16-Jun-14 New manual.

Introduction

The Infineon MCDS (MultiCore Debug Solution) is an on-chip trigger and trace solution for finding complex errors and for sampling selective data for advanced measurements. TRACE32 offers a generic trigger language, called OCTL, to program the on-chip trigger logic. It e.g. allows programming of:

• Complex triggers, e.g. breaking the core on a write access to a variable after a function has been executed.

• Bus triggers, e.g. triggering on writes by the DMA controller to some special memory area.

MCDS is implemented in the Infineon TriCore and C166/XC2000 Emulation Devices. These devices are used during the development stage of an embedded system for debugging, tracing, profiling and verification. OCTL currently only supports TriCore Emulation Devices with core version 1.3.1 or later. The Mini-MCDS of TriCore AURIX devices is not supported.

The reader of this MCDS Trigger Programming Manual is assumed to have basic skills in using the TRACE32 debug and trace solution for TriCore, including MCDS. For information on the MCDS support of TRACE32, refer to the ”MCDS User´s Guide” (mcds_user.pdf).

MCDS trigger programming basically consists of three steps:

MCDS Trigger Programming 2 Introduction ©1989-2014 Lauterbach GmbH

Page 3: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

1. Writing the trigger program.

The command MCDS.Program is used to open a trigger programming editor which can be used to create a new trigger program or to edit an existing one. The editor supports programming by softkeys and an online help. As the trigger program is stored in ASCII file format, an external editor can be used alternatively.

2. Compiling the trigger program.

The trigger program is compiled by clicking the Compile button. When compiling the semantic correctness of the trigger program is checked and the MCDS register configuration is determined.

The command MCDS.ReProgram allows to directly compile an existing trigger program.

3. Executing the trigger program.

Before the program execution on the target application is started (Go command), the MCDS register configuration is automatically written to the target hardware and becomes active as soon as the device starts operation.

MCDS.Program [<file>] Open MCDS.Program editor to create a new trigger program or to edit an existing one.

MCDS.ReProgram <file> Compile trigger program from file.

NOTE: • The default file name extension for an on-chip trigger program is octl.• If no file name is specified, t32.octl is loaded.• Only one trigger program can be compiled at a time.• Only one trigger program can be executed by the MCDS at a time.

MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH

Page 4: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Program Structure

A trigger program consists of three parts:

• Declarations

• Global Instructions

• Local Instructions

Each part is unique, the order must not change:

A trigger program consists of the following elements:

[{<declaration>}] Declarations

[{<global instruction>}] Global Instructions

[{<label>{<local instruction>}}]

Local Instructions

{<action>} [IF <condition>] Instruction

Declaration of input events

In the declaration part of the trigger program input events can be defined. These events can be used in conditions afterwards. Depending on the event types and values, specific comparators of the MCDS will be programmed with the appropriate address values or data patterns. For details, see chapter Declaration Reference.

Instruction Instructions specify actions to be taken by MCDS. Dependent on where an instruction is placed in the trigger program, a distinction is made between global and local instructions. An instruction consists of an <action> which can be combined with a <condition> in order to constrain its execution. For details, see chapter Instruction Reference.

Global instruction Global instructions are located between declarations and local instructions. At its simplest a valid trigger program may consist of just a single global instruction. If no condition is specified for a global instruction, then the respective MCDS action is executed permanently.

Local instruction Local instructions are instructions which are used in a state machine, they have to be placed beneath the global instructions. Local instructions may only be executed if the level they belong to is the current active state of the state machine. In this case they are executed, if not further limited by a condition, concurrently with the global instructions.

MCDS Trigger Programming 4 Program Structure ©1989-2014 Lauterbach GmbH

Page 5: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Indentation using spaces or tabs is allowed, it is recommended to indent all local instructions. It is not possible to split up a single declaration or instruction between two or more program lines.

Input Events

Input events can be defined in the declaration part of the trigger program. These input events can be used in conditions afterwards. An input event is declared by specifying the event type, name and value. Examples of input event types are PROGRAMADDRESS.TC or DATAVALUEREAD.LMB. For a detailed listing of event types, see chapter Declaration Reference. The user is free to choose the name of the input event, but as in C, the name must not start with a digit. Depending on the event type the value of the event has to be a program address, a data address or a data value. Address ranges and data ranges as well as symbols, hll expressions, and PRACTICE functions may also be used.

In the following example, two input events are declared. The first one specifies a range of data values. The input event will become true if one of the specified data values is transferred via the LMB bus. The second event declaration makes use of a PRACTICE function in order to specify the whole address range of the C function sieve(). The input event will become true if an instruction of the function sieve() is executed by the TriCore.

For using hll expressions the prefix VAR. has to be used. The two declarations below are equivalent. In both cases the input event MyVarAddress will become true if the TriCore writes to the fourth element of the char array flags[].

Level A level is part of a state machine. The begin of a level is indicated by a label which specifies the name of respective level. The level ends at the label of the following level or at the end of the trigger program. All instructions within a level are local instructions.

Comment Comments can be placed anywhere in the trigger program. The character string “//” as well as ‘;’ causes the compiler for the trigger program to ignore the rest of the line.

//declaration statements

; DATAVALUEREAD.<source> <event name> <data range>DATAVALUEREAD.LMB MyBusValueRange 0xdcba++0x10

; PROGRAMADDRESS.<source> <event name> <address range>PROGRAMADDRESS.TC InFunctionSieve sYmbol.RANGE(sieve)

VAR.DATAADDRESSWRITE.TC MyVarAddress flags[3] //HLL expression

DATAADDRESSWRITE.TC MyVarAddress flags+0x3 //byte offset

MCDS Trigger Programming 5 Program Structure ©1989-2014 Lauterbach GmbH

Page 6: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Conditions

Conditions allow a qualified execution of actions. They are placed behind an action and are initiated by the keyword IF followed by a single input event or a logical combination of events.

It is also possible to specify more the one <MCDS action>. This is shown in the following example.

The MCDS of an Emulation Device can trigger not only on e.g. program or data addresses but is also able to generate trace packets that contain program or data addresses. Consequently, some keywords of the trigger language may appear in the declaration as well as in the instruction part of a trigger program:

Input events can be combined with the following logical operators:

Priority is from top to down: the brackets have the highest priority, the OR operator has the lowest. Therefore the following two conditions will produce the same result:

Recommendation is to use brackets to avoid confusion.

<MCDS action> IF <condition>TRACE.ONCE PROGRAMADDRESS.TC IF MyEvent1

<MCDS action1>, <MCDS action2> IF <condition>TRACE.ONCE PROGRAMADDRESS.TC, BREAK IF MyEvent1 || MyEvent2

//declarationPROGRAMADDRESS.TC FunctionEntry sieve

//global instructionTRACE.ONCE PROGRAMADDRESS.TC IF FunctionEntry

(…) for grouping, in order to change operator precedence

! for NOT

&& for AND

|| for OR

... IF ((!Evt1)&&Evt2) || (Evt3&&Evt4)

... IF !Evt1 && Evt2 || Evt3 && Evt4

MCDS Trigger Programming 6 Program Structure ©1989-2014 Lauterbach GmbH

Page 7: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Levels

A state machine consists of two up to four levels. The beginning of a level is indicated by a label which specifies the name of the respective level. The level ends at the label of the following level or at the end of the program. All instructions located between these boundaries are part of the level. A level can contain any number of instructions except for the limitations regarding the GOTO instruction, as explained below.

Only a single level of the state machine is active at a time. At the beginning of the trigger program execution that level becomes the active level which is labeled START. If there is no such label, then at the beginning that level becomes the active level which is placed right below the declaration and global instruction part. All instructions of the active level are executed, if not further limited by a condition, concurrently with the global instructions.

The GOTO action is used to change from the active state machine level to another, i.e. it is used to make another level become the active one. Because of limitations of the MCDS hardware, some limitations apply to the use of the GOTO instruction:

• Each level may not contain more than two GOTO instructions.

• Each level can only be entered from up to two other levels, i.e. the whole trigger program may not contain more than two GOTO instructions which are changing to the same level.

The following trigger program will change to level InSieve when the event SieveEntry becomes true and change to level End when the event SieveExit becomes true. When the level InSieve is active the instruction TRACE.ENABLE advises MCDS to continuously generate Instruction Pointer Call Messages to indicate the instruction execution sequence.

//declarationPROGRAMADDRESS.TC SieveEntry sievePROGRAMADDRESS.TC SieveExit sYmbol.EXIT(sieve)

//local instructions

START:GOTO InSieve IF SieveEntry

End:BREAK

InSieve:GOTO End IF SieveExitTRACE.ENABLE PROGRAMADDRESS.TC

MCDS Trigger Programming 7 Program Structure ©1989-2014 Lauterbach GmbH

Page 8: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Programming Examples

The following examples illustrate the basic structure of trigger programs. The examples have been tested by using a TC1797ED device and the standard sieve demo provided by Lauterbach.

The following steps are necessary in order to reproduce one of the examples:

1. Load the sieve demo application which will be executed by the TC1797ED device by typing at the TRACE32 PowerView command line:

2. Connect the CPU of the TC1797ED device with the break bus of the device by typing at the TRACE32 PowerView command line:

3. Open the trigger programming editor window MCDS.Program by typing at the TRACE32 PowerView command line:

4. Enter one of the examples in the editor window MCDS.Program.

5. Click the Compile button to compile the example.

6. Start the program execution of the sieve demo by clicking the Go button.

7. Inspect the results in the TRACE32 PowerView state line or the Trace.List window.

Examples:

• Example 1: Core Trigger - Break on Function Entry

• Example 2: Bus Trigger - Break on Bus Access

• Example 3: State Machine - Selective Recording

ChDir.DO ~~/demo/tricore/hardware/triboard-tc179x/tc1797ed_demo.cmm

TrOnchip.EXTernal ON

MCDS.Program

MCDS Trigger Programming 8 Programming Examples ©1989-2014 Lauterbach GmbH

Page 9: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Example 1: Core Trigger - Break on Function Entry

The following trigger program example will stop the execution of the application when the function sieve() is entered (A):

Note that MCDS stopped the core not exactly at the entry of the function sieve() but some assembler instructions later. This is caused by delays in the signal propagation from the core to the MCDS, in the processing of the address data and in the triggering of the break bus.

The implemented functionality is called a “core trigger” because MCDS triggers on an input event generated by a core. Because of the simplicity of the program it is possible to achieve the same result by using the Break.Set sieve command.

//declarationPROGRAMADDRESS.TC SieveEntry sieve

//global instructionBREAK IF SieveEntry

A

MCDS Trigger Programming 9 Programming Examples ©1989-2014 Lauterbach GmbH

Page 10: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Example 2: Bus Trigger - Break on Bus Access

This example trigger program is used to monitor bus accesses in order to react on a specified memory access. Such an approach can be helpful in case a peripheral illegally writes to some memory area, e.g. the Data Scratchpad RAM.

The example program below observes the LMB bus for a write access to the array element specified by WriteLocation. On occurrence of this access, MCDS is advised:

• To generate a trace packet that indicates the address and data value of the write access as well as the initiator.

• To stop the program execution.

After the program execution stopped, the Trace.List window can be used to check the initiator of the bus access.

.

The following script prepares the debugger for the used example:

For more information on displaying trace items, refer to chapter ”Trace Decoding” (mcds_user.pdf).

The following script generates the event.

; trigger program

//declarationVAR.DATAADDRESSWRITE.LMB WriteLocation flags[3]

//global instructionsTRACE.ONCE DATAADDRESSWRITE.LMB IF WriteLocationTRACE.ONCE DATAVALUEWRITE.LMB IF WriteLocationBREAK IF WriteLocation

; PRACTICE script (preparation)

SYStem.Option DUALPORT ON ;enable real-time memory access;to cause bus access via debugger

Trace.Mode.SLAVE OFF ;enable the trace display for ;debugger accesses to memory

Trace.List DEFault BusMaster ;open Trace.List window

; PRACTICE script (event generation)

GoVar.Set flags[3]=1

;start the program execution;advise the debugger to write to;memory (via LMB)

MCDS Trigger Programming 10 Programming Examples ©1989-2014 Lauterbach GmbH

Page 11: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Example 3: State Machine - Selective Recording

This example shows how to build a state machine for labeling single runs of the standard sieve demo with alternating watchpoints.

The global instruction of the example trigger program advises MCDS to generate a trace packet that includes the program addresses of the entry to the endless loop function sieve().

Each time the sieve() function is entered, the local statements additionally cause a level change and generate a watchpoint message: All odd runs of the sieve() function are labeled with WATCHPOINT0, all even runs are labled with WATCHPOINT1.

A. Result of the two TRACE.ONCE commands: The debugger (busmaster OCDS-h) triggered a write access 0x1 to flags[3] at D:0xD0000078B via LMB.

B. Result of the BREAK command.

//declarationPROGRAMADDRESS.TC SieveEntry sieve

//global instructionsTRACE.ONCE PROGRAMADDRESS.TC IF SieveEntry

//local instructionsSieveOdd:

TRACE.ONCE WATCHPOINT0GOTO SieveEven IF SieveEntry

SieveEven:TRACE.ONCE WATCHPOINT1GOTO SieveOdd IF SieveEntry

A

B

MCDS Trigger Programming 11 Programming Examples ©1989-2014 Lauterbach GmbH

Page 12: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

A. Program flow messages generated on entry to function sieve().

B. Watchpoint message mcx #0 indicates that level SieveOdd was entered.

C. Watchpoint message mcx #1 indicates that level SieveEven was entered.

A

B

A

C

MCDS Trigger Programming 12 Programming Examples ©1989-2014 Lauterbach GmbH

Page 13: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Common Reference

The common reference describes items that are used in all parts of an trigger program.

Sources

A core or a bus can be a <source>, e.g. for an input event or for trace data generation:

It depends on the device which sources are available.

For TriCore AURIX only two cores at a time can be selected as an input event or as a trace packet source. The command MCDS.SOURCE.CpuMux[0 | 1].Core is used to select the cores. For more information, see chapter ”Trace Sources” (mcds_user.pdf).

<bus source> supports read/write addresses and data values.

<core source> supports write addresses and write data values. Only TriCore AURIX <core source> supports read addresses.

<source> <core source> | <bus source>

<core source> TC | PCPTC0 | TC1 | TC2

<bus source> LMB | SPB | SRI

; <core source> in an input event declarationPROGRAMADDRESS.TC SieveEntry sieve

; <core source> in an instructionTRACE.ONCE PROGRAMADDRESS.TC IF SieveEntry

; <bus source> in an input event declarationVAR.DATAADDRESSWRITE.LMB WriteLocation flags[3]

; <bus source> in an instructionTRACE.ONCE DATAADDRESSWRITE.LMB IF WriteLocation

MCDS Trigger Programming 13 Common Reference ©1989-2014 Lauterbach GmbH

Page 14: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Value Options

A data value declaration can have additional options:

The <mask option> specifies which bits of the specified value are to be compared with the target value.

The <sign option> specifies which bit is the sign bit. MCDS will sign-extend the target value before comparison.

<value option> [<mask option>] | [<sign option> <mask option>]

<mask option> /VALUEMASK <mask>

<sign option> /VALUESIGN <sign bit>

; data value 0x1 written as a byte (8-bit)DATAVALUEWRITE.LMB WriteData 0x1 /VALUEMASK 0xff

; data value 0x1000 written as a word (16-bit)DATAVALUEWRITE.LMB WriteData 0x1000 /VALUEMASK 0xffff

; data value 0x01 written via the highest byte of the bus [31..24]DATAVALUEWRITE.LMB WriteData 0x01000000 /VALUEMASK 0xff000000

; data value -1. written as a byte (8-bit), sign bit is bit 7.DATAVALUEWRITE.LMB WriteData -1. /VALUESIGN 7. /VALUEMASK 0xff

; data value -1000. written as a word (16-bit), sign bit is bit 15.DATAVALUEWRITE.LMB WriteData -1000. /VALUESIGN 15. /VALUEMASK 0xffff

MCDS Trigger Programming 14 Common Reference ©1989-2014 Lauterbach GmbH

Page 15: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Declaration Reference

Declarations are used to specify input events.

DATAADDRESSREAD Data read address as input event

Declares an input event for a read access to an address or address range performed by a core or a bus.

For more information on <source>, see chapter Sources.

DATAADDRESSWRITE Data write address as input event

Declares an input event for a write access to an address or address range performed by a core or a bus.

For more information on <source>, see chapter Sources.

Format: DATAADDRESSREAD.<source> <event name> <event value>

<event value> <data address> | <data address range> | <symbol>

; read access by TriCore to specified addressDATAADDRESSREAD.TC my_address 0xD0000078

; read access by TriCore to address specified by symbol nameDATAADDRESSREAD.TC my_address vint

; read access by LMB bus to specified address range performedDATAADDRESSREAD.LMB my_range 0xD0000078++0xff

Format: DATAADDRESSWRITE.<source> <event name> <event value>

<event value> <data address> | <data address range> | <symbol>

MCDS Trigger Programming 15 Declaration Reference ©1989-2014 Lauterbach GmbH

Page 16: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

DATAVALUEREAD Data read value as input event

Declares an input event for a data value read by a core or by a bus.

For more information on <source>, see chapter Sources.

DATAVALUEWRITE Data write value as input event

Declares an input event for data value written by a core or by a bus.

For more information on <source>, see chapter Sources.

; write access by TriCore to specified addressDATAADDRESSWRITE.TC my_address 0xD0000078

; write access by TriCore to address specified by symbol nameDATAADDRESSWRITE.TC my_address vint

; write access by LMB bus to specified address rangeDATAADDRESSWRITE.LMB my_range 0xD0000078++0xff

Format: DATAVALUEREAD.<source> <event name> <value> [/<value option>]

; data value 0x1 read as a byte (8-bit) via the LMB busDATAVALUEREAD.LMB WriteData 0x1 /VALUEMASK 0xff

; data value -1000. read as a word (16-bit), sign bit is bit 15.; read access by TriCoreDATAVALUEREAD.TC WriteData -1000. /VALUESIGN 15. /VALUEMASK 0xffff

Format: DATAVALUEWRITE.<source> <event name> <value> [/<value option>]

; data value 0x01 written via the highest byte of the bus [31..24]; write access via LMB busDATAVALUEWRITE.LMB WriteData 0x01000000 /VALUEMASK 0xff000000

; data value -1. written as a byte (8-bit), sign bit is bit 7.; write access performed by TriCore 0DATAVALUEWRITE.TC0 WriteData -1. /VALUESIGN 7. /VALUEMASK 0xff

MCDS Trigger Programming 16 Declaration Reference ©1989-2014 Lauterbach GmbH

Page 17: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

PROGRAMADDRESS Program address as input event

Declares an input event for a program address executed by a core.

For more information on <core source>, see chapter Sources.

VAR.DATAADDRESSREAD Variable read as input event

Declares an input event for a read access to a variable or HLL expression performed by a core or a bus.

For more information on <source>, see chapter Sources.

Example for the array flags[]:

Format: PROGRAMADDRESS.<core source> <event name> <value>

<value> <program address> | <program address range> | <symbol>

; program address executed by TriCorePROGRAMADDRESS.TC SieveEntry sieve

; program address range executed by TriCorePROGRAMADDRESS.TC InFunctionSieve sYmbol.RANGE(sieve)

Format: VAR.DATAADDRESSREAD.<source> <event name> <hll expression>

; read access by TriCore to specified variableVAR.DATAADDRESSREAD.TC myVariable flags

; read access by LMB bus to specified array elementVAR.DATAADDRESSREAD.LMB myVariable flags[3]

MCDS Trigger Programming 17 Declaration Reference ©1989-2014 Lauterbach GmbH

Page 18: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

VAR.DATAADDRESSWRITE Variable write as input event

Declares an input event for a write access to a variable or HLL expression performed by a core or a bus.

For more information on <source>, see chapter Sources.

Example for the array flags[]:

Format: VAR.DATAADDRESSWRITE.<source> <event name> <hll expression>

; write access by TriCore to specified variableVAR.DATAADDRESSWRITE.TC myVariable flags

; write access by LMB bus to specified array elementVAR.DATAADDRESSWRITE.LMB myVariable flags[3]

MCDS Trigger Programming 18 Declaration Reference ©1989-2014 Lauterbach GmbH

Page 19: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Instruction Reference

BREAK Stop program execution

Stops the program execution on all cores controlled by the TRACE32 instance as soon as the specified condition becomes true. If no condition is specified, the program execution is stopped immediately.

Example: Stop program execution if a write access to the specified variable via the LMB bus occurs.

GOTO Level switching

Activates the specified trigger level. GOTO may be used more than once in a level.

Format: BREAK [IF <condition>]

VAR.DATAADDRESSWRITE.LMB WriteLocation flags[3]

BREAK IF WriteLocation

Format: GOTO <level> [IF <condition>]

<level>: <name>START

START:TRACE.ONCE PROGRAMADDRESS.TCGOTO RecordDMA…

RecordDMA:…

MCDS Trigger Programming 19 Instruction Reference ©1989-2014 Lauterbach GmbH

Page 20: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

TRACE Control trace packet generation

For more information on <source>, see chapter Sources.

Format: TRACE.<mode> <trace item> [IF <condition>]

<mode>: EnableONCE

<trace item>: <trace object> [{[,] <trace object>}]

<trace object>:

PROGRAMADDRESS[.SYNC].<core source> DATAADDRESSWRITE.<source>DATAADDRESSREAD.<source>DATAVALUEWRITE.<source>DATAVALUEREAD.<source>WATCHPOINT<number>

STATUS.<source>CHANNEL.PCPMEMORYPROTECTIONSET.TC[0|1|2]

<number>: 0 … 7

ENABLE Advise MCDS to generate the specified trace packets as long as <condition> is true.If no <condition> is specified, trace packets are generated continuously.

ONCE Advise MCDS to generate the specified trace packets when the specified <condition> becomes true.If TRACE.ONCE is used in a trigger level without <condition>, MCDS is advised to generate the specified trace packets when the trigger level is entered.

<trace item>

PROGRAMADDRESS.<core source> Advise MCDS to generate Instruction Pointer (Call) Messages for the specified <source>.

PROGRAMADDRESS.SYNC.<core source> Advise MCDS to generate Instruction Pointer Messages for the specified <source>.

MCDS Trigger Programming 20 Instruction Reference ©1989-2014 Lauterbach GmbH

Page 21: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

DATAADDRESSWRITE.<source> Advise MCDS to generate a trace packet that indicates the data write address for the specified <source>.

DATAADDRESSREAD.<source> Advise MCDS to generate a trace packet that indicates the data read address for the specified <source>.

DATAVALUEWRITE.<source> Advise MCDS to generate a trace packet that indicates the data write value for the specified <source>.

DATAVALUEREAD.<source> Advise MCDS to generate a trace packet that indicates the data read value for the specified <source>.

WATCHPOINT<number> Advise MCDS to generate a numbered trace marker. Up to 8 watchpoint markers are provided by MCDS.For details, see ”Watchpoints” (mcds_user.pdf).

STATUS.<source> Advise MCDS to generate a Debug Status Message for the specified <source>.

CHANNEL.PCP Advise MCDS to generate a trace message which provides the number of the currently active PCP channel.It is recommended to read ”PCP Channel ID” (mcds_user.pdf) before you use this <trace object>.

MEMORYPROTECTIONSET.TC[0|1|2] Advice MCDS to generate a trace message that provides the number of the currently active memory protection set for the specified core.

MCDS Trigger Programming 21 Instruction Reference ©1989-2014 Lauterbach GmbH

Page 22: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

Trigger Programming Language Syntax

The meta symbols must not be written in the trigger program.

The trigger programming language starts with the non-terminal symbol mcds_prog.

NOTE: The following symbols are meta-symbols used to describe the syntax of the trigger programming language. They are not symbols of the trigger programming language.

[…] 0 up to 1 iteration of the expression included (the expression can be omitted)

{…} 1 up to infinite iteration of the expression inside (the expression must be written at least once)

(…) summary (summarize alternatives)

| separates alternatives

: the name (non-terminal symbol) on the left can be substituted with the expression on the right

text the characters written in bold letters are terminal symbols which cannot be substituted any more (the characters have to be typed in this way)

mcds_prog: [{EOL}] [decls] [globals] [{locals}] {EOL} EOF

decls: [event_dec] [comment] {EOL} [decls]

event_dec <event> name1 [int]

event see the events specified in the Declaration Reference

globals: instr

locals: label [instr]

label: (name | START):

instr: [comlist] [comment] {EOL} [instr]

comment: (// | ;) text

comlist: command [{[,] command}] [IF condition]

command: c_break | c_goto | c_trace

c_break: BREAK

c_goto: GOTO (name | START)

c_trace <trace item>

trace item see the trace items specified by the TRACE instruction

MCDS Trigger Programming 22 Trigger Programming Language Syntax ©1989-2014 Lauterbach GmbH

Page 23: MCDS Trigger Programming - Lauterbach · 2014-11-11 · MCDS Trigger Programming 3 Introduction ©1989-2014 Lauterbach GmbH 1. Writing the trigger program. The command MCDS.Program

condition: t1 {[|| t1]}

t1: t2 {[^^ t2]}

t2: t3 {[&& t3]}

t3: (! t3) | (condition) |name1 | name2 | name3

name, name1, name2, name3:

is chosen by the user and must correspond to the 'C'-name conventions

int: syntax described in the IDE User's Guide

text: all characters except EOL and EOF

MCDS Trigger Programming 23 Trigger Programming Language Syntax ©1989-2014 Lauterbach GmbH