jtag: move prototype of adapter init/quit and speed to adapter.h
[openocd.git] / src / jtag / tcl.c
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007-2010 √ėyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * Copyright (C) 2009 SoftPLC Corporation *
9 * http://softplc.com *
10 * dick@softplc.com *
11 * *
12 * Copyright (C) 2009 Zachary T Welch *
13 * zw@superlucidity.net *
14 * *
15 * This program is free software; you can redistribute it and/or modify *
16 * it under the terms of the GNU General Public License as published by *
17 * the Free Software Foundation; either version 2 of the License, or *
18 * (at your option) any later version. *
19 * *
20 * This program is distributed in the hope that it will be useful, *
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
23 * GNU General Public License for more details. *
24 * *
25 * You should have received a copy of the GNU General Public License *
26 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
27 ***************************************************************************/
28
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32
33 #include "adapter.h"
34 #include "jtag.h"
35 #include "swd.h"
36 #include "minidriver.h"
37 #include "interface.h"
38 #include "interfaces.h"
39 #include "tcl.h"
40
41 #ifdef HAVE_STRINGS_H
42 #include <strings.h>
43 #endif
44
45 #include <helper/time_support.h>
46 #include "transport/transport.h"
47
48 /**
49 * @file
50 * Holds support for accessing JTAG-specific mechanisms from TCl scripts.
51 */
52
53 static const struct jim_nvp nvp_jtag_tap_event[] = {
54 { .value = JTAG_TRST_ASSERTED, .name = "post-reset" },
55 { .value = JTAG_TAP_EVENT_SETUP, .name = "setup" },
56 { .value = JTAG_TAP_EVENT_ENABLE, .name = "tap-enable" },
57 { .value = JTAG_TAP_EVENT_DISABLE, .name = "tap-disable" },
58
59 { .name = NULL, .value = -1 }
60 };
61
62 struct jtag_tap *jtag_tap_by_jim_obj(Jim_Interp *interp, Jim_Obj *o)
63 {
64 const char *cp = Jim_GetString(o, NULL);
65 struct jtag_tap *t = cp ? jtag_tap_by_string(cp) : NULL;
66 if (!cp)
67 cp = "(unknown)";
68 if (!t)
69 Jim_SetResultFormatted(interp, "Tap '%s' could not be found", cp);
70 return t;
71 }
72
73 static bool scan_is_safe(tap_state_t state)
74 {
75 switch (state) {
76 case TAP_RESET:
77 case TAP_IDLE:
78 case TAP_DRPAUSE:
79 case TAP_IRPAUSE:
80 return true;
81 default:
82 return false;
83 }
84 }
85
86 static int jim_command_drscan(Jim_Interp *interp, int argc, Jim_Obj * const *args)
87 {
88 int retval;
89 struct scan_field *fields;
90 int num_fields;
91 int field_count = 0;
92 int i, e;
93 struct jtag_tap *tap;
94 tap_state_t endstate;
95
96 /* args[1] = device
97 * args[2] = num_bits
98 * args[3] = hex string
99 * ... repeat num bits and hex string ...
100 *
101 * .. optionally:
102 * args[N-2] = "-endstate"
103 * args[N-1] = statename
104 */
105 if ((argc < 4) || ((argc % 2) != 0)) {
106 Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
107 return JIM_ERR;
108 }
109
110 endstate = TAP_IDLE;
111
112 /* validate arguments as numbers */
113 e = JIM_OK;
114 for (i = 2; i < argc; i += 2) {
115 long bits;
116 const char *cp;
117
118 e = Jim_GetLong(interp, args[i], &bits);
119 /* If valid - try next arg */
120 if (e == JIM_OK)
121 continue;
122
123 /* Not valid.. are we at the end? */
124 if (((i + 2) != argc)) {
125 /* nope, then error */
126 return e;
127 }
128
129 /* it could be: "-endstate FOO"
130 * e.g. DRPAUSE so we can issue more instructions
131 * before entering RUN/IDLE and executing them.
132 */
133
134 /* get arg as a string. */
135 cp = Jim_GetString(args[i], NULL);
136 /* is it the magic? */
137 if (strcmp("-endstate", cp) == 0) {
138 /* is the statename valid? */
139 cp = Jim_GetString(args[i + 1], NULL);
140
141 /* see if it is a valid state name */
142 endstate = tap_state_by_name(cp);
143 if (endstate < 0) {
144 /* update the error message */
145 Jim_SetResultFormatted(interp, "endstate: %s invalid", cp);
146 } else {
147 if (!scan_is_safe(endstate))
148 LOG_WARNING("drscan with unsafe "
149 "endstate \"%s\"", cp);
150
151 /* valid - so clear the error */
152 e = JIM_OK;
153 /* and remove the last 2 args */
154 argc -= 2;
155 }
156 }
157
158 /* Still an error? */
159 if (e != JIM_OK)
160 return e; /* too bad */
161 } /* validate args */
162
163 assert(e == JIM_OK);
164
165 tap = jtag_tap_by_jim_obj(interp, args[1]);
166 if (!tap)
167 return JIM_ERR;
168
169 num_fields = (argc-2)/2;
170 if (num_fields <= 0) {
171 Jim_SetResultString(interp, "drscan: no scan fields supplied", -1);
172 return JIM_ERR;
173 }
174 fields = malloc(sizeof(struct scan_field) * num_fields);
175 for (i = 2; i < argc; i += 2) {
176 long bits;
177 int len;
178 const char *str;
179
180 Jim_GetLong(interp, args[i], &bits);
181 str = Jim_GetString(args[i + 1], &len);
182
183 fields[field_count].num_bits = bits;
184 void *t = malloc(DIV_ROUND_UP(bits, 8));
185 fields[field_count].out_value = t;
186 str_to_buf(str, len, t, bits, 0);
187 fields[field_count].in_value = t;
188 field_count++;
189 }
190
191 jtag_add_dr_scan(tap, num_fields, fields, endstate);
192
193 retval = jtag_execute_queue();
194 if (retval != ERROR_OK) {
195 Jim_SetResultString(interp, "drscan: jtag execute failed", -1);
196
197 for (i = 0; i < field_count; i++)
198 free(fields[i].in_value);
199 free(fields);
200
201 return JIM_ERR;
202 }
203
204 field_count = 0;
205 Jim_Obj *list = Jim_NewListObj(interp, NULL, 0);
206 for (i = 2; i < argc; i += 2) {
207 long bits;
208 char *str;
209
210 Jim_GetLong(interp, args[i], &bits);
211 str = buf_to_hex_str(fields[field_count].in_value, bits);
212 free(fields[field_count].in_value);
213
214 Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
215 free(str);
216 field_count++;
217 }
218
219 Jim_SetResult(interp, list);
220
221 free(fields);
222
223 return JIM_OK;
224 }
225
226
227 static int jim_command_pathmove(Jim_Interp *interp, int argc, Jim_Obj * const *args)
228 {
229 tap_state_t states[8];
230
231 if ((argc < 2) || ((size_t)argc > (ARRAY_SIZE(states) + 1))) {
232 Jim_WrongNumArgs(interp, 1, args, "wrong arguments");
233 return JIM_ERR;
234 }
235
236 int i;
237 for (i = 0; i < argc-1; i++) {
238 const char *cp;
239 cp = Jim_GetString(args[i + 1], NULL);
240 states[i] = tap_state_by_name(cp);
241 if (states[i] < 0) {
242 /* update the error message */
243 Jim_SetResultFormatted(interp, "endstate: %s invalid", cp);
244 return JIM_ERR;
245 }
246 }
247
248 if ((jtag_add_statemove(states[0]) != ERROR_OK) || (jtag_execute_queue() != ERROR_OK)) {
249 Jim_SetResultString(interp, "pathmove: jtag execute failed", -1);
250 return JIM_ERR;
251 }
252
253 jtag_add_pathmove(argc - 2, states + 1);
254
255 if (jtag_execute_queue() != ERROR_OK) {
256 Jim_SetResultString(interp, "pathmove: failed", -1);
257 return JIM_ERR;
258 }
259
260 return JIM_OK;
261 }
262
263
264 static int jim_command_flush_count(Jim_Interp *interp, int argc, Jim_Obj * const *args)
265 {
266 Jim_SetResult(interp, Jim_NewIntObj(interp, jtag_get_flush_queue_count()));
267
268 return JIM_OK;
269 }
270
271 /* REVISIT Just what about these should "move" ... ?
272 * These registrations, into the main JTAG table?
273 *
274 * There's a minor compatibility issue, these all show up twice;
275 * that's not desirable:
276 * - jtag drscan ... NOT DOCUMENTED!
277 * - drscan ...
278 *
279 * The "irscan" command (for example) doesn't show twice.
280 */
281 static const struct command_registration jtag_command_handlers_to_move[] = {
282 {
283 .name = "drscan",
284 .mode = COMMAND_EXEC,
285 .jim_handler = jim_command_drscan,
286 .help = "Execute Data Register (DR) scan for one TAP. "
287 "Other TAPs must be in BYPASS mode.",
288 .usage = "tap_name [num_bits value]* ['-endstate' state_name]",
289 },
290 {
291 .name = "flush_count",
292 .mode = COMMAND_EXEC,
293 .jim_handler = jim_command_flush_count,
294 .help = "Returns the number of times the JTAG queue "
295 "has been flushed.",
296 },
297 {
298 .name = "pathmove",
299 .mode = COMMAND_EXEC,
300 .jim_handler = jim_command_pathmove,
301 .usage = "start_state state1 [state2 [state3 ...]]",
302 .help = "Move JTAG state machine from current state "
303 "(start_state) to state1, then state2, state3, etc.",
304 },
305 COMMAND_REGISTRATION_DONE
306 };
307
308
309 enum jtag_tap_cfg_param {
310 JCFG_EVENT,
311 JCFG_IDCODE,
312 };
313
314 static struct jim_nvp nvp_config_opts[] = {
315 { .name = "-event", .value = JCFG_EVENT },
316 { .name = "-idcode", .value = JCFG_IDCODE },
317
318 { .name = NULL, .value = -1 }
319 };
320
321 static int jtag_tap_configure_event(struct jim_getopt_info *goi, struct jtag_tap *tap)
322 {
323 if (goi->argc == 0) {
324 Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name> ...");
325 return JIM_ERR;
326 }
327
328 struct jim_nvp *n;
329 int e = jim_getopt_nvp(goi, nvp_jtag_tap_event, &n);
330 if (e != JIM_OK) {
331 jim_getopt_nvp_unknown(goi, nvp_jtag_tap_event, 1);
332 return e;
333 }
334
335 if (goi->isconfigure) {
336 if (goi->argc != 1) {
337 Jim_WrongNumArgs(goi->interp,
338 goi->argc,
339 goi->argv,
340 "-event <event-name> <event-body>");
341 return JIM_ERR;
342 }
343 } else {
344 if (goi->argc != 0) {
345 Jim_WrongNumArgs(goi->interp, goi->argc, goi->argv, "-event <event-name>");
346 return JIM_ERR;
347 }
348 }
349
350 struct jtag_tap_event_action *jteap = tap->event_action;
351 /* replace existing event body */
352 bool found = false;
353 while (jteap) {
354 if (jteap->event == (enum jtag_event)n->value) {
355 found = true;
356 break;
357 }
358 jteap = jteap->next;
359 }
360
361 Jim_SetEmptyResult(goi->interp);
362
363 if (goi->isconfigure) {
364 if (!found)
365 jteap = calloc(1, sizeof(*jteap));
366 else if (jteap->body)
367 Jim_DecrRefCount(goi->interp, jteap->body);
368
369 jteap->interp = goi->interp;
370 jteap->event = n->value;
371
372 Jim_Obj *o;
373 jim_getopt_obj(goi, &o);
374 jteap->body = Jim_DuplicateObj(goi->interp, o);
375 Jim_IncrRefCount(jteap->body);
376
377 if (!found) {
378 /* add to head of event list */
379 jteap->next = tap->event_action;
380 tap->event_action = jteap;
381 }
382 } else if (found) {
383 jteap->interp = goi->interp;
384 Jim_SetResult(goi->interp,
385 Jim_DuplicateObj(goi->interp, jteap->body));
386 }
387 return JIM_OK;
388 }
389
390 static int jtag_tap_configure_cmd(struct jim_getopt_info *goi, struct jtag_tap *tap)
391 {
392 /* parse config or cget options */
393 while (goi->argc > 0) {
394 Jim_SetEmptyResult(goi->interp);
395
396 struct jim_nvp *n;
397 int e = jim_getopt_nvp(goi, nvp_config_opts, &n);
398 if (e != JIM_OK) {
399 jim_getopt_nvp_unknown(goi, nvp_config_opts, 0);
400 return e;
401 }
402
403 switch (n->value) {
404 case JCFG_EVENT:
405 e = jtag_tap_configure_event(goi, tap);
406 if (e != JIM_OK)
407 return e;
408 break;
409 case JCFG_IDCODE:
410 if (goi->isconfigure) {
411 Jim_SetResultFormatted(goi->interp,
412 "not settable: %s", n->name);
413 return JIM_ERR;
414 } else {
415 if (goi->argc != 0) {
416 Jim_WrongNumArgs(goi->interp,
417 goi->argc, goi->argv,
418 "NO PARAMS");
419 return JIM_ERR;
420 }
421 }
422 Jim_SetResult(goi->interp, Jim_NewIntObj(goi->interp, tap->idcode));
423 break;
424 default:
425 Jim_SetResultFormatted(goi->interp, "unknown value: %s", n->name);
426 return JIM_ERR;
427 }
428 }
429
430 return JIM_OK;
431 }
432
433 static int is_bad_irval(int ir_length, jim_wide w)
434 {
435 jim_wide v = 1;
436
437 v <<= ir_length;
438 v -= 1;
439 v = ~v;
440 return (w & v) != 0;
441 }
442
443 static int jim_newtap_expected_id(struct jim_nvp *n, struct jim_getopt_info *goi,
444 struct jtag_tap *tap)
445 {
446 jim_wide w;
447 int e = jim_getopt_wide(goi, &w);
448 if (e != JIM_OK) {
449 Jim_SetResultFormatted(goi->interp, "option: %s bad parameter", n->name);
450 return e;
451 }
452
453 uint32_t *p = realloc(tap->expected_ids,
454 (tap->expected_ids_cnt + 1) * sizeof(uint32_t));
455 if (!p) {
456 Jim_SetResultFormatted(goi->interp, "no memory");
457 return JIM_ERR;
458 }
459
460 tap->expected_ids = p;
461 tap->expected_ids[tap->expected_ids_cnt++] = w;
462
463 return JIM_OK;
464 }
465
466 #define NTAP_OPT_IRLEN 0
467 #define NTAP_OPT_IRMASK 1
468 #define NTAP_OPT_IRCAPTURE 2
469 #define NTAP_OPT_ENABLED 3
470 #define NTAP_OPT_DISABLED 4
471 #define NTAP_OPT_EXPECTED_ID 5
472 #define NTAP_OPT_VERSION 6
473
474 static int jim_newtap_ir_param(struct jim_nvp *n, struct jim_getopt_info *goi,
475 struct jtag_tap *tap)
476 {
477 jim_wide w;
478 int e = jim_getopt_wide(goi, &w);
479 if (e != JIM_OK) {
480 Jim_SetResultFormatted(goi->interp,
481 "option: %s bad parameter", n->name);
482 return e;
483 }
484 switch (n->value) {
485 case NTAP_OPT_IRLEN:
486 if (w > (jim_wide) (8 * sizeof(tap->ir_capture_value))) {
487 LOG_WARNING("%s: huge IR length %d",
488 tap->dotted_name, (int) w);
489 }
490 tap->ir_length = w;
491 break;
492 case NTAP_OPT_IRMASK:
493 if (is_bad_irval(tap->ir_length, w)) {
494 LOG_ERROR("%s: IR mask %x too big",
495 tap->dotted_name,
496 (int) w);
497 return JIM_ERR;
498 }
499 if ((w & 3) != 3)
500 LOG_WARNING("%s: nonstandard IR mask", tap->dotted_name);
501 tap->ir_capture_mask = w;
502 break;
503 case NTAP_OPT_IRCAPTURE:
504 if (is_bad_irval(tap->ir_length, w)) {
505 LOG_ERROR("%s: IR capture %x too big",
506 tap->dotted_name, (int) w);
507 return JIM_ERR;
508 }
509 if ((w & 3) != 1)
510 LOG_WARNING("%s: nonstandard IR value",
511 tap->dotted_name);
512 tap->ir_capture_value = w;
513 break;
514 default:
515 return JIM_ERR;
516 }
517 return JIM_OK;
518 }
519
520 static int jim_newtap_cmd(struct jim_getopt_info *goi)
521 {
522 struct jtag_tap *tap;
523 int x;
524 int e;
525 struct jim_nvp *n;
526 char *cp;
527 const struct jim_nvp opts[] = {
528 { .name = "-irlen", .value = NTAP_OPT_IRLEN },
529 { .name = "-irmask", .value = NTAP_OPT_IRMASK },
530 { .name = "-ircapture", .value = NTAP_OPT_IRCAPTURE },
531 { .name = "-enable", .value = NTAP_OPT_ENABLED },
532 { .name = "-disable", .value = NTAP_OPT_DISABLED },
533 { .name = "-expected-id", .value = NTAP_OPT_EXPECTED_ID },
534 { .name = "-ignore-version", .value = NTAP_OPT_VERSION },
535 { .name = NULL, .value = -1 },
536 };
537
538 tap = calloc(1, sizeof(struct jtag_tap));
539 if (!tap) {
540 Jim_SetResultFormatted(goi->interp, "no memory");
541 return JIM_ERR;
542 }
543
544 /*
545 * we expect CHIP + TAP + OPTIONS
546 * */
547 if (goi->argc < 3) {
548 Jim_SetResultFormatted(goi->interp, "Missing CHIP TAP OPTIONS ....");
549 free(tap);
550 return JIM_ERR;
551 }
552
553 const char *tmp;
554 jim_getopt_string(goi, &tmp, NULL);
555 tap->chip = strdup(tmp);
556
557 jim_getopt_string(goi, &tmp, NULL);
558 tap->tapname = strdup(tmp);
559
560 /* name + dot + name + null */
561 x = strlen(tap->chip) + 1 + strlen(tap->tapname) + 1;
562 cp = malloc(x);
563 sprintf(cp, "%s.%s", tap->chip, tap->tapname);
564 tap->dotted_name = cp;
565
566 LOG_DEBUG("Creating New Tap, Chip: %s, Tap: %s, Dotted: %s, %d params",
567 tap->chip, tap->tapname, tap->dotted_name, goi->argc);
568
569 if (!transport_is_jtag()) {
570 /* SWD doesn't require any JTAG tap parameters */
571 tap->enabled = true;
572 jtag_tap_init(tap);
573 return JIM_OK;
574 }
575
576 /* IEEE specifies that the two LSBs of an IR scan are 01, so make
577 * that the default. The "-ircapture" and "-irmask" options are only
578 * needed to cope with nonstandard TAPs, or to specify more bits.
579 */
580 tap->ir_capture_mask = 0x03;
581 tap->ir_capture_value = 0x01;
582
583 while (goi->argc) {
584 e = jim_getopt_nvp(goi, opts, &n);
585 if (e != JIM_OK) {
586 jim_getopt_nvp_unknown(goi, opts, 0);
587 free(cp);
588 free(tap);
589 return e;
590 }
591 LOG_DEBUG("Processing option: %s", n->name);
592 switch (n->value) {
593 case NTAP_OPT_ENABLED:
594 tap->disabled_after_reset = false;
595 break;
596 case NTAP_OPT_DISABLED:
597 tap->disabled_after_reset = true;
598 break;
599 case NTAP_OPT_EXPECTED_ID:
600 e = jim_newtap_expected_id(n, goi, tap);
601 if (e != JIM_OK) {
602 free(cp);
603 free(tap);
604 return e;
605 }
606 break;
607 case NTAP_OPT_IRLEN:
608 case NTAP_OPT_IRMASK:
609 case NTAP_OPT_IRCAPTURE:
610 e = jim_newtap_ir_param(n, goi, tap);
611 if (e != JIM_OK) {
612 free(cp);
613 free(tap);
614 return e;
615 }
616 break;
617 case NTAP_OPT_VERSION:
618 tap->ignore_version = true;
619 break;
620 } /* switch (n->value) */
621 } /* while (goi->argc) */
622
623 /* default is enabled-after-reset */
624 tap->enabled = !tap->disabled_after_reset;
625
626 /* Did all the required option bits get cleared? */
627 if (tap->ir_length != 0) {
628 jtag_tap_init(tap);
629 return JIM_OK;
630 }
631
632 Jim_SetResultFormatted(goi->interp,
633 "newtap: %s missing IR length",
634 tap->dotted_name);
635 jtag_tap_free(tap);
636 return JIM_ERR;
637 }
638
639 static void jtag_tap_handle_event(struct jtag_tap *tap, enum jtag_event e)
640 {
641 struct jtag_tap_event_action *jteap;
642 int retval;
643
644 for (jteap = tap->event_action; jteap; jteap = jteap->next) {
645 if (jteap->event != e)
646 continue;
647
648 struct jim_nvp *nvp = jim_nvp_value2name_simple(nvp_jtag_tap_event, e);
649 LOG_DEBUG("JTAG tap: %s event: %d (%s)\n\taction: %s",
650 tap->dotted_name, e, nvp->name,
651 Jim_GetString(jteap->body, NULL));
652
653 retval = Jim_EvalObj(jteap->interp, jteap->body);
654 if (retval == JIM_RETURN)
655 retval = jteap->interp->returnCode;
656
657 if (retval != JIM_OK) {
658 Jim_MakeErrorMessage(jteap->interp);
659 LOG_USER("%s", Jim_GetString(Jim_GetResult(jteap->interp), NULL));
660 continue;
661 }
662
663 switch (e) {
664 case JTAG_TAP_EVENT_ENABLE:
665 case JTAG_TAP_EVENT_DISABLE:
666 /* NOTE: we currently assume the handlers
667 * can't fail. Right here is where we should
668 * really be verifying the scan chains ...
669 */
670 tap->enabled = (e == JTAG_TAP_EVENT_ENABLE);
671 LOG_INFO("JTAG tap: %s %s", tap->dotted_name,
672 tap->enabled ? "enabled" : "disabled");
673 break;
674 default:
675 break;
676 }
677 }
678 }
679
680 static int jim_jtag_arp_init(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
681 {
682 struct jim_getopt_info goi;
683 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
684 if (goi.argc != 0) {
685 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
686 return JIM_ERR;
687 }
688 struct command_context *context = current_command_context(interp);
689 int e = jtag_init_inner(context);
690 if (e != ERROR_OK) {
691 Jim_Obj *obj = Jim_NewIntObj(goi.interp, e);
692 Jim_SetResultFormatted(goi.interp, "error: %#s", obj);
693 return JIM_ERR;
694 }
695 return JIM_OK;
696 }
697
698 static int jim_jtag_arp_init_reset(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
699 {
700 int e = ERROR_OK;
701 struct jim_getopt_info goi;
702 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
703 if (goi.argc != 0) {
704 Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no params)");
705 return JIM_ERR;
706 }
707 struct command_context *context = current_command_context(interp);
708 if (transport_is_jtag())
709 e = jtag_init_reset(context);
710 else if (transport_is_swd())
711 e = swd_init_reset(context);
712
713 if (e != ERROR_OK) {
714 Jim_Obj *obj = Jim_NewIntObj(goi.interp, e);
715 Jim_SetResultFormatted(goi.interp, "error: %#s", obj);
716 return JIM_ERR;
717 }
718 return JIM_OK;
719 }
720
721 int jim_jtag_newtap(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
722 {
723 struct jim_getopt_info goi;
724 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
725 return jim_newtap_cmd(&goi);
726 }
727
728 static bool jtag_tap_enable(struct jtag_tap *t)
729 {
730 if (t->enabled)
731 return false;
732 jtag_tap_handle_event(t, JTAG_TAP_EVENT_ENABLE);
733 if (!t->enabled)
734 return false;
735
736 /* FIXME add JTAG sanity checks, w/o TLR
737 * - scan chain length grew by one (this)
738 * - IDs and IR lengths are as expected
739 */
740 jtag_call_event_callbacks(JTAG_TAP_EVENT_ENABLE);
741 return true;
742 }
743 static bool jtag_tap_disable(struct jtag_tap *t)
744 {
745 if (!t->enabled)
746 return false;
747 jtag_tap_handle_event(t, JTAG_TAP_EVENT_DISABLE);
748 if (t->enabled)
749 return false;
750
751 /* FIXME add JTAG sanity checks, w/o TLR
752 * - scan chain length shrank by one (this)
753 * - IDs and IR lengths are as expected
754 */
755 jtag_call_event_callbacks(JTAG_TAP_EVENT_DISABLE);
756 return true;
757 }
758
759 int jim_jtag_tap_enabler(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
760 {
761 struct command *c = jim_to_command(interp);
762 const char *cmd_name = c->name;
763 struct jim_getopt_info goi;
764 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
765 if (goi.argc != 1) {
766 Jim_SetResultFormatted(goi.interp, "usage: %s <name>", cmd_name);
767 return JIM_ERR;
768 }
769
770 struct jtag_tap *t;
771
772 t = jtag_tap_by_jim_obj(goi.interp, goi.argv[0]);
773 if (!t)
774 return JIM_ERR;
775
776 if (strcasecmp(cmd_name, "tapisenabled") == 0) {
777 /* do nothing, just return the value */
778 } else if (strcasecmp(cmd_name, "tapenable") == 0) {
779 if (!jtag_tap_enable(t)) {
780 LOG_WARNING("failed to enable tap %s", t->dotted_name);
781 return JIM_ERR;
782 }
783 } else if (strcasecmp(cmd_name, "tapdisable") == 0) {
784 if (!jtag_tap_disable(t)) {
785 LOG_WARNING("failed to disable tap %s", t->dotted_name);
786 return JIM_ERR;
787 }
788 } else {
789 LOG_ERROR("command '%s' unknown", cmd_name);
790 return JIM_ERR;
791 }
792 bool e = t->enabled;
793 Jim_SetResult(goi.interp, Jim_NewIntObj(goi.interp, e));
794 return JIM_OK;
795 }
796
797 int jim_jtag_configure(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
798 {
799 struct command *c = jim_to_command(interp);
800 const char *cmd_name = c->name;
801 struct jim_getopt_info goi;
802 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
803 goi.isconfigure = !strcmp(cmd_name, "configure");
804 if (goi.argc < 2 + goi.isconfigure) {
805 Jim_WrongNumArgs(goi.interp, 0, NULL,
806 "<tap_name> <attribute> ...");
807 return JIM_ERR;
808 }
809
810 struct jtag_tap *t;
811
812 Jim_Obj *o;
813 jim_getopt_obj(&goi, &o);
814 t = jtag_tap_by_jim_obj(goi.interp, o);
815 if (!t)
816 return JIM_ERR;
817
818 return jtag_tap_configure_cmd(&goi, t);
819 }
820
821 static int jim_jtag_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
822 {
823 struct jim_getopt_info goi;
824 jim_getopt_setup(&goi, interp, argc-1, argv + 1);
825 if (goi.argc != 0) {
826 Jim_WrongNumArgs(goi.interp, 1, goi.argv, "Too many parameters");
827 return JIM_ERR;
828 }
829 Jim_SetResult(goi.interp, Jim_NewListObj(goi.interp, NULL, 0));
830 struct jtag_tap *tap;
831
832 for (tap = jtag_all_taps(); tap; tap = tap->next_tap) {
833 Jim_ListAppendElement(goi.interp,
834 Jim_GetResult(goi.interp),
835 Jim_NewStringObj(goi.interp,
836 tap->dotted_name, -1));
837 }
838 return JIM_OK;
839 }
840
841 COMMAND_HANDLER(handle_jtag_init_command)
842 {
843 if (CMD_ARGC != 0)
844 return ERROR_COMMAND_SYNTAX_ERROR;
845
846 static bool jtag_initialized;
847 if (jtag_initialized) {
848 LOG_INFO("'jtag init' has already been called");
849 return ERROR_OK;
850 }
851 jtag_initialized = true;
852
853 LOG_DEBUG("Initializing jtag devices...");
854 return jtag_init(CMD_CTX);
855 }
856
857 static const struct command_registration jtag_subcommand_handlers[] = {
858 {
859 .name = "init",
860 .mode = COMMAND_ANY,
861 .handler = handle_jtag_init_command,
862 .help = "initialize jtag scan chain",
863 .usage = ""
864 },
865 {
866 .name = "arp_init",
867 .mode = COMMAND_ANY,
868 .jim_handler = jim_jtag_arp_init,
869 .help = "Validates JTAG scan chain against the list of "
870 "declared TAPs using just the four standard JTAG "
871 "signals.",
872 },
873 {
874 .name = "arp_init-reset",
875 .mode = COMMAND_ANY,
876 .jim_handler = jim_jtag_arp_init_reset,
877 .help = "Uses TRST and SRST to try resetting everything on "
878 "the JTAG scan chain, then performs 'jtag arp_init'."
879 },
880 {
881 .name = "newtap",
882 .mode = COMMAND_CONFIG,
883 .jim_handler = jim_jtag_newtap,
884 .help = "Create a new TAP instance named basename.tap_type, "
885 "and appends it to the scan chain.",
886 .usage = "basename tap_type '-irlen' count "
887 "['-enable'|'-disable'] "
888 "['-expected_id' number] "
889 "['-ignore-version'] "
890 "['-ircapture' number] "
891 "['-mask' number]",
892 },
893 {
894 .name = "tapisenabled",
895 .mode = COMMAND_EXEC,
896 .jim_handler = jim_jtag_tap_enabler,
897 .help = "Returns a Tcl boolean (0/1) indicating whether "
898 "the TAP is enabled (1) or not (0).",
899 .usage = "tap_name",
900 },
901 {
902 .name = "tapenable",
903 .mode = COMMAND_EXEC,
904 .jim_handler = jim_jtag_tap_enabler,
905 .help = "Try to enable the specified TAP using the "
906 "'tap-enable' TAP event.",
907 .usage = "tap_name",
908 },
909 {
910 .name = "tapdisable",
911 .mode = COMMAND_EXEC,
912 .jim_handler = jim_jtag_tap_enabler,
913 .help = "Try to disable the specified TAP using the "
914 "'tap-disable' TAP event.",
915 .usage = "tap_name",
916 },
917 {
918 .name = "configure",
919 .mode = COMMAND_ANY,
920 .jim_handler = jim_jtag_configure,
921 .help = "Provide a Tcl handler for the specified "
922 "TAP event.",
923 .usage = "tap_name '-event' event_name handler",
924 },
925 {
926 .name = "cget",
927 .mode = COMMAND_EXEC,
928 .jim_handler = jim_jtag_configure,
929 .help = "Return any Tcl handler for the specified "
930 "TAP event.",
931 .usage = "tap_name '-event' event_name",
932 },
933 {
934 .name = "names",
935 .mode = COMMAND_ANY,
936 .jim_handler = jim_jtag_names,
937 .help = "Returns list of all JTAG tap names.",
938 },
939 {
940 .chain = jtag_command_handlers_to_move,
941 },
942 COMMAND_REGISTRATION_DONE
943 };
944
945 void jtag_notify_event(enum jtag_event event)
946 {
947 struct jtag_tap *tap;
948
949 for (tap = jtag_all_taps(); tap; tap = tap->next_tap)
950 jtag_tap_handle_event(tap, event);
951 }
952
953
954 COMMAND_HANDLER(handle_scan_chain_command)
955 {
956 struct jtag_tap *tap;
957 char expected_id[12];
958
959 tap = jtag_all_taps();
960 command_print(CMD,
961 " TapName Enabled IdCode Expected IrLen IrCap IrMask");
962 command_print(CMD,
963 "-- ------------------- -------- ---------- ---------- ----- ----- ------");
964
965 while (tap) {
966 uint32_t expected, expected_mask, ii;
967
968 snprintf(expected_id, sizeof(expected_id), "0x%08x",
969 (unsigned)((tap->expected_ids_cnt > 0)
970 ? tap->expected_ids[0]
971 : 0));
972 if (tap->ignore_version)
973 expected_id[2] = '*';
974
975 expected = buf_get_u32(tap->expected, 0, tap->ir_length);
976 expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
977
978 command_print(CMD,
979 "%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
980 tap->abs_chain_position,
981 tap->dotted_name,
982 tap->enabled ? 'Y' : 'n',
983 (unsigned int)(tap->idcode),
984 expected_id,
985 (unsigned int)(tap->ir_length),
986 (unsigned int)(expected),
987 (unsigned int)(expected_mask));
988
989 for (ii = 1; ii < tap->expected_ids_cnt; ii++) {
990 snprintf(expected_id, sizeof(expected_id), "0x%08x",
991 (unsigned) tap->expected_ids[ii]);
992 if (tap->ignore_version)
993 expected_id[2] = '*';
994
995 command_print(CMD,
996 " %s",
997 expected_id);
998 }
999
1000 tap = tap->next_tap;
1001 }
1002
1003 return ERROR_OK;
1004 }
1005
1006 COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
1007 {
1008 if (CMD_ARGC > 1)
1009 return ERROR_COMMAND_SYNTAX_ERROR;
1010 if (CMD_ARGC == 1) {
1011 unsigned delay;
1012 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
1013
1014 jtag_set_ntrst_delay(delay);
1015 }
1016 command_print(CMD, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
1017 return ERROR_OK;
1018 }
1019
1020 COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
1021 {
1022 if (CMD_ARGC > 1)
1023 return ERROR_COMMAND_SYNTAX_ERROR;
1024 if (CMD_ARGC == 1) {
1025 unsigned delay;
1026 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], delay);
1027
1028 jtag_set_ntrst_assert_width(delay);
1029 }
1030 command_print(CMD, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
1031 return ERROR_OK;
1032 }
1033
1034 COMMAND_HANDLER(handle_jtag_rclk_command)
1035 {
1036 if (CMD_ARGC > 1)
1037 return ERROR_COMMAND_SYNTAX_ERROR;
1038
1039 int retval = ERROR_OK;
1040 if (CMD_ARGC == 1) {
1041 unsigned khz = 0;
1042 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], khz);
1043
1044 retval = jtag_config_rclk(khz);
1045 if (retval != ERROR_OK)
1046 return retval;
1047 }
1048
1049 int cur_khz = jtag_get_speed_khz();
1050 retval = jtag_get_speed_readable(&cur_khz);
1051 if (retval != ERROR_OK)
1052 return retval;
1053
1054 if (cur_khz)
1055 command_print(CMD, "RCLK not supported - fallback to %d kHz", cur_khz);
1056 else
1057 command_print(CMD, "RCLK - adaptive");
1058
1059 return retval;
1060 }
1061
1062 COMMAND_HANDLER(handle_runtest_command)
1063 {
1064 if (CMD_ARGC != 1)
1065 return ERROR_COMMAND_SYNTAX_ERROR;
1066
1067 unsigned num_clocks;
1068 COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num_clocks);
1069
1070 jtag_add_runtest(num_clocks, TAP_IDLE);
1071 return jtag_execute_queue();
1072 }
1073
1074 /*
1075 * For "irscan" or "drscan" commands, the "end" (really, "next") state
1076 * should be stable ... and *NOT* a shift state, otherwise free-running
1077 * jtag clocks could change the values latched by the update state.
1078 * Not surprisingly, this is the same constraint as SVF; the "irscan"
1079 * and "drscan" commands are a write-only subset of what SVF provides.
1080 */
1081
1082 COMMAND_HANDLER(handle_irscan_command)
1083 {
1084 int i;
1085 struct scan_field *fields;
1086 struct jtag_tap *tap = NULL;
1087 tap_state_t endstate;
1088
1089 if ((CMD_ARGC < 2) || (CMD_ARGC % 2))
1090 return ERROR_COMMAND_SYNTAX_ERROR;
1091
1092 /* optional "-endstate" "statename" at the end of the arguments,
1093 * so that e.g. IRPAUSE can let us load the data register before
1094 * entering RUN/IDLE to execute the instruction we load here.
1095 */
1096 endstate = TAP_IDLE;
1097
1098 if (CMD_ARGC >= 4) {
1099 /* have at least one pair of numbers.
1100 * is last pair the magic text? */
1101 if (strcmp("-endstate", CMD_ARGV[CMD_ARGC - 2]) == 0) {
1102 endstate = tap_state_by_name(CMD_ARGV[CMD_ARGC - 1]);
1103 if (endstate == TAP_INVALID)
1104 return ERROR_COMMAND_SYNTAX_ERROR;
1105 if (!scan_is_safe(endstate))
1106 LOG_WARNING("unstable irscan endstate \"%s\"",
1107 CMD_ARGV[CMD_ARGC - 1]);
1108 CMD_ARGC -= 2;
1109 }
1110 }
1111
1112 int num_fields = CMD_ARGC / 2;
1113 if (num_fields > 1) {
1114 /* we really should be looking at plain_ir_scan if we want
1115 * anything more fancy.
1116 */
1117 LOG_ERROR("Specify a single value for tap");
1118 return ERROR_COMMAND_SYNTAX_ERROR;
1119 }
1120
1121 fields = calloc(num_fields, sizeof(*fields));
1122
1123 int retval;
1124 for (i = 0; i < num_fields; i++) {
1125 tap = jtag_tap_by_string(CMD_ARGV[i*2]);
1126 if (!tap) {
1127 free(fields);
1128 command_print(CMD, "Tap: %s unknown", CMD_ARGV[i*2]);
1129
1130 return ERROR_FAIL;
1131 }
1132 uint64_t value;
1133 retval = parse_u64(CMD_ARGV[i * 2 + 1], &value);
1134 if (retval != ERROR_OK)
1135 goto error_return;
1136
1137 int field_size = tap->ir_length;
1138 fields[i].num_bits = field_size;
1139 uint8_t *v = calloc(1, DIV_ROUND_UP(field_size, 8));
1140 if (!v) {
1141 LOG_ERROR("Out of memory");
1142 goto error_return;
1143 }
1144
1145 buf_set_u64(v, 0, field_size, value);
1146 fields[i].out_value = v;
1147 fields[i].in_value = NULL;
1148 }
1149
1150 /* did we have an endstate? */
1151 jtag_add_ir_scan(tap, fields, endstate);
1152
1153 retval = jtag_execute_queue();
1154
1155 error_return:
1156 for (i = 0; i < num_fields; i++)
1157 free((void *)fields[i].out_value);
1158
1159 free(fields);
1160
1161 return retval;
1162 }
1163
1164 COMMAND_HANDLER(handle_verify_ircapture_command)
1165 {
1166 if (CMD_ARGC > 1)
1167 return ERROR_COMMAND_SYNTAX_ERROR;
1168
1169 if (CMD_ARGC == 1) {
1170 bool enable;
1171 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1172 jtag_set_verify_capture_ir(enable);
1173 }
1174
1175 const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
1176 command_print(CMD, "verify Capture-IR is %s", status);
1177
1178 return ERROR_OK;
1179 }
1180
1181 COMMAND_HANDLER(handle_verify_jtag_command)
1182 {
1183 if (CMD_ARGC > 1)
1184 return ERROR_COMMAND_SYNTAX_ERROR;
1185
1186 if (CMD_ARGC == 1) {
1187 bool enable;
1188 COMMAND_PARSE_ENABLE(CMD_ARGV[0], enable);
1189 jtag_set_verify(enable);
1190 }
1191
1192 const char *status = jtag_will_verify() ? "enabled" : "disabled";
1193 command_print(CMD, "verify jtag capture is %s", status);
1194
1195 return ERROR_OK;
1196 }
1197
1198 COMMAND_HANDLER(handle_tms_sequence_command)
1199 {
1200 if (CMD_ARGC > 1)
1201 return ERROR_COMMAND_SYNTAX_ERROR;
1202
1203 if (CMD_ARGC == 1) {
1204 bool use_new_table;
1205 if (strcmp(CMD_ARGV[0], "short") == 0)
1206 use_new_table = true;
1207 else if (strcmp(CMD_ARGV[0], "long") == 0)
1208 use_new_table = false;
1209 else
1210 return ERROR_COMMAND_SYNTAX_ERROR;
1211
1212 tap_use_new_tms_table(use_new_table);
1213 }
1214
1215 command_print(CMD, "tms sequence is %s",
1216 tap_uses_new_tms_table() ? "short" : "long");
1217
1218 return ERROR_OK;
1219 }
1220
1221 COMMAND_HANDLER(handle_jtag_flush_queue_sleep)
1222 {
1223 if (CMD_ARGC != 1)
1224 return ERROR_COMMAND_SYNTAX_ERROR;
1225
1226 int sleep_ms;
1227 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], sleep_ms);
1228
1229 jtag_set_flush_queue_sleep(sleep_ms);
1230
1231 return ERROR_OK;
1232 }
1233
1234 COMMAND_HANDLER(handle_wait_srst_deassert)
1235 {
1236 if (CMD_ARGC != 1)
1237 return ERROR_COMMAND_SYNTAX_ERROR;
1238
1239 int timeout_ms;
1240 COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], timeout_ms);
1241 if ((timeout_ms <= 0) || (timeout_ms > 100000)) {
1242 LOG_ERROR("Timeout must be an integer between 0 and 100000");
1243 return ERROR_FAIL;
1244 }
1245
1246 LOG_USER("Waiting for srst assert + deassert for at most %dms", timeout_ms);
1247 int asserted_yet;
1248 int64_t then = timeval_ms();
1249 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1250 if ((timeval_ms() - then) > timeout_ms) {
1251 LOG_ERROR("Timed out");
1252 return ERROR_FAIL;
1253 }
1254 if (asserted_yet)
1255 break;
1256 }
1257 while (jtag_srst_asserted(&asserted_yet) == ERROR_OK) {
1258 if ((timeval_ms() - then) > timeout_ms) {
1259 LOG_ERROR("Timed out");
1260 return ERROR_FAIL;
1261 }
1262 if (!asserted_yet)
1263 break;
1264 }
1265
1266 return ERROR_OK;
1267 }
1268
1269 static const struct command_registration jtag_command_handlers[] = {
1270
1271 {
1272 .name = "jtag_flush_queue_sleep",
1273 .handler = handle_jtag_flush_queue_sleep,
1274 .mode = COMMAND_ANY,
1275 .help = "For debug purposes(simulate long delays of interface) "
1276 "to test performance or change in behavior. Default 0ms.",
1277 .usage = "[sleep in ms]",
1278 },
1279 {
1280 .name = "jtag_rclk",
1281 .handler = handle_jtag_rclk_command,
1282 .mode = COMMAND_ANY,
1283 .help = "With an argument, change to to use adaptive clocking "
1284 "if possible; else to use the fallback speed. "
1285 "With or without argument, display current setting.",
1286 .usage = "[fallback_speed_khz]",
1287 },
1288 {
1289 .name = "jtag_ntrst_delay",
1290 .handler = handle_jtag_ntrst_delay_command,
1291 .mode = COMMAND_ANY,
1292 .help = "delay after deasserting trst in ms",
1293 .usage = "[milliseconds]",
1294 },
1295 {
1296 .name = "jtag_ntrst_assert_width",
1297 .handler = handle_jtag_ntrst_assert_width_command,
1298 .mode = COMMAND_ANY,
1299 .help = "delay after asserting trst in ms",
1300 .usage = "[milliseconds]",
1301 },
1302 {
1303 .name = "scan_chain",
1304 .handler = handle_scan_chain_command,
1305 .mode = COMMAND_ANY,
1306 .help = "print current scan chain configuration",
1307 .usage = ""
1308 },
1309 {
1310 .name = "runtest",
1311 .handler = handle_runtest_command,
1312 .mode = COMMAND_EXEC,
1313 .help = "Move to Run-Test/Idle, and issue TCK for num_cycles.",
1314 .usage = "num_cycles"
1315 },
1316 {
1317 .name = "irscan",
1318 .handler = handle_irscan_command,
1319 .mode = COMMAND_EXEC,
1320 .help = "Execute Instruction Register (IR) scan. The "
1321 "specified opcodes are put into each TAP's IR, "
1322 "and other TAPs are put in BYPASS.",
1323 .usage = "[tap_name instruction]* ['-endstate' state_name]",
1324 },
1325 {
1326 .name = "verify_ircapture",
1327 .handler = handle_verify_ircapture_command,
1328 .mode = COMMAND_ANY,
1329 .help = "Display or assign flag controlling whether to "
1330 "verify values captured during Capture-IR.",
1331 .usage = "['enable'|'disable']",
1332 },
1333 {
1334 .name = "verify_jtag",
1335 .handler = handle_verify_jtag_command,
1336 .mode = COMMAND_ANY,
1337 .help = "Display or assign flag controlling whether to "
1338 "verify values captured during IR and DR scans.",
1339 .usage = "['enable'|'disable']",
1340 },
1341 {
1342 .name = "tms_sequence",
1343 .handler = handle_tms_sequence_command,
1344 .mode = COMMAND_ANY,
1345 .help = "Display or change what style TMS sequences to use "
1346 "for JTAG state transitions: short (default) or "
1347 "long. Only for working around JTAG bugs.",
1348 /* Specifically for working around DRIVER bugs... */
1349 .usage = "['short'|'long']",
1350 },
1351 {
1352 .name = "wait_srst_deassert",
1353 .handler = handle_wait_srst_deassert,
1354 .mode = COMMAND_ANY,
1355 .help = "Wait for an SRST deassert. "
1356 "Useful for cases where you need something to happen within ms "
1357 "of an srst deassert. Timeout in ms",
1358 .usage = "ms",
1359 },
1360 {
1361 .name = "jtag",
1362 .mode = COMMAND_ANY,
1363 .help = "perform jtag tap actions",
1364 .usage = "",
1365
1366 .chain = jtag_subcommand_handlers,
1367 },
1368 {
1369 .chain = jtag_command_handlers_to_move,
1370 },
1371 COMMAND_REGISTRATION_DONE
1372 };
1373
1374 int jtag_register_commands(struct command_context *cmd_ctx)
1375 {
1376 return register_commands(cmd_ctx, NULL, jtag_command_handlers);
1377 }

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)