This should allow most of the existing configurations for older
versions to remain compatible without forcing the user to change his
or her config to explicitly select transport.
Also in some circumstances can remove the need to chain a "-c transport
select X" when building custom configs on the command line, which seems
like a common new user pitfall.
Change-Id: Ic87a38c0b9b88e88fb6d106385efce2f39381d3d
Suggested-by: Petteri Aimonen <jpa@git.mail.kapsi.fi>
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/2551
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
@end quotation
@end deffn
@end quotation
@end deffn
@deffn {Interface Driver} {hla}
This is a driver that supports multiple High Level Adapters.
This type of adapter does not expose some of the lower level api's
@deffn {Interface Driver} {hla}
This is a driver that supports multiple High Level Adapters.
This type of adapter does not expose some of the lower level api's
version of OpenOCD.
@end deffn
version of OpenOCD.
@end deffn
-@deffn Command {transport select} transport_name
+@deffn Command {transport select} @option{transport_name}
Select which of the supported transports to use in this OpenOCD session.
Select which of the supported transports to use in this OpenOCD session.
-The transport must be supported by the debug adapter hardware and by the
-version of OpenOCD you are using (including the adapter's driver).
-No arguments: returns name of session's selected transport.
+
+When invoked with @option{transport_name}, attempts to select the named
+transport. The transport must be supported by the debug adapter
+hardware and by the version of OpenOCD you are using (including the
+adapter's driver).
+
+If no transport has been selected and no @option{transport_name} is
+provided, @command{transport select} auto-selects the first transport
+supported by the debug adapter.
+
+@command{transport select} always returns the name of the session's selected
+transport, if any.
@end deffn
@subsection JTAG Transport
@end deffn
@subsection JTAG Transport
each of which must be explicitly declared.
JTAG supports both debugging and boundary scan testing.
Flash programming support is built on top of debug support.
each of which must be explicitly declared.
JTAG supports both debugging and boundary scan testing.
Flash programming support is built on top of debug support.
+
+JTAG transport is selected with the command @command{transport select
+jtag}. Unless your adapter uses @ref{hla_interface,the hla interface
+driver}, in which case the command is @command{transport select
+hla_jtag}.
+
@subsection SWD Transport
@cindex SWD
@cindex Serial Wire Debug
@subsection SWD Transport
@cindex SWD
@cindex Serial Wire Debug
SWD is debug-oriented, and does not support boundary scan testing.
Flash programming support is built on top of debug support.
(Some processors support both JTAG and SWD.)
SWD is debug-oriented, and does not support boundary scan testing.
Flash programming support is built on top of debug support.
(Some processors support both JTAG and SWD.)
+
+SWD transport is selected with the command @command{transport select
+swd}. Unless your adapter uses @ref{hla_interface,the hla interface
+driver}, in which case the command is @command{transport select
+hla_swd}.
+
@deffn Command {swd newdap} ...
Declares a single DAP which uses SWD transport.
Parameters are currently the same as "jtag newtap" but this is
@deffn Command {swd newdap} ...
Declares a single DAP which uses SWD transport.
Parameters are currently the same as "jtag newtap" but this is
No parameters: displays current settings.
@end deffn
No parameters: displays current settings.
@end deffn
-@subsection CMSIS-DAP Transport
-@cindex CMSIS-DAP
-CMSIS-DAP is an ARM-specific transport that is used to connect to
-compilant debuggers.
-
@subsection SPI Transport
@cindex SPI
@cindex Serial Peripheral Interface
@subsection SPI Transport
@cindex SPI
@cindex Serial Peripheral Interface
*/
static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{
*/
static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *argv)
{
- case 1: /* return/display */
+ case 1: /* autoselect if necessary, then return/display current config */
- LOG_ERROR("session transport was not selected. Use 'transport select <transport>'");
- return JIM_ERR;
- } else {
- Jim_SetResultString(interp, session->name, -1);
- return JIM_OK;
+ if (!allowed_transports) {
+ LOG_ERROR("Debug adapter does not support any transports? Check config file order.");
+ return JIM_ERR;
+ }
+ LOG_INFO("auto-selecting first available session transport \"%s\". "
+ "To override use 'transport select <transport>'.", allowed_transports[0]);
+ res = transport_select(global_cmd_ctx, allowed_transports[0]);
+ if (res != JIM_OK)
+ return res;
+ Jim_SetResultString(interp, session->name, -1);
+ return JIM_OK;
if (session) {
if (!strcmp(session->name, argv[1]->bytes)) {
LOG_WARNING("Transport \"%s\" was already selected", session->name);
if (session) {
if (!strcmp(session->name, argv[1]->bytes)) {
LOG_WARNING("Transport \"%s\" was already selected", session->name);
+ Jim_SetResultString(interp, session->name, -1);
return JIM_OK;
} else {
LOG_ERROR("Can't change session's transport after the initial selection was made");
return JIM_OK;
} else {
LOG_ERROR("Can't change session's transport after the initial selection was made");
for (unsigned i = 0; allowed_transports[i]; i++) {
for (unsigned i = 0; allowed_transports[i]; i++) {
- if (strcmp(allowed_transports[i], argv[1]->bytes) == 0)
- return transport_select(global_cmd_ctx, argv[1]->bytes);
+ if (strcmp(allowed_transports[i], argv[1]->bytes) == 0) {
+ if (transport_select(global_cmd_ctx, argv[1]->bytes) == ERROR_OK) {
+ Jim_SetResultString(interp, session->name, -1);
+ return JIM_OK;
+ }
+ return JIM_ERR;
+ }
}
LOG_ERROR("Debug adapter doesn't support '%s' transport", argv[1]->bytes);
}
LOG_ERROR("Debug adapter doesn't support '%s' transport", argv[1]->bytes);
# them more uniformly irlen too...)
if [catch {transport select}] {
# them more uniformly irlen too...)
if [catch {transport select}] {
- echo "Info : session transport was not selected, defaulting to JTAG"
- transport select jtag
+ echo "Error: unable to select a session transport. Can't continue."
+ shutdown
}
proc swj_newdap {chip tag args} {
}
proc swj_newdap {chip tag args} {
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)