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/+/8176

-- gerrit

commit 894dae1b54c9c581a5d08b44af40dd9a8d45c58a
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Fri Mar 15 15:10:13 2024 +0100

    target: do not reset targets with -defer-examine flag
    
    For target flag '-defer-examine', OpenOCD documentation states:
            skip target examination at initial JTAG chain scan and
            after a scan and after a reset. A manual call to
            arp_examine is required to access the target for debugging
    
    As targets with flag '-defer-examine' will not be examined after a
    reset, there is no need for halting it or interacting with it when
    reset gets asserted.
    
    On targets with flag '-defer-examine', skip the execution of the
    callbacks assert_reset() and deassert_reset().
    
    Run target_free_all_working_areas_restore() before skip, because
    the target would probably not be examined after the reset and the
    workareas would risk to never be restored otherwise.
    
    Change-Id: I44f7b1074e82d24300e85cac158e32e19eb71141
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/target/target.c b/src/target/target.c
index 45698a66c5..3454dcebea 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -5365,13 +5365,17 @@ COMMAND_HANDLER(handle_target_reset)
                return ERROR_FAIL;
        }
 
-       if (target->defer_examine)
+       /* When this happens - all workareas are invalid. */
+       target_free_all_working_areas_restore(target, 0);
+
+       if (target->defer_examine) {
                target_reset_examined(target);
+               LOG_TARGET_DEBUG(target, "arp_reset: ignore due to 
defer-examine");
+               return ERROR_OK;
+       }
 
        /* 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)

-- 

Reply via email to