Try the attached patch.
It invokes keep_alive() every 500ms when sleeping.
--
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Index: C:/workspace/openocd/src/jtag/jtag.c
===================================================================
--- C:/workspace/openocd/src/jtag/jtag.c (revision 937)
+++ C:/workspace/openocd/src/jtag/jtag.c (working copy)
@@ -1311,7 +1311,7 @@
void jtag_sleep(u32 us)
{
- usleep(us);
+ alive_sleep(us/1000);
}
/* Try to examine chain layout according to IEEE 1149.1 §12
@@ -1364,9 +1364,8 @@
if ((idcode & 1) == 0)
{
/* LSB must not be 0, this indicates a device in bypass
*/
- device_count++;
-
- LOG_WARNING("Device was in bypass after TRST/TMS
reset");
+ LOG_WARNING("Device does not have IDCODE");
+ idcode=0;
bit_count += 1;
}
@@ -1403,13 +1402,6 @@
break;
}
- if (device)
- {
- device->idcode = idcode;
- device = device->next;
- }
- device_count++;
-
manufacturer = (idcode & 0xffe) >> 1;
part = (idcode & 0xffff000) >> 12;
version = (idcode & 0xf0000000) >> 28;
@@ -1419,6 +1411,12 @@
bit_count += 32;
}
+ if (device)
+ {
+ device->idcode = idcode;
+ device = device->next;
+ }
+ device_count++;
}
/* see if number of discovered devices matches configuration */
@@ -1591,7 +1589,7 @@
LOG_ERROR("Could not validate JTAG chain");
return ERROR_JTAG_INVALID_INTERFACE;
}
- usleep(10000);
+ alive_sleep(10);
}
return ERROR_OK;
Index: C:/workspace/openocd/src/target/arm720t.c
===================================================================
--- C:/workspace/openocd/src/target/arm720t.c (revision 937)
+++ C:/workspace/openocd/src/target/arm720t.c (working copy)
@@ -382,7 +382,7 @@
break;
}
/* do not eat all CPU, time out after 1 se*/
- usleep(100*1000);
+ alive_sleep(100);
}
if (i==10)
{
Index: C:/workspace/openocd/src/target/arm7_9_common.c
===================================================================
--- C:/workspace/openocd/src/target/arm7_9_common.c (revision 937)
+++ C:/workspace/openocd/src/target/arm7_9_common.c (working copy)
@@ -536,7 +536,7 @@
if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1))
&& (buf_get_u32(dbg_stat->value,
EICE_DBG_STATUS_SYSCOMP, 1)))
break;
- usleep(100000);
+ alive_sleep(100);
}
if (timeout == 50)
{
Index: C:/workspace/openocd/src/target/arm920t.c
===================================================================
--- C:/workspace/openocd/src/target/arm920t.c (revision 937)
+++ C:/workspace/openocd/src/target/arm920t.c (working copy)
@@ -644,7 +644,7 @@
break;
}
/* do not eat all CPU, time out after 1 se*/
- usleep(100*1000);
+ alive_sleep(100);
}
if (i==10)
{
Index: C:/workspace/openocd/src/target/arm926ejs.c
===================================================================
--- C:/workspace/openocd/src/target/arm926ejs.c (revision 937)
+++ C:/workspace/openocd/src/target/arm926ejs.c (working copy)
@@ -594,7 +594,7 @@
break;
}
/* do not eat all CPU, time out after 1 se*/
- usleep(100*1000);
+ alive_sleep(100);
}
if (i==10)
{
Index: C:/workspace/openocd/src/target/armv4_5.c
===================================================================
--- C:/workspace/openocd/src/target/armv4_5.c (revision 937)
+++ C:/workspace/openocd/src/target/armv4_5.c (working copy)
@@ -556,7 +556,7 @@
while (target->state != TARGET_HALTED)
{
- usleep(10000);
+ alive_sleep(10);
target_poll(target);
if ((timeout_ms -= 10) <= 0)
{
@@ -565,7 +565,7 @@
timeout_ms = 1000;
while (target->state != TARGET_HALTED)
{
- usleep(10000);
+ alive_sleep(10);
target_poll(target);
if ((timeout_ms -= 10) <= 0)
{
Index: C:/workspace/openocd/src/target/target.c
===================================================================
--- C:/workspace/openocd/src/target/target.c (revision 937)
+++ C:/workspace/openocd/src/target/target.c (working copy)
@@ -2505,7 +2505,7 @@
samples[numSamples++]=t;
retval = target_resume(target, 1, 0, 0, 0); /* current
pc, addr = 0, do not handle breakpoints, not debugging */
target_poll(target);
- usleep(10*1000); // sleep 10ms, i.e. <100
samples/second.
+ alive_sleep(10); // sleep 10ms, i.e. <100
samples/second.
} else if (target->state == TARGET_RUNNING)
{
// We want to quickly sample the PC.
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development