Please enable JavaScript to view this site.

winIDEA Help

Version: 9.21.241

Software Trace via LPD Debug port

In this topic:

Introduction

SFT Software Trace Timestamp Accuracy

Trigger dialog

PC Filter, DBTAG Filter

DBPUSH Filter

Registers R0-R31

RH850/U2x

Configure Software Trace via LPD Debug port

Example

 

 

Introduction

Due to the inherently small size of on-chip trace RAM, On-chip trace may have limited usefulness for running a functional or task profiler. The LPD SofTrace (SFT) attempts to overcome this limitation. However, users and operating system vendors must instrument the software at key points by including the DBCP, DBTAG, and DBPUSH instrumentation statements. When the CPU executes these instructions, the program counter value, immediate 10-bit data (e.g. task or function ID), the selected number and values of the common core registers (e.g. R1 to R5) are transmitted via the LPD - Low pin debug interface.

 

Sample code snippet (for IAR compiler):

asm("DBTAG 0x1");
asm("DBPUSH R1-R2");
asm("DBCP");
 
asm("PREPARE {r25},0");
asm("mov %0, R25" : "+r" (myVariable) );  // writes content of variable to rx register
asm("DBPUSH R25-R25");                    // outputs rx register
asm("DISPOSE 0,{R25}");                   // restores rx register

 

When instrumenting the code, care must be taken to not generate too many SFT messages because of a limited LPD serial port bandwidth. Each instrumentation instruction generates a unique software trace message. Each message is first stored in the On-Chip internal software trace buffer, which consists of 48 bits (1line) x 8 lines, before it is output to the LPD interface. This buffer acts as a FIFO buffer and helps overcoming short term bottlenecks when the LPD interface bandwidth is insufficient for the amount of software trace messages to be broadcast to the debug tool. Once there is no free space for the software trace message in the FIFO buffer, a software trace message loss occurs, ie. overflow.

When an overflow occurs, the overflow message is stored in the software trace buffer and the overflow is also reported in the Analyzer Output window. The storing of software trace messages is resumed when a line in the software trace buffer is freed after the stored overflow message. In case of overflows, try adjusting the LPD clock in the Hardware / CPU Options / SoC page to a maximum working frequency that works reliably for your setup.

 

Warning_orange

During the SFT trace the LPD cannot be used for debugging. To regain debug control over the CPU, forcibly stop trace or program execution by respective winIDEA menu or toolbar button commands.

 

Warning_orange

The RH850 devices can output Software Trace from one core at a time. Therefore, a single SFT source should be defined in the trace trigger dialogs.

 

 

SFT Software Trace Timestamp Accuracy

The CPU internal 8-stage FIFO buffer may introduce an output latency and thus timestamp inaccuracy of 8 x times the transmission time of a SFT message.

Say the LPD4 output frequency is 12MHz, then a transmission of a (net) 48-bit DBPUSH message typically used for task profiling takes 4us, and therefore the maximum message output delay is 8 x 4us = 32us. This in turn translates to a timestamp accuracy of 4 to 32us, depending on FIFO load.

A 48-bit message is split into 6 data frames with start and stop bits added. So, in full 60 bits are transmitted. Hence, the worst-case accuracy is 40us.

For function profiling a shorter DBTAG message can be used. In this case the accuracy can be better, between 1 to 10us.

 

 

Trigger dialog

 

OCDRH850-trace-SFTswTrace-SoftTrace

 

 

PC Filter, DBTAG Filter

Mask bit '1' ignores the corresponding Value bit. To trace tags from e.g. 0x010 to 0x01F, set Value to 0x010 and Mask to 0x00F.

For a specific Value, enter a number and set Mask to zero.

 

DBPUSH Filter

Represents a 32-bit mask, each bit corresponding to one of the general purpose registers R0-R31 (see the table below).

 

Registers R0-R31

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

R

31

30

29

28

27

26

25

24

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

 

RH850/U2x

Trigger Configuration dialog extends to two SFT Filter modules.

 

 

Configure Software Trace via LPD Debug port

number1

Select the LPD SofTrace via Hardware / CPU Options / Analyzer.

Lpd-analyzer

 

 

number3

Select suitable Recording Size Limit via Recorder.

Initially, it is recommended to use small values for setup verification. For example, select 256KB or 1MB.

 

Number4

Set filters for SofTrace messages via Manual Trigger / Recorder Configuration / Configure.

Because the LPD port bandwidth is very limited it is necessary to reduce the SFT traffic on a heavily instrumented code. To trace all instrumentation instructions set all masks to FFs.

 

 

Example

The hex value 0x00000002 means that the general purpose register R1 is selected for trace. A mask 0x80000000 would select just R31. More than one register can be selected, of course.  A mask 0x00010038 enables R16, R5, R4 and R3 for the trace.

 

Sample trace with trace all SFT, CPU on 80MHz and LPD on 4MHz.

OCDRH850-trace-SFTswTrace-sampleTrace

 

 

Although the SFT messages can be displayed in the Trace window, they are intended for profiling functions and OS tasks. For effective use of the SFT profiling winIDEA correlates the SFT messages with application symbol information and custom instrumentation files refer to the Profiler Analysis.

 

OCDRH850-trace-SFTswTrace-sampleProfiler

 

 

Copyright © 2024 TASKING Germany GmbH