diff options
author | Angus Gratton <gus@projectgus.com> | 2014-06-28 09:27:11 +1000 |
---|---|---|
committer | Andreas Fritiofson <andreas.fritiofson@gmail.com> | 2014-08-11 22:34:52 +0000 |
commit | 9fce8a21ca5f7f42ec36aa859637d37f5fba312a (patch) | |
tree | c68599015b0dec70f37bf79562d29d747c30d621 /src/helper | |
parent | 6d26e3e768e3be66eb7edd43d52a039a601e03cd (diff) | |
download | riscv-openocd-9fce8a21ca5f7f42ec36aa859637d37f5fba312a.zip riscv-openocd-9fce8a21ca5f7f42ec36aa859637d37f5fba312a.tar.gz riscv-openocd-9fce8a21ca5f7f42ec36aa859637d37f5fba312a.tar.bz2 |
stlink_usb: Fix swallowed error on read/write operations, add retries on SWD WAIT, clean up error debug output.
- stlink_usb_get_rw_status() had a bug where FAULT or WAIT responses
in read/write operations were ignored, leading to incomplete data.
- Added wrapper stlink_cmd_allow_retry to handle
SWD_AP_WAIT/SWD_DP_WAIT statuses in most commands. These statuses
appear if an SWD read or write received a WAIT ACK response from the
target more than 4 times in a row. The driver retries the operation
(with exponential backoff) before failing outright (in testing 1
retry was always enough.)
- As part of the implementation of stlink_cmd_allow_retry a large
number of lines of boilerplate were refactored.
- Fleshed out stlink_usb_error_check and added it to some more code
paths so WAIT or FAULT responses are logged to debug. WAIT responses
will be logged even if they are subsequently retried, which should
help in case the retries have subtle side effects (none
anticipated.)
Tested with two targets: STLINK F0 Discovery, Nordic NRF51822. Only
tested with STLINK V2 programmers.
Change-Id: I9af24e8f0121b035356dbb9978d6bbf4feb2e4d3
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/2201
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/helper')
-rw-r--r-- | src/helper/log.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/helper/log.h b/src/helper/log.h index e1801e9..7f9f32c 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -138,5 +138,7 @@ extern int debug_level; * make no assumptions about what went wrong and try to handle the problem. */ #define ERROR_FAIL (-4) +#define ERROR_WAIT (-5) + #endif /* LOG_H */ |