This is an automated email from Gerrit. Antonio Borneo (borneo.anto...@gmail.com) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/4824
-- gerrit commit 81c2bb07aeefdc797fef0b3b5a1d87fdff077f6a Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Fri Dec 7 22:11:12 2018 +0100 drivers/stlink_usb: fix stlink_usb_read_regs() for API v2 API v2 implementation for command READALLREGS returns the status in the first two bytes, followed by two bytes of padding. This makes the reply 4 bytes longer and changes the offset of the first register value to 4. Fix it for the case API v2 and clean-up the management of the return value. Change-Id: I448c82bcc0baa72d66fdfe7f0c525b94f8a4468b Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index e7375e9..3108c0b 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -1688,20 +1688,21 @@ static int stlink_usb_read_regs(void *handle) assert(handle != NULL); - stlink_usb_init_buffer(handle, h->rx_ep, 84); + stlink_usb_init_buffer(handle, h->rx_ep, 88); h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_COMMAND; - if (h->version.jtag_api == STLINK_JTAG_API_V1) + if (h->version.jtag_api == STLINK_JTAG_API_V1) { + h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV1_READALLREGS; - else + res = stlink_usb_xfer(handle, h->databuf, 84); + /* regs data from offset 0 */ + } else { h->cmdbuf[h->cmdidx++] = STLINK_DEBUG_APIV2_READALLREGS; + res = stlink_usb_xfer(handle, h->databuf, 88); + /* status at offset 0, regs data from offset 4 */ + } - res = stlink_usb_xfer(handle, h->databuf, 84); - - if (res != ERROR_OK) - return res; - - return ERROR_OK; + return res; } /** */ -- _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel