I’ve narrowed it down (I think) to a multiple bugs in cortex_m3.c. I’ll write up what I think is happening and send it to the list in a day or two. I didn’t read the code enough to grok the whole thing but here’s what I think is going on.
bug 1) cortex_m3_assert_reset() called cortex_m3_clear_halt(), which contrary to its name, doesn’t clear the halt flag, but instead sets C_HALT.
bug 2) cortex_m3_poll() does an atomic read on DCB_DHCSR, checks if the target is resetting, and then calls cortex_m3_endreset_event(), which should reset the DHCSR to its reset state. Unfortunately, the atomic read which checks that state is called before endreset_event(), so when it checks (dcb_dhcsr & S_HALT), it’s using the old value of DHCSR, then halts the target, leaving you right back where you started (halted).
Making assert_reset() actually clear C_HALT and adding another read in poll() fixed the problem for me.
To the previous post, I did try reset run as well. According to the manual, a reset with a parameter is the same as reset run.
Looks like you are narrowing it down. The same code works with the LPC2148 family of ARM processors. (With changes to the JTAG details of course). It runs without halting.
I’ve been using the precompiled Open OCD 0.1.0 Windows installer. I’m sure I could get the SVN code to compile, but at some point you have to do real work, rather than build tool sets.
Thanks for all your effort. Let me know if there is anything i can do to help.
I have no idea if this is even a bug or if I this is completely wrong since I can’t seem to get a hold of any openocd devs, but it seems to solve the problem for me, so it might help you.
Strong work! That corrected the problem. Building openocd wasn’t too painful. The “How to build OpenOCD for windows” Sticky posting has good instructions.
Having the Windows installer is nice. Does anyone know if the patch will get applied and the installer updated?