From 5c9bea876ee9667e6139dd0fcf7b0d2bd33f4cf4 Mon Sep 17 00:00:00 2001 From: Greg Savin <43152568+SiFiveGregS@users.noreply.github.com> Date: Thu, 18 Apr 2019 14:44:22 -0700 Subject: [PATCH] Addressed review comments. --- doc/openocd.texi | 5 +++++ src/target/riscv/riscv-013.c | 4 ++-- src/target/riscv/riscv.c | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/doc/openocd.texi b/doc/openocd.texi index 384a52ccf..d27b89c2c 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -9482,6 +9482,11 @@ When utilizing version 0.11 of the RISC-V Debug Specification, and DBUS registers, respectively. @end deffn +@deffn Command {riscv use_bscan_tunnel} value +Enable or disable use of a BSCAN tunnel to reach DM. Supply the width of +the DM transport TAP's instruction register to enable. Supply a value of 0 to disable. +@end deffn + @subsection RISC-V Authentication Commands The following commands can be used to authenticate to a RISC-V system. Eg. a diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 29d03ceb4..741a82fb0 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -502,7 +502,7 @@ static dmi_status_t dmi_scan(struct target *target, uint32_t *address_in, if (bscan_tunnel_ir_width != 0) { jtag_add_ir_scan(target->tap, &select_user4, TAP_IDLE); - uint8_t tunneled_dr_width[4] = {num_bits}; + uint8_t tunneled_dr_width = num_bits; struct scan_field tunneled_dr[] = { { @@ -512,7 +512,7 @@ static dmi_status_t dmi_scan(struct target *target, uint32_t *address_in, }, { .num_bits = 7, - .out_value = tunneled_dr_width, + .out_value = &tunneled_dr_width, .in_value = NULL, }, /* for BSCAN tunnel, there is a one-TCK skew between shift in and shift out, so diff --git a/src/target/riscv/riscv.c b/src/target/riscv/riscv.c index 5f63fe8ad..bc2482874 100644 --- a/src/target/riscv/riscv.c +++ b/src/target/riscv/riscv.c @@ -248,8 +248,6 @@ void select_dmi_via_bscan(struct target *target) uint32_t dtmcontrol_scan_via_bscan(struct target *target, uint32_t out) { - /* jtag_add_ir_scan(target->tap, &select_dtmcontrol, TAP_IDLE); */ - /* On BSCAN TAP: Select IR=USER4, issue tunneled IR scan via BSCAN TAP's DR */ uint8_t tunneled_ir_width[4] = {bscan_tunnel_ir_width}; uint8_t tunneled_dr_width[4] = {32}; @@ -2089,8 +2087,10 @@ static const struct command_registration riscv_exec_command_handlers[] = { .name = "use_bscan_tunnel", .handler = riscv_use_bscan_tunnel, .mode = COMMAND_ANY, - .usage = "riscv use_bscan_tunnel dm_ir_width", - .help = "Enable or disable use of a BSCAN tunnel to reach DM. Supply value of 0 to disable." + .usage = "riscv use_bscan_tunnel value", + .help = "Enable or disable use of a BSCAN tunnel to reach DM. Supply " + "the width of the DM transport TAP's instruction register to " + "enable. Supply a value of 0 to disable." }, COMMAND_REGISTRATION_DONE };