[SOLVED] Ozone + J-LINK Debugger attach to running program

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

  • [SOLVED] Ozone + J-LINK Debugger attach to running program

    Hello,

    I am using Ozone 2.70a with a J-LINK Plus and am trying to attach the debugger to a running program without causing a reset. However, whenever I click the "Attach to running program" or "Attach and halt", the program jumps into the reset vector at 0x00000000. Does this always happen? Is there a way to prevent this from happening?

    Thanks!

    The post was edited 1 time, last by ucontrollerdude ().

  • Hello,

    Thank you for your inquiry.
    Default behaviour of our debug tools is that when a reset is issued a reset will be handled. If you do not want a target to be resetted you can overwrite the default reset behaviour in the Ozone script interface. How is explained in the Ozone manual UM08025.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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.
  • What I am trying to do is use the "Attach to Running Program" (section 5.3.1.2 of UM08025) so I can attach the debugger to the program without causing a reset. It does not seem to be working for me because when I click this button, the PC jumps to 0x00000000. Section 5.3.1.2 states that phases 1 and 2 are executed so the reset phase is not executed (I confirmed that below). Going back to my original question, is it possible to connect to the target without the PC changing to 0x00000000?

    I am not issuing a reset. I added Util.Log messages in the following functions:

    TargetReset()
    BeforeTargetReset()
    AfterTargetReset()

    And the log message does not print out. When I do issue a reset the log statements print.

    I tried overwriting the AfterTargetConnect() function but setting the PC something outside the reset vector (like main() entry) gets me an undefined instruction exception. Guessing it's because the PC is changed abruptly while the program is still executing.
  • Hello,

    What target device are you debugging exactly, some target devices can't be connected to without a reset due to their design.


    ucontrollerdude wrote:

    I am not issuing a reset. I added Util.Log messages in the following functions:

    TargetReset()
    BeforeTargetReset()
    AfterTargetReset()

    And the log message does not print out. When I do issue a reset the log statements print.
    Do you see the same behaviour with the latest Ozone version?

    ucontrollerdude wrote:

    I tried overwriting the AfterTargetConnect() function but setting the PC something outside the reset vector (like main() entry) gets me an undefined instruction exception. Guessing it's because the PC is changed abruptly while the program is still executing.
    To do this the target device must be halted first. So do a halt, change PC, go, then it should work as expected.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 am trying to target the RM46L852 (ti.com/product/RM46L852).


    I have not tested with the latest Ozone version, I will give that a shot.


    SEGGER - Nino wrote:

    ucontrollerdude wrote:

    I tried overwriting the AfterTargetConnect() function but setting the PC something outside the reset vector (like main() entry) gets me an undefined instruction exception. Guessing it's because the PC is changed abruptly while the program is still executing.
    To do this the target device must be halted first. So do a halt, change PC, go, then it should work as expected.
    Best regards,
    Nino
    So I tried this:

    Source Code

    1. void AfterTargetConnect (void) {
    2. Debug.Halt();
    3. Target.SetReg("PC", 0x5654); // go to start of main
    4. Debug.Continue();
    5. }
    and I still get the undefined instruction exception. However, I also tried with just a "Debug.Halt()" in the above function, and the software PC is at 0x00000000 already so it is most likely the case that this microcontroller must be reset to connect to.


    Thank you for the help!