2 * Copyright (C) 2019, STMicroelectronics - All Rights Reserved
3 * Author(s): Antonio Borneo <borneo.antonio@gmail.com> for STMicroelectronics
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 * Utilities to support in-circuit debuggers that provide APIs to access
22 * directly ARM DAP, hiding the access to the underlining transport used
23 * for the physical connection (either JTAG or SWD).
24 * E.g. STMicroelectronics ST-Link/V2 (from version V2J24) and STLINK-V3.
26 * Single-DAP support only.
28 * For details, see "ARM IHI 0031A"
29 * ARM Debug Interface v5 Architecture Specification
31 * FIXME: in JTAG mode, trst is not managed
38 #include <jtag/interface.h>
40 #include <transport/transport.h>
42 COMMAND_HANDLER(dapdirect_jtag_empty_command
)
44 LOG_DEBUG("dapdirect_jtag_empty_command(\"%s\")", CMD_NAME
);
49 COMMAND_HANDLER(dapdirect_jtag_reset_command
)
51 enum reset_types jtag_reset_config
= jtag_get_reset_config();
54 * in case the adapter has not already handled asserting srst
55 * we will attempt it again
57 if (jtag_reset_config
& RESET_CNCT_UNDER_SRST
) {
58 if (jtag_reset_config
& RESET_SRST_NO_GATING
) {
59 adapter_assert_reset();
62 LOG_WARNING("\'srst_nogate\' reset_config option is required");
64 adapter_deassert_reset();
68 static const struct command_registration dapdirect_jtag_subcommand_handlers
[] = {
71 .mode
= COMMAND_CONFIG
,
72 .jim_handler
= jim_jtag_newtap
,
73 .help
= "declare a new TAP"
78 .handler
= dapdirect_jtag_empty_command
,
84 .handler
= dapdirect_jtag_empty_command
,
88 .name
= "arp_init-reset",
90 .handler
= dapdirect_jtag_reset_command
,
94 .name
= "tapisenabled",
96 .jim_handler
= jim_jtag_tap_enabler
,
100 .mode
= COMMAND_EXEC
,
101 .jim_handler
= jim_jtag_tap_enabler
,
104 .name
= "tapdisable",
105 .mode
= COMMAND_EXEC
,
106 .handler
= dapdirect_jtag_empty_command
,
112 .handler
= dapdirect_jtag_empty_command
,
117 .mode
= COMMAND_EXEC
,
118 .jim_handler
= jim_jtag_configure
,
123 .handler
= dapdirect_jtag_empty_command
,
126 COMMAND_REGISTRATION_DONE
129 static const struct command_registration dapdirect_jtag_handlers
[] = {
133 .chain
= dapdirect_jtag_subcommand_handlers
,
137 .name
= "jtag_ntrst_delay",
139 .handler
= dapdirect_jtag_empty_command
,
142 COMMAND_REGISTRATION_DONE
145 static const struct command_registration dapdirect_swd_subcommand_handlers
[] = {
148 .mode
= COMMAND_CONFIG
,
149 .jim_handler
= jim_jtag_newtap
,
150 .help
= "declare a new SWD DAP",
152 COMMAND_REGISTRATION_DONE
155 static const struct command_registration dapdirect_swd_handlers
[] = {
159 .help
= "SWD command group",
161 .chain
= dapdirect_swd_subcommand_handlers
,
163 COMMAND_REGISTRATION_DONE
166 static int dapdirect_jtag_select(struct command_context
*ctx
)
168 LOG_DEBUG("dapdirect_jtag_select()");
170 return register_commands(ctx
, NULL
, dapdirect_jtag_handlers
);
173 static int dapdirect_swd_select(struct command_context
*ctx
)
175 LOG_DEBUG("dapdirect_swd_select()");
177 return register_commands(ctx
, NULL
, dapdirect_swd_handlers
);
180 static int dapdirect_init(struct command_context
*ctx
)
182 LOG_DEBUG("dapdirect_init()");
184 adapter_deassert_reset();
188 static struct transport dapdirect_jtag_transport
= {
189 .name
= "dapdirect_jtag",
190 .select
= dapdirect_jtag_select
,
191 .init
= dapdirect_init
,
194 static struct transport dapdirect_swd_transport
= {
195 .name
= "dapdirect_swd",
196 .select
= dapdirect_swd_select
,
197 .init
= dapdirect_init
,
200 static void dapdirect_constructor(void) __attribute__((constructor
));
201 static void dapdirect_constructor(void)
203 transport_register(&dapdirect_jtag_transport
);
204 transport_register(&dapdirect_swd_transport
);
208 * Returns true if the current debug session
209 * is using JTAG as its transport.
211 bool transport_is_dapdirect_jtag(void)
213 return get_current_transport() == &dapdirect_jtag_transport
;
217 * Returns true if the current debug session
218 * is using SWD as its transport.
220 bool transport_is_dapdirect_swd(void)
222 return get_current_transport() == &dapdirect_swd_transport
;
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)