Lauterbach Snooping: JTAG (almost) Trace / (almost) Perf analyser

cancel
Showing results for 
Search instead for 
Did you mean: 

Lauterbach Snooping: JTAG (almost) Trace / (almost) Perf analyser

No ratings

Lauterbach Snooping: JTAG (almost) Trace / (almost) Perf analyser


Background

None of my automotive have trace pins on their board. Trace is consequently not possible.

Anyway you can do "Snooping" with your Lauterbach JTAG probe. Snooping just send data as fast as possible.

In the following example I will Snoop the i.MX8X' SCFW, notice I do not have the sources (except board.c) but I have the elf file (thus I have debug info with functions names for instance). Notice Snooping is available on all MCU/MPU with JTAG.

 

In my case I used it for the first time in 2015 on Vybrid, our first heterogeneous dual core (Cortex-A5 & Cortex-M4) with no XRDC... My customer has sent the final product with a JTAG connector and flashed SW product to me. I had a laconic comment: "software is done all around the world in UK, India and the US, when we flash all the software the Vybrid Reset for some version, we don't have the sources for this specific software we have flashed in this product. Good Luck".

In this case snooping on both core at the same time was the only solution for me... At the end I have discovered (thanks to the last PC addresses before the crash) the cortex-A5 was deconfiguring a pin of the QSPI flash interface on which the M4 was eXecuting In Place (XiP).

Configure Trace32

When your Trace32 is open, CPU>>System Settings... menu and configure the JtagClock as fast as possible (here 40MHz) to have fast data streaming:

pastedImage_5.png

go in Trace>>Configuration menu

Select "SNOOPer"

Select to stream the Pointer Counter thus select the mode "PC"

Pass to State to "Arm"

You can increase also the SIZE of the buffer

pastedImage_6.png

Launch your code:

pastedImage_8.png

Attach to SCFW with Lauterbach

In Trace32, CPU>>System Settings, chose IMX8QXP-SCU:

pastedImage_16.png

And then do an "Attach":

pastedImage_17.png

Then yu should see your SCU core running:

pastedImage_18.png

Snooping

And break your code, your "used" field " should be filled:

pastedImage_11.png

Open Trace>>List>>Default

Click on "Chart"

pastedImage_9.png

On the trace list you can see the sampling rate: around 48µs in our case.

It means you may (almost) not see functions lasting less than 48µs (depends when it is sampled), or you'll see it sometimes.

But for performance analysis it can be useful to see which function is too slow (rather then instrument the code), but as I mentioned in my case function has to last more than 48µs!

Perf

You can also get Performance analysis. But keep in mind if your function is faster than 48µs in my case, the result will not be accurate!

Go in Perf>>Perf Configuration (it can also be done un real time with Perf>>Perf List Dynamic)... and select "Snoop":

pastedImage_13.png

Then put the State in "Arm" and click on "List" to open the "List Window"

Launch your code and stop it.

In the "List" window you'll see all the function ranked according to their usage occurrence (my SCFW is almost always in sleep!)

pastedImage_14.png

Examples

Example 1 : Snoop a function call (or a variable)

With Snooping you cannot trace a function calls.

To do that I add a global variable in the function. You'll have a little overhead due to that.

I will use an i.MXRT1170 with the SDK 2.6.1. I have built the Tiger example (vglite).

April 4th 2020: i.MXRT1170 is not public, meaning not officially supported by Lauterbach.

Please follow the instruction in my SharePoint folder (if the link disappears, it may signify i.MXRT1170 is supported) to add support of the i.MXRT1170.

https://nxp1-my.sharepoint.com/:f:/g/personal/vincent_aubineau_nxp_com/Ej8ID8mXaNZPnVgTWgYgqHQBzR0Xc... 

I want to know the framerate.

To do that I have to monitor the redraw() calls. What I do, is I put the "n" variable as global.

pastedImage_2.png

Trace>>Configuration ...

Chose "memory" and "changes" (to log only when the variable is changing):

pastedImage_6.png

Then then click on select... and "i"

pastedImage_4.png

Search for "n" variable and select it:

pastedImage_5.png

Launch your software and then do a break.

Click on "List":

pastedImage_7.png

You have the list of your function call (as you can see it is not always the same), in the "ti. call" you have the duration between 2 call (keep in mind the function must not be called at high frequency:

pastedImage_8.png

If you click on "draw", you can display the variable values (click on pastedImage_11.png to scale it):

pastedImage_9.png

Example 2: Monitor Frame Per Second

I can also monitor the fps if I pass "time" variable global:

pastedImage_1.png

And you can have a reprensentation of you fps (notive I have unchecked "Changes" to have an easy to intrepret curve

pastedImage_2.png

Example 3: Monitor Frame Per Second and rendering size

Results often depends of several variables.

If you display 2 variables on 1 display window, if the 2 variable does not have the same range, it is not easy to observe.

The best solution I have found in this case is to have 2 "Draw" Windows.

Add the 2 variables in the "SElect" field ("time" and "ScaleCount", beware, it is case sensitive).

Launch your code, and stop it after a while.

Then right click on the "time" and "ScaleCount" variable in your code to display 2 "Draw" window:

pastedImage_6.png

pastedImage_7.png

Thus you have 2 "Draw" windows, and you see FPS depends on rendering size... logical!

 

pastedImage_5.png

Version history
Revision #:
3 of 3
Last update:
‎09-10-2020 01:34 AM
Updated by: