[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openocd-development
Subject:    [PATCH]: 774365a67a openocd: prevent target polling during 'init'
From:       gerrit () openocd ! org
Date:       2022-05-30 13:50:46
Message-ID: 20220530135046.A8204122 () openocd ! org
[Download RAW message or body]

This is an automated email from Gerrit.

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

-- gerrit

commit 774365a67a1b027dec9ab6683535a62a2f7facd2
Author: Antonio Borneo <borneo.antonio@gmail.com>
Date:   Mon May 30 15:32:24 2022 +0200

    openocd: prevent target polling during 'init'
    
    The command 'init' causes the execution of few lower level
    commands, e.g. 'target init', and switches from command mode
    COMMAND_CONFIG to COMMAND_EXEC, with an intermediate switch back
    to mode COMMAND_CONFIG.
    
    A timed target polling can occur during the execution of 'init'
    and the target's status can trigger the execution of some events.
    E.g. if a target has been left halted by a previous execution of
    OpenOCD, the first poll will find the target halted, calling the
    corresponding 'halted' event.
    The event handler can use commands that can only be executed in
    mode COMMAND_EXEC. If the poll happens while OpenOCD is in mode
    COMMAND_CONFIG, the triggered handler will fail.
    
    Prevent the target polling to operate during the execution of the
    'init' command.
    
    Change-Id: Ia435a5d2039be9b247e2336616dab53ed5d983ac
    Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>

diff --git a/src/openocd.c b/src/openocd.c
index fdc4a874b6..f57fee0fba 100644
--- a/src/openocd.c
+++ b/src/openocd.c
@@ -130,6 +130,9 @@ COMMAND_HANDLER(handle_init_command)
 
 	initialized = 1;
 
+	bool save_poll = jtag_poll_get_enabled();
+	jtag_poll_set_enabled(false);
+
 	retval = command_run_line(CMD_CTX, "target init");
 	if (retval != ERROR_OK)
 		return ERROR_FAIL;
@@ -177,6 +180,8 @@ COMMAND_HANDLER(handle_init_command)
 	if (command_run_line(CMD_CTX, "tpiu init") != ERROR_OK)
 		return ERROR_FAIL;
 
+	jtag_poll_set_enabled(save_poll);
+
 	/* initialize telnet subsystem */
 	gdb_target_add_all(all_targets);
 

-- 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic