This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/8293

-- gerrit

commit a7983d35b3087b8d2f50427f1a1f3af418cbefdc
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Mon Apr 8 17:42:52 2024 +0200

    target: reset examine after assert_reset
    
    For some target, the API assert_reset() checks if the target has
    been examined, with target_was_examined(), to perform conditional
    operations like:
    - assert adapter's srst;
    - write some register to catch the reset vector;
    - invalidate the register cache.
    
    Targets created with -defer-examine gets the examine flag reset
    right before entering in their assert_reset(), disrupting the
    actions above.
    
    For targets created with -defer-examine, move the reset examine
    after the assert_reset().
    
    Change-Id: If96e7876dcace8905165115292deb93a3e45cb36
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/target.c b/src/target/target.c
index 5168305dee..243f077800 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5365,17 +5365,19 @@ COMMAND_HANDLER(handle_target_reset)
                return ERROR_FAIL;
        }
 
-       if (target->defer_examine)
-               target_reset_examined(target);
-
        /* determine if we should halt or not. */
        target->reset_halt = (a != 0);
        /* When this happens - all workareas are invalid. */
        target_free_all_working_areas_restore(target, 0);
 
        /* do the assert */
-       if (n->value == NVP_ASSERT)
-               return target->type->assert_reset(target);
+       if (n->value == NVP_ASSERT) {
+               int retval = target->type->assert_reset(target);
+               if (target->defer_examine)
+                       target_reset_examined(target);
+               return retval;
+       }
+
        return target->type->deassert_reset(target);
 }
 

-- 

Reply via email to