This is an automated email from Gerrit.

Spencer Oliver ([email protected]) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/949

-- gerrit

commit 8cfa7f59dccb48c247db4220b8f11fdfadadcdec
Author: Spencer Oliver <[email protected]>
Date:   Thu Nov 1 14:37:02 2012 +0000

    target: add async algorithm timeout
    
    An issue was observed when using the new TI ICDI interface programming a
    stellaris target. If a 'reset init' was not performed before programming
    the target would get in a infinite loop within 
target_run_flash_async_algorithm.
    
    Add a timeout that will at least prevent this issue from happening.
    
    Change-Id: I5277e0d64e252d3d353e8d5bc9889a37fdc63060
    Signed-off-by: Spencer Oliver <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index b8e4c2f..0136c19 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -822,6 +822,7 @@ int target_run_flash_async_algorithm(struct target *target,
                uint32_t entry_point, uint32_t exit_point, void *arch_info)
 {
        int retval;
+       int timeout = 0;
 
        /* Set up working area. First word is write pointer, second word is 
read pointer,
         * rest is fifo data area. */
@@ -893,9 +894,19 @@ int target_run_flash_async_algorithm(struct target *target,
                         * less than buffer size / flash speed. This is very 
unlikely to
                         * run when using high latency connections such as USB. 
*/
                        alive_sleep(10);
+
+                       /* to stop an infinite loop on some targets check and 
increment a timeout
+                        * this issue was observed on a stellaris using the new 
ICDI interface */
+                       if (timeout++ >= 500) {
+                               LOG_ERROR("timeout waiting for algorithm");
+                               return ERROR_FLASH_OPERATION_FAILED;
+                       }
                        continue;
                }
 
+               /* reset our timeout */
+               timeout = 0;
+
                /* Limit to the amount of data we actually want to write */
                if (thisrun_bytes > count * block_size)
                        thisrun_bytes = count * block_size;

-- 

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to