[SOLVED] Which registers are "magically" modified by J-Link during debugging?

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

  • [SOLVED] Which registers are "magically" modified by J-Link during debugging?

    Hello,

    I'm debugging an STM32F407 using a JLink and Ozone. I discovered that the JLink modifies registers in the STM32 that are not necessarily needed for Debugging code over SWD e.g.: DBGMCU_APB1_FZ. The JLink modifies e.g. the setting of the control bit that controls that the watchdog is frozen whenever the CPU is not running. This is indeed desirable behavior during most debugging. However, for me this is really inconvenient as I need manually need to reset this bit to its default value either in the application code on the STM or via the debugger.

    I haven't found anything in a configuration file. I assume this behavior is burried somewhere internally in the STM32F4 device implementation.
    Ideally I would like to control this behavior but if it's not possible a list of things the JLink touches would be great.
  • Hi,
    Do you need to reset these bits during debugging?
    If so, could you please explain why you would require this?

    Or do you mean that the bits are not reset after the debug session ends?
    If so, we changed the behavior a while ago so that these bits are reset after debug session end automatically.
    As this is not the case for your setup, I suspect that you are using an outdated version of the J-Link Software.

    Does it work as expected when you update to the latest version?
    segger.com/downloads/jlink#J-L…twareAndDocumentationPack

    BR
    Fabian
    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.
  • SEGGER - Fabian wrote:

    Do you need to reset these bits during debugging?
    If so, could you please explain why you would require this?
    Our software checks several configuration registers using CRC checksums. Patching this stuff out too much work for every debugging session. I'm fully aware that any breakpoint will cause the watchdog to trigger but I just want these configuration registers to remain at reset state. Is there any list of what is touched? Otherwise I probably have to use a different debugger.
  • Hi,
    To prevent any device specific handling, you can override it with the script file here:
    wiki.segger.com/J-Link_script_…g_device_specific_connect

    This should prevent the DBG_MCU registers from being written during the debug session.

    Additionally, you would have to add an "OnDisconnectTarget()" routine to the script file, which also does nothing except for returning 0,
    the same way as it is done with InitTarget().
    wiki.segger.com/J-Link_script_files#OnDisconnectTarget.28.29
    This will skip the reset of the registers on disconnect.

    Best regards,
    Fabian
    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.