2007-07-08 Shaun Jackman
* src/jtag2bp.cc (layoutBreakpoints) : Bug fix.
GDB continue command would hang when using debugWire.
* src/jtag2io.cc (recvFrame): Correctly report a timeout.
* src/jtag2run.cc (resetProgram): The JTAG ICE mkII and Dragon
do not respond correctly to the CMND_RESET command while in
debugWire mode. Send CMND_FORCED_STOP and CMND_WRITE_PC(0)
instead.
Index: src/jtag2bp.cc
===================================================================
RCS file: /cvsroot/avarice/avarice/src/jtag2bp.cc,v
retrieving revision 1.7
diff -u -p -r1.7 jtag2bp.cc
--- src/jtag2bp.cc 21 Feb 2007 20:57:47 -0000 1.7
+++ src/jtag2bp.cc 8 Jul 2007 16:50:54 -0000
@@ -401,7 +401,7 @@ bool jtag2::layoutBreakpoints(void)
if (useDebugWire)
{
int k;
- while (k < (MAX_BREAKPOINTS2 + 1))
+ for (k = 1; k < MAX_BREAKPOINTS2 + 1; k++)
{
remaining_bps[k] = false;
}
Index: src/jtag2io.cc
===================================================================
RCS file: /cvsroot/avarice/avarice/src/jtag2io.cc,v
retrieving revision 1.11
diff -u -p -r1.11 jtag2io.cc
--- src/jtag2io.cc 17 Feb 2007 22:41:46 -0000 1.11
+++ src/jtag2io.cc 8 Jul 2007 16:50:54 -0000
@@ -141,10 +141,12 @@ int jtag2::recvFrame(unsigned char *&msg
break;
} else {
rv = timeout_read(&c, 1, JTAG_RESPONSE_TIMEOUT);
- debugOut("recv: 0x%02x\n", c);
- if (rv == 0)
+ if (rv == 0) {
/* timeout */
+ debugOut("recv: timeout\n");
break;
+ }
+ debugOut("recv: 0x%02x\n", c);
}
checksum ^= c;
Index: src/jtag2run.cc
===================================================================
RCS file: /cvsroot/avarice/avarice/src/jtag2run.cc,v
retrieving revision 1.7
diff -u -p -r1.7 jtag2run.cc
--- src/jtag2run.cc 17 Feb 2007 22:41:46 -0000 1.7
+++ src/jtag2run.cc 8 Jul 2007 16:50:54 -0000
@@ -74,14 +74,21 @@ bool jtag2::setProgramCounter(unsigned l
bool jtag2::resetProgram(void)
{
- uchar cmd[2] = { CMND_RESET, 0x01 };
- uchar *resp;
- int respSize;
+ if (useDebugWire) {
+ /* The JTAG ICE mkII and Dragon do not respond correctly to
+ * the CMND_RESET command while in debugWire mode. */
+ return interruptProgram()
+ && setProgramCounter(0);
+ } else {
+ uchar cmd[2] = { CMND_RESET, 0x01 };
+ uchar *resp;
+ int respSize;
- bool rv = doJtagCommand(cmd, 2, resp, respSize);
- delete [] resp;
+ bool rv = doJtagCommand(cmd, 2, resp, respSize);
+ delete [] resp;
- return rv;
+ return rv;
+ }
}
bool jtag2::interruptProgram(void)