Keep debugging on software reset and connect to running target

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

  • Keep debugging on software reset and connect to running target

    Hello there,

    There are two things I haven't been able to do with my JLink + Cortex M4.

    1) When I do a software reset debugging stops at the first program address and no matter what I do it is stuck there forever. I would like to be able to do software resets while debugging.

    2) For long-running testing usually leave some devices running for weeks, so I can check they don lock and work as expected. When a device locks, I would like to connect a JLink and connect a GDB session without resseting and without loosing where the execution was, so I can check where it is and why it is stuck there.

    Does someone know how I should do this?

    Best regards,
  • It depends on your debugging environment.
    As a matter of fact, you should consult them.

    But the Jlink is capable of attaching to a running target,
    In the IAR for eclipse plugin for example you have something like you see in my attachment.
    Images
    • 2014-09-15 15_58_59-Debug Configurations.png

      8.44 kB, 510×226, viewed 1,634 times
  • Hi,

    As rigomate already wrote, it is depending on your setup.
    I assume that you are using a GDB based setup.

    to 1)
    Sounds a bit like your debugger has setup vector catch on reset in the DEMCR [VC_CORERESET].
    If this bit is set, the CPU will halt, immediately after a reset of the core has been done.

    to 2)
    By default, J-Link + GDB Server do *not* reset the device on connect. J-Link GDB Serveronly performs a reset if a "monitor reset" command is performed or a GDB 'r' or 'R' packet is received.
    If GDB sends these packets: We have no influence on this.


    - Alex
  • Yes, I am using GDB. Even if I not use the Eclipse debugger it does the same. For example, yesterday I just connected to the board using JLinkExe, I did a reset and 'g' to make it run. If by chance it does a software reset the CPU halts at the initial address and I can't get it to step or do anything, I have to restart everything.

    I tried doing:

    WR_REG(CoreDebug->DEMCR, CoreDebug_DEMCR_VC_CORERESET_Msk, CoreDebug_DEMCR_VC_CORERESET_Pos, 0);

    at the start of the main function, in hope that this would make the next reset not halt, but it happens all the same.

    I am testing now like this:

    C Source Code

    1. int main(){ WR_REG(CoreDebug->DEMCR, CoreDebug_DEMCR_VC_CORERESET_Msk, CoreDebug_DEMCR_VC_CORERESET_Pos, 0); SCB->AIRCR = ((0x5FA << SCB_AIRCR_VECTKEY_Pos) & SCB_AIRCR_VECTKEY_Msk) | SCB_AIRCR_SYSRESETREQ_Msk; while(1);}



    The moment it does the reset it gets stuck @ 0x08000200 which is where the reset vector points in my case. I understand this is at least not totally JLink related but can you please help me?

    Best regards,