[SOLVED] Unlimited Flash Breakpoints can cause cortex-m3 HardFault?

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

  • [SOLVED] Unlimited Flash Breakpoints can cause cortex-m3 HardFault?

    Hello,

    I would like to verify my thoughts about the Unlimited Flash Breakpoints functionality and Cortex-m3. As far as I know the UFB replaces the instructions in code memory by a some kind of BPKT instruction in case all hw breakpoints are consumed. The replaced instruction is then somehow "emulated", e.g. mov r1, r0 the jlink moves content of r0 to r1 using the debug read/write register sequence.

    Here comes the problem. If the internal flash of MCU is modified and the jlink is disconnected during debug session from its usb cable the BPKT instruction will remain in flash. Next time (e.g. after reset), now running without the jlink - the firmware is already inside, the BPKT is executed with C_DEBUGEN = 0 what should escalate to HardFault [Yiu J., The Definitive Guide ..... Figure: Debug events for halt mode debugging.]

    Am I right?


    BR
    Martin

    P.S.
    Please do not reply with: You should never unplug the cable during debug session. I know it and I am not doing it.
  • Hello Martin,

    Your assumption is correct.

    Here comes the problem.

    I do not understand why this is a problem, it is expected behavior.


    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.