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

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [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
  • Hi Doug,


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


    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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
    Files
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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.
  • Hi,

    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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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.
  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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
  • 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.


    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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • 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
  • 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
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.