diff options
author | Tim Newsome <tim@sifive.com> | 2020-01-27 16:07:08 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-27 16:07:08 -0800 |
commit | 2f456abd5509476246b4eeadc0e273c8e6df569c (patch) | |
tree | 2cfbb7732ba5722e1b89d73432b10420fc725378 | |
parent | 69e689143484c1a2cc6282d4ec74e2b343589187 (diff) | |
download | riscv-openocd-2f456abd5509476246b4eeadc0e273c8e6df569c.zip riscv-openocd-2f456abd5509476246b4eeadc0e273c8e6df569c.tar.gz riscv-openocd-2f456abd5509476246b4eeadc0e273c8e6df569c.tar.bz2 |
Complain about debug version before authentication. (#441)
Change-Id: I769af8323545c2c18e4253a1543e9202f0bdfabc
-rw-r--r-- | src/target/riscv/riscv-013.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index a206b4b..4ad585b 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -683,7 +683,12 @@ int dmstatus_read_timeout(struct target *target, uint32_t *dmstatus, DMI_DMSTATUS, 0, timeout_sec, false, true); if (result != ERROR_OK) return result; - if (authenticated && !get_field(*dmstatus, DMI_DMSTATUS_AUTHENTICATED)) { + if (get_field(*dmstatus, DMI_DMSTATUS_VERSION) != 2) { + LOG_ERROR("OpenOCD only supports Debug Module version 2 (0.13), not " + "%d (dmstatus=0x%x). This error might be caused by a JTAG " + "signal issue. Try reducing the JTAG clock speed.", + get_field(*dmstatus, DMI_DMSTATUS_VERSION), *dmstatus); + } else if (authenticated && !get_field(*dmstatus, DMI_DMSTATUS_AUTHENTICATED)) { LOG_ERROR("Debugger is not authenticated to target Debug Module. " "(dmstatus=0x%x). Use `riscv authdata_read` and " "`riscv authdata_write` commands to authenticate.", *dmstatus); @@ -1526,8 +1531,7 @@ static int examine(struct target *target) return ERROR_FAIL; LOG_DEBUG("dmstatus: 0x%08x", dmstatus); if (get_field(dmstatus, DMI_DMSTATUS_VERSION) != 2) { - LOG_ERROR("OpenOCD only supports Debug Module version 2, not %d " - "(dmstatus=0x%x)", get_field(dmstatus, DMI_DMSTATUS_VERSION), dmstatus); + /* Error was already printed out in dmstatus_read(). */ return ERROR_FAIL; } |