jtag: replace command "jtag_reset" with "adapter [de]assert" 86/5286/3
authorAntonio Borneo <borneo.antonio@gmail.com>
Wed, 14 Aug 2019 12:51:06 +0000 (14:51 +0200)
committerTomas Vanek <vanekt@fbl.cz>
Thu, 2 Jan 2020 21:24:38 +0000 (21:24 +0000)
Replace the JTAG transport specific command with a more generic
one. Deprecate "jtag_reset" and update the documentation.
While there, fix an error in the documentation, where the command
"jtag_reset" was used in place of command "reset_config".

Change-Id: I41a988d37ce69f7b35a960cbaf5306aab0299b99
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/5286
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
doc/openocd.texi
src/jtag/startup.tcl
src/jtag/tcl.c

index 349998b3599074b47f90b69c3946fdb2a00e7561..5da0f806b9024d9006e8000fec892d4695ae8f2e 100644 (file)
@@ -3599,7 +3599,8 @@ the @command{reset_config} mechanism doesn't address;
 or asserting both might trigger a stronger reset, which
 needs special attention.
 
-Experiment with lower level operations, such as @command{jtag_reset}
+Experiment with lower level operations, such as
+@command{adapter assert}, @command{adapter deassert}
 and the @command{jtag arp_*} operations shown here,
 to find a sequence of operations that works.
 @xref{JTAG Commands}.
@@ -3626,7 +3627,7 @@ or potentially some other value.
 
 The default implementation just invokes @command{jtag arp_init-reset}.
 Replacements will normally build on low level JTAG
-operations such as @command{jtag_reset}.
+operations such as @command{adapter assert} and @command{adapter deassert}.
 Operations here must not address individual TAPs
 (or their associated targets)
 until the JTAG scan chain has first been verified to work.
@@ -6984,7 +6985,7 @@ configured for flash bank 0.
 @example
 # assert srst, we do not want core running
 # while accessing str9xpec flash driver
-jtag_reset 0 1
+adapter assert srst
 # turn off target polling
 poll off
 # disable str9 core
@@ -7885,6 +7886,36 @@ the code that was executed may have left the hardware in an unknown
 state.
 @end deffn
 
+@deffn Command {adapter assert} [signal [assert|deassert signal]]
+@deffnx Command {adapter deassert} [signal [assert|deassert signal]]
+Set values of reset signals.
+Without parameters returns current status of the signals.
+The @var{signal} parameter values may be
+@option{srst}, indicating that srst signal is to be asserted or deasserted,
+@option{trst}, indicating that trst signal is to be asserted or deasserted.
+
+The @command{reset_config} command should already have been used
+to configure how the board and the adapter treat these two
+signals, and to say if either signal is even present.
+@xref{Reset Configuration}.
+Trying to assert a signal that is not present triggers an error.
+If a signal is present on the adapter and not specified in the command,
+the signal will not be modified.
+
+@quotation Note
+TRST is specially handled.
+It actually signifies JTAG's @sc{reset} state.
+So if the board doesn't support the optional TRST signal,
+or it doesn't support it along with the specified SRST value,
+JTAG reset is triggered with TMS and TCK signals
+instead of the TRST signal.
+And no matter how that JTAG reset is triggered, once
+the scan chain enters @sc{reset} with TRST inactive,
+TAP @code{post-reset} events are delivered to all TAPs
+with handlers for that event.
+@end quotation
+@end deffn
+
 @section I/O Utilities
 
 These commands are available when
@@ -9767,28 +9798,6 @@ portable scripts currently must issue only BYPASS instructions.
 @end quotation
 @end deffn
 
