I haven't tried this patch, but perhaps it catches your case?
--
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Index: C:/workspace/openocd/src/target/arm720t.c
===================================================================
--- C:/workspace/openocd/src/target/arm720t.c (revision 940)
+++ C:/workspace/openocd/src/target/arm720t.c (working copy)
@@ -371,7 +371,9 @@
target_halt(target);
- for (i=0; i<10; i++)
+ long long then=timeval_ms();
+ int timeout;
+ while (!(timeout=((timeval_ms()-then)>1000)))
{
if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) ==
0)
{
@@ -381,10 +383,15 @@
{
break;
}
- /* do not eat all CPU, time out after 1 se*/
- alive_sleep(100);
+ if (debug_level>=3)
+ {
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
- if (i==10)
+ if (timeout)
{
LOG_ERROR("Failed to halt CPU after 1 sec");
return ERROR_TARGET_TIMEOUT;
Index: C:/workspace/openocd/src/target/arm7_9_common.c
===================================================================
--- C:/workspace/openocd/src/target/arm7_9_common.c (revision 940)
+++ C:/workspace/openocd/src/target/arm7_9_common.c (working copy)
@@ -35,6 +35,7 @@
#include "log.h"
#include "arm7_9_common.h"
#include "breakpoints.h"
+#include "time_support.h"
#include <stdlib.h>
#include <string.h>
@@ -511,7 +512,6 @@
int arm7_9_execute_sys_speed(struct target_s *target)
{
- int timeout;
int retval;
armv4_5_common_t *armv4_5 = target->arch_info;
@@ -527,7 +527,9 @@
}
arm_jtag_set_instr(jtag_info, 0x4, NULL);
- for (timeout=0; timeout<50; timeout++)
+ long long then=timeval_ms();
+ int timeout;
+ while (!(timeout=((timeval_ms()-then)>1000)))
{
/* read debug status register */
embeddedice_read_reg(dbg_stat);
@@ -536,9 +538,15 @@
if ((buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1))
&& (buf_get_u32(dbg_stat->value,
EICE_DBG_STATUS_SYSCOMP, 1)))
break;
- alive_sleep(100);
+ if (debug_level>=3)
+ {
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
- if (timeout == 50)
+ if (timeout)
{
LOG_ERROR("timeout waiting for SYSCOMP & DBGACK, last
DBG_STATUS: %x", buf_get_u32(dbg_stat->value, 0, dbg_stat->size));
return ERROR_TARGET_TIMEOUT;
@@ -881,7 +889,7 @@
if ((retval=jtag_execute_queue())!=ERROR_OK)
return retval;
/* do not eat all CPU, time out after 1 se*/
- usleep(100*1000);
+ alive_sleep(100);
}
if (i==10)
@@ -2162,7 +2170,9 @@
target_halt(target);
- for (i=0; i<100; i++)
+ long long then=timeval_ms();
+ int timeout;
+ while (!(timeout=((timeval_ms()-then)>100)))
{
target_poll(target);
if (target->state == TARGET_HALTED)
@@ -2167,9 +2177,15 @@
target_poll(target);
if (target->state == TARGET_HALTED)
break;
- usleep(1000); /* sleep 1ms */
+ if (debug_level>=3)
+ {
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
- if (i == 100)
+ if (timeout)
{
LOG_ERROR("bulk write timed out, target not halted");
return ERROR_TARGET_TIMEOUT;
Index: C:/workspace/openocd/src/target/arm920t.c
===================================================================
--- C:/workspace/openocd/src/target/arm920t.c (revision 940)
+++ C:/workspace/openocd/src/target/arm920t.c (working copy)
@@ -24,6 +24,7 @@
#include "arm920t.h"
#include "jtag.h"
#include "log.h"
+#include "time_support.h"
#include <stdlib.h>
#include <string.h>
@@ -629,11 +630,12 @@
arm9tdmi_common_t *arm9tdmi = arm7_9->arch_info;
arm920t_common_t *arm920t = arm9tdmi->arch_info;
reg_t *dbg_stat = &arm7_9->eice_cache->reg_list[EICE_DBG_STAT];
- int i;
target_halt(target);
- for (i=0; i<10; i++)
+ long long then=timeval_ms();
+ int timeout;
+ while (!(timeout=((timeval_ms()-then)>1000)))
{
if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) ==
0)
{
@@ -643,10 +645,16 @@
{
break;
}
- /* do not eat all CPU, time out after 1 se*/
- alive_sleep(100);
+ if (debug_level>=3)
+ {
+ /* do not eat all CPU, time out after 1 se*/
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
- if (i==10)
+ if (timeout)
{
LOG_ERROR("Failed to halt CPU after 1 sec");
return ERROR_TARGET_TIMEOUT;
Index: C:/workspace/openocd/src/target/arm926ejs.c
===================================================================
--- C:/workspace/openocd/src/target/arm926ejs.c (revision 940)
+++ C:/workspace/openocd/src/target/arm926ejs.c (working copy)
@@ -24,6 +24,7 @@
#include "arm926ejs.h"
#include "jtag.h"
#include "log.h"
+#include "time_support.h"
#include <stdlib.h>
#include <string.h>
@@ -583,7 +584,9 @@
target_halt(target);
- for (i=0; i<10; i++)
+ long long then=timeval_ms();
+ int timeout;
+ while (!(timeout=((timeval_ms()-then)>1000)))
{
if (buf_get_u32(dbg_stat->value, EICE_DBG_STATUS_DBGACK, 1) ==
0)
{
@@ -593,8 +596,14 @@
{
break;
}
- /* do not eat all CPU, time out after 1 se*/
- alive_sleep(100);
+ if (debug_level>=1)
+ {
+ /* do not eat all CPU, time out after 1 se*/
+ alive_sleep(100);
+ } else
+ {
+ keep_alive();
+ }
}
if (i==10)
{
Index: C:/workspace/openocd/src/target/xscale.c
===================================================================
--- C:/workspace/openocd/src/target/xscale.c (revision 937)
+++ C:/workspace/openocd/src/target/xscale.c (working copy)
@@ -519,7 +519,10 @@
if (debug_level>=3)
{
LOG_DEBUG("waiting 10ms");
- usleep(10*1000); /* avoid flooding the logs */
+ alive_sleep(10); /* avoid flooding the logs */
+ } else
+ {
+ keep_alive();
}
}
done:
@@ -603,7 +606,10 @@
if (debug_level>=3)
{
LOG_DEBUG("waiting 10ms");
- usleep(10*1000); /* avoid flooding the logs */
+ alive_sleep(10); /* avoid flooding the logs */
+ } else
+ {
+ keep_alive();
}
}
done:
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development