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.
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.