-@deffn Command {jtag_reset} trst srst
-Set values of reset signals.
-The @var{trst} and @var{srst} parameter values may be
-@option{0}, indicating that reset is inactive (pulled or driven high),
-or @option{1}, indicating it is active (pulled or driven low).
-The @command{reset_config} command should already have been used
-to configure how the board and JTAG adapter treat these two
-signals, and to say if either signal is even present.
-@xref{Reset Configuration}.
-
-Note that TRST is specially handled.
-It actually signifies JTAG's @sc{reset} state.
-So if the board doesn't support the optional TRST signal,
-or it doesn't support it along with the specified SRST value,
-JTAG reset is triggered with TMS and TCK signals
-instead of the TRST signal.
-And no matter how that JTAG reset is triggered, once
-the scan chain enters @sc{reset} with TRST inactive,
-TAP @code{post-reset} events are delivered to all TAPs
-with handlers for that event.
-@end deffn
-
 @deffn Command {pathmove} start_state [next_state ...]
 Start by moving to @var{start_state}, which
 must be one of the @emph{stable} states.
@@ -10756,7 +10765,7 @@ bytes. Painful...
 "Warning: arm7_9_common.c:679 arm7_9_assert_reset(): srst resets test logic, too".
 
 This warning doesn't indicate any serious problem, as long as you don't want to
-debug your core right out of reset. Your .cfg file specified @option{jtag_reset
+debug your core right out of reset. Your .cfg file specified @option{reset_config
 trst_and_srst srst_pulls_trst} to tell OpenOCD that either your board,
 your debugger or your target uC (e.g. LPC2000) can't assert the two reset signals
 independently. With this setup, it's not possible to halt the core right out of
index d57cafb23aa18bde0c84f1830d156903acb79e50..3551521360fb9da9702b1b9e31b38c818779c295 100644 (file)
@@ -134,6 +134,22 @@ proc jtag_nsrst_assert_width args {
        eval adapter_nsrst_assert_width $args
 }
 
+proc jtag_reset args {
+       echo "DEPRECATED! use 'adapter [de]assert' not 'jtag_reset'"
+       switch $args {
+               "0 0"
+                       {eval adapter deassert trst deassert srst}
+               "0 1"
+                       {eval adapter deassert trst assert srst}
+               "1 0"
+                       {eval adapter assert trst deassert srst}
+               "1 1"
+                       {eval adapter assert trst assert srst}
+               default
+                       {return -code 1 -level 1 "jtag_reset: syntax error"}
+       }
+}
+
 # stlink migration helpers
 proc stlink_device_desc args {
        echo "DEPRECATED! use 'hla_device_desc' not 'stlink_device_desc'"
index cbdf2adfc09040dcdf689255b643baf207141217..ef0cd3f53e014350ca5609c9526d32cedaba7781 100644 (file)
@@ -1059,34 +1059,6 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
        return retval;
 }
 
-COMMAND_HANDLER(handle_jtag_reset_command)
-{
-       if (CMD_ARGC != 2)
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       int trst = -1;
-       if (CMD_ARGV[0][0] == '1')
-               trst = 1;
-       else if (CMD_ARGV[0][0] == '0')
-               trst = 0;
-       else
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       int srst = -1;
-       if (CMD_ARGV[1][0] == '1')
-               srst = 1;
-       else if (CMD_ARGV[1][0] == '0')
-               srst = 0;
-       else
-               return ERROR_COMMAND_SYNTAX_ERROR;
-
-       if (adapter_init(CMD_CTX) != ERROR_OK)
-               return ERROR_JTAG_INIT_FAILED;
-
-       jtag_add_reset(trst, srst);
-       return jtag_execute_queue();
-}
-
 COMMAND_HANDLER(handle_runtest_command)
 {
        if (CMD_ARGC != 1)
@@ -1331,14 +1303,6 @@ static const struct command_registration jtag_command_handlers[] = {
                .help = "print current scan chain configuration",
                .usage = ""
        },
-       {
-               .name = "jtag_reset",
-               .handler = handle_jtag_reset_command,
-               .mode = COMMAND_EXEC,
-               .help = "Set reset line values.  Value '1' is active, "
-                       "value '0' is inactive.",
-               .usage = "trst_active srst_active",
-       },
        {
                .name = "runtest",
                .handler = handle_runtest_command,

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)