arm11: fix another infinite loop bug
authorØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 10 Feb 2010 19:04:00 +0000 (20:04 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 10 Feb 2010 21:54:06 +0000 (22:54 +0100)
reset init would get stuck in an infinite loop when
e.g. khz was too high. Added timeout. This is a copy
of paste of a number of such bugfixes in the arm11
code.

Arm11 code reviewed for further such infinite loop bugs
and I couldn't find any more. Xing fingers it's the last
one...

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
src/target/arm11_dbgtap.c

index 088981f8ba882e6979f424c9c20815a0ab812ee4..6d132a797a33606741aae28b982d9f7059cbe8ab 100644 (file)
@@ -854,7 +854,9 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions
                        AddressOut      = 0;
                }
 
-               do
+               /* Timeout here so we don't get stuck. */
+               int i = 0;
+               while (1)
                {
                        JTAG_DEBUG("SC7 <= c%-3d Data %08x %s",
                                        (unsigned) AddressOut,
@@ -866,10 +868,27 @@ int arm11_sc7_run(struct arm11_common * arm11, struct arm11_sc7_action * actions
 
                        CHECK_RETVAL(jtag_execute_queue());
 
-                       if (!Ready)
-                               JTAG_DEBUG("SC7 => !ready");
+                       /* 'nRW' is 'Ready' on read out */
+                       if (Ready)
+                               break;
+
+                       long long then = 0;
+
+                       if (i == 1000)
+                       {
+                               then = timeval_ms();
+                       }
+                       if (i >= 1000)
+                       {
+                               if ((timeval_ms()-then) > 1000)
+                               {
+                                       LOG_WARNING("Timeout (1000ms) waiting for instructions to complete");
+                                       return ERROR_FAIL;
+                               }
+                       }
+
+                       i++;
                }
-               while (!Ready); /* 'nRW' is 'Ready' on read out */
 
                if (!nRW)
                        JTAG_DEBUG("SC7 => Data %08x", (unsigned) DataIn);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)