Wednesday, June 28th 2017, 5:34am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

1

Thursday, June 30th 2016, 4:35pm

[ABANDONED] Cannot do instruction trace with j-Trace emulator

I cannot do an instruction trace with my Segger j-Trace for ARM Cortex-M using Segger's Ozone debugger. I connected my j-Trace to a Cortex-M3 LPC1778 processor. The processor does not have an ETB but has
four ETM trace data lines.
The
problem is the instruction trace does not show all the instructions that execute. It's hard to tell
but it may be showing every 20th instruction or so. Also the trace
shows addresses of instructions that did not execute.

Also, I have to go through a rather odd procedure to turn on the trace. First, start the processor with the instruction trace window closed. Open the trace window while the processor is running. Stop the processor. Start the processor. The trace begins. Is that the way it is suppose to work?

The
instruction trace does not skip instructions or show instructions that
did not execute when I use my j-Trace with an IAR
debugger. So I think I have a good connection.

I would much appreciate it if someone will advise me what might be wrong.

Thanks

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

2

Thursday, June 30th 2016, 6:07pm

Hi Doug,


sorry for the delay in response.
I will try to reproduce this issue tomorrow.


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

3

Friday, July 1st 2016, 8:23pm

Thanks Niklas.

Were you able to reproduce the problem?

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

4

Monday, July 4th 2016, 6:51pm

Hi,

while you a tracing with Ozone, could you open the J-Link Control panel (little green J-Link Icon in the tray area), switch to the tab RAWTrace, and make a screenshot of it?
My guess is that CLK/TraceCLK is too high.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

5

Tuesday, July 5th 2016, 9:20am

Hi,


I had no problem using this Ozone file.
Can you give it a try? (After adjusting the location of the application file).


Best regards,
Niklas
SEGGER - Niklas has attached the following file:
  • LPC1788_Trace.zip (15.43 kB - 133 times downloaded - Last download: Yesterday, 3:39am)
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

6

Tuesday, July 5th 2016, 8:35pm

The Ozone file you sent does seem to solve one problem. I do not need to do the odd startup procedure now to get the trace light on the j-Trace to turn on. However, the instruction trace window shows "No data" now when I stop the debugger. The screen shot of the Raw Trace tab is attached. The status of 0 Hz and the JLINK_IsHalted message at the bottom do not look good. But the trace indicator light is on and the processor is running.

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

7

Wednesday, July 6th 2016, 9:28am

Hi,

Quoted


JLINK_IsHalted message at the bottom do not look good.

No need to worry about this. JLINK_IsHalted just says the J-Link is checking if the target stopped at a breakpoint.

0 Hz indeed is wrong. During my tests, it showed 5970000 Hz.
It is possible for you to check with a scope if the TraceCLK is active while the target is running?
It is possible for you to provide me with reproduction project, since it works for me using my test project?


Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

8

Wednesday, July 6th 2016, 4:57pm

TraceCLK was not running. I removed these lines in the code:

LPC_IOCON->P2_2 = 5;
LPC_IOCON->P2_3 = 5;
LPC_IOCON->P2_4 = 5;
LPC_IOCON->P2_5 = 5;
LPC_IOCON->P2_6 = 5;

I thought the AfterTargetReset script was taking care of that now but apparently it doesn't. I put the above lines back in the code and the status shows 59970000 Hz now. Now I see instructions in the trace window after halting program execution.

The program is an infinite loop:

60A8 LDR r2, [r3]
60AA ADD r2, r2, #0x01
60AE STR r2, [r3]
60B0 LDRB r2, [r1]
60B2 CMP r2, #0
60B4 BNE 0x60A8

The trace shows the following lines over and over:

60B2 CMP r2, #0
60B0 LDRB r2, [r1]
60AA ADD r2, r2, #0x01
60B4 BNE 0x60A8

I think the trace is showing every 20th instruction or so. I do not see any addresses outside the range 60A8 - 60B4 any more. I also do not have to do the odd procedure to get Ozone to start tracing any more. The only problem now is why does the instruction trace not show all the instructions that execute? The IAR debugger shows all the instructions. So I know the j-Trace is capable of that. If I single step through the loop then Ozone shows all the instructions that execute.

Thanks for your help.

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

9

Wednesday, July 6th 2016, 5:43pm

Hi,


TraceCLK = 0.5 * CPUCLK.
So the CPU is running at about 120 MHz, therefore TraceCLK is running with 60 MHz.
At 60 MHz, the signals sent from the target I see on my Scope are quite bad.

Could you please check the TraceCLK when debugging in IAR (In the tab of the J-Link Control Panel)? I assume that IAR does set the CPU speed to 12 MHz, therefore the TraceCLK is running at only 6 MHz.
At 6 MHz, the LPC1778 provides better signals than at 60 MHz, therefore it works in IAR, but not in Ozone, while the issue is not related to Ozone.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

10

Wednesday, July 6th 2016, 11:49pm

I put a scope on TraceCLK while it was running in IAR. The clock is 60 MHz. My hardware people here told me it's pretty hard to get a clean signal at 60 MHz. I think they had to match the impedance on the trace pins or something.

My application will not work at 12 MHz. So I need to be able to do instruction trace when the processor is running at 120 MHz. And I can with IAR.

I suspect IAR is doing some trick like tracing branches only. Or maybe IAR is using a higher USB speed to the j-Trace? But I doubt IAR will tell me how they do it. I am using a trial version of IAR and if I can get Ozone to work then I am not going to buy IAR.

Any help you can provide is much appreciated.

Thanks

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

11

Thursday, July 7th 2016, 9:18am

Hi,

sounds reasonable.
I assumed you just starting developing, and IAR set the speed of my LPC1788 to 12 MHz in the sample project I used.

When I set it to 120 MHz, I did not get readable trace data most of time (both in IAR and in Ozone).

So it seems that your target produces better trace signals, since it works very reliable (according to you) with J-Trace Cortex-M and IAR, so the sampled trace data seems to be fine.
Therefore, I assume Ozone interprets the sampled data incorrect under certain circumstances.

Would it be possible to provide a stripped down (or full version in case you do not mind) of your IAR project, so that we can use it for reproduction purposes?
This would most likely lead to faster results than we trying to reproduce the issue using the assembler instructions you provided.


Quoted

Or maybe IAR is using a higher USB speed to the j-Trace?

No, communication to the J-Link is always handled by SEGGER software, even if IAR EWARM is the main process.

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link

Doug

Beginner

Date of registration: Jun 29th 2016

Posts: 6

12

Thursday, July 7th 2016, 6:42pm

IAR.txt


Hi Niklas,

My IAR project is very simple. I just created a project with an empty main function.

The code I am running is just a simple loop:

volatile char flag = 1;
volatile int count = 0;

while (flag) count++;

I attached an exported instruction trace file from IAR and a screen shot of the instruction trace in Ozone. Both debuggers are running the same code.

Doug

SEGGER - Niklas

Super Moderator

Date of registration: Oct 6th 2014

Posts: 1,422

13

Friday, July 8th 2016, 10:40am

Hi,


my projects is very similar to yours.
I am just asking you if you could provide us with your IAR(a .zip of the folder containing the .eww file) and Ozone(just the .jdebug file) project, so we can cancel out any differences in the project settings.

BTW: The screenshot of Ozone seems "stitched". Does it look like this on your machine?
Are you using the most recent version of Ozone, V2.16d ?

Best regards,
Niklas
Would you like to be added to the J-Link software update notification list, so you get informed automatically when a new version becomes available?
Just write me a PM or in case you want to subscribe to it yourself, please use this link: Link
Notification for J-Link, J-Link Debugger, SystemView & J-Scope: Link
Notification for Embedded Studio: Link