[SOLVED] Issue Attaching to Running Program

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

  • [SOLVED] Issue Attaching to Running Program

    I'm having trouble with Attach to Running program in Ozone.

    I have a jLink Ultra+ and am using Ozone (v 3.36). I’m connecting to a S32K396 chip and Ozone works great when I Download & Reset Program, but
    When I Attach to Running Program, it almost always fails with a HardFault exception. My colleague connecting to a S32K388 experiences the same thing.
    Weird thing is that sometimes (very rarely) it actually works, but I can't figure out why.
    Images
    • hardfault.jpg

      834.93 kB, 2,032×1,652, viewed 105 times
  • Sorry my original post did not have values in the image.
    Here's some more information:
    It seems that I am able to attach, but it halts (even though I'm doing Attach to Running Program and not Attach and Halt.
    Then I hit step or play and I get the fault which seems to either be an data access violation or instruction access violation with a SysTickException
    Images
    • data_access_violation.jpg

      399 kB, 1,048×1,093, viewed 88 times
    • instruction_access_violation.jpg

      465.12 kB, 1,049×1,115, viewed 107 times
  • Hi Charles_1,
    just a guess: Does your RTOS enter a power-saving mode when entering the idle thread? In that case, please have a look here: wiki.segger.com/J-Link_Low-power_mode_debugging
    Best regards
    -- AlexD
    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 confirmed that it WFI=0 at startup and when in Idle task. But I found something that seems to be the answer (although still not working):

    Here wiki.segger.com/S32Kxxx at section
    Attach to debug session


    It says that for S32K chips, you cannot attach out of the box due to the ECC RAM. You must use a JLink Script to alter the normal connection.
    So I tried using the File provided and putting in my project file via the BeforeTargetConnect() function.

    But I get the following:
    Attach to CPU failed. Executing connect under reset.
    Failed to power up DAP
    Connect failed. Resetting via Reset pin and trying again.

    Here's the content of that file provided from link above, do I need to alter this somehow?

    int InitTarget(void) {
    //
    // As this script file is only used for attach purposes, no special handling is required.
    // Therefore, we override the default connect handled by the J-Link DLL for this device.
    // as it would trigger a reset.
    //
    return 0;
    }
  • Ok, so I've been able to attach by using the SetupTarget function:
    int SetupTarget() {
    //
    // We leave ths function empty here to skip the ECC RAM init for SystemView.
    // Otherwise the RTT buffer would be overwritten and SystemView will not start.
    //
    return 0;
    }


    Does this sound right?
    Any further commentary is much appreciated, thanks!
  • Hi Charles_1

    your inquiry is no longer Ozone specific. You are facing general connection issues, which cannot be handled by Ozone team but need to be handled by the J-Link team. If my understanding is correct, you are now able to attach to your device. Is that correct? If not, please open a thread in the J-Link section of this forum.

    Best regards
    -- AlexD
    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 Hi Charles_1,
    good to see you are up and running again. We will consider this thread as closed now.
    Thanks for sharing this with us and best regards
    -- AlexD
    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.