This is an automated email from Gerrit.

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

-- gerrit

commit 11f02907cb10aebf98c37b036de11cd68ddcf03c
Author: Tomas Vanek <[email protected]>
Date:   Sat Nov 4 15:18:16 2017 +0100

    target: fix poll/re-examine logic
    
    When a target is unreponsive handle_target() increases backoff.times.
    If user issues a reset or other command and communication with the target
    is reestablished, backoff.times still holds a nonzero value.
    After a prolonged poll interval (up to 6 sec) handle_target() scares
    the user by a message "Polling target failed, trying to reexamine"
    and starts an useless examine.
    
    Zero backoff.times on any sucessful from poll.
    
    Change-Id: I0698fb3573e5afb61671dcfb502f3cb61dd48ed7
    Signed-off-by: Tomas Vanek <[email protected]>

diff --git a/src/target/target.c b/src/target/target.c
index 36318d8..18931ff 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -536,6 +536,8 @@ int target_poll(struct target *target)
        if (retval != ERROR_OK)
                return retval;
 
+       target->backoff.times = 0;
+
        if (target->halt_issued) {
                if (target->state == TARGET_HALTED)
                        target->halt_issued = false;
@@ -2680,6 +2682,7 @@ static int handle_target(void *priv)
                if (!powerDropout && !srstAsserted) {
                        /* polling may fail silently until the target has been 
examined */
                        retval = target_poll(target);
+                       /* any successful poll resets backoff.times */
                        if (retval != ERROR_OK) {
                                /* 100ms polling interval. Increase interval 
between polling up to 5000ms */
                                if (target->backoff.times * polling_interval < 
5000) {
@@ -5123,6 +5126,9 @@ static int jim_target_poll(Jim_Interp *interp, int argc, 
Jim_Obj *const *argv)
                e = target->type->poll(target);
        if (e != ERROR_OK)
                return JIM_ERR;
+
+       target->backoff.times = 0;
+
        return JIM_OK;
 }
 

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to