Try the attached patch.
It should cause an error rather than running into an infinite loop.
--
Øyvind Harboe
http://www.zylin.com/zy1000.html
ARM7 ARM9 XScale Cortex
JTAG debugger and flash programmer
Index: C:/workspace/openocd/src/flash/str9x.c
===================================================================
--- C:/workspace/openocd/src/flash/str9x.c (revision 966)
+++ C:/workspace/openocd/src/flash/str9x.c (working copy)
@@ -305,8 +305,9 @@
{
return retval;
}
-
- while (1) {
+
+ int i;
+ for (i=0; i<1000; i++) {
if ((retval=target_read_u8(target, adr,
&status))!=ERROR_OK)
{
return retval;
@@ -315,6 +316,11 @@
break;
alive_sleep(1);
}
+ if (i==1000)
+ {
+ LOG_ERROR("erase timed out");
+ return ERROR_FAIL;
+ }
/* clear status, also clear read array */
if ((retval=target_write_u16(target, adr, 0x50))!=ERROR_OK)
@@ -571,8 +577,10 @@
/* get status command */
target_write_u16(target, bank_adr, 0x70);
-
- while (1) {
+
+ int i;
+ for (i=0; i<1000; i++)
+ {
target_read_u8(target, bank_adr, &status);
if( status & 0x80 )
break;
@@ -578,6 +586,11 @@
break;
alive_sleep(1);
}
+ if (i==1000)
+ {
+ LOG_ERROR("write timed out");
+ return ERROR_FAIL;
+ }
/* clear status reg and read array */
target_write_u16(target, bank_adr, 0x50);
@@ -614,7 +627,9 @@
/* query status command */
target_write_u16(target, bank_adr, 0x70);
- while (1) {
+ int i;
+ for (i=0; i<1000; i++)
+ {
target_read_u8(target, bank_adr, &status);
if( status & 0x80 )
break;
@@ -620,6 +635,11 @@
break;
alive_sleep(1);
}
+ if (i==1000)
+ {
+ LOG_ERROR("write timed out");
+ return ERROR_FAIL;
+ }
/* clear status reg and read array */
target_write_u16(target, bank_adr, 0x50);
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development