aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2023-02-17 18:26:05 -0800
committerAntonio Borneo <borneo.antonio@gmail.com>2023-02-26 10:03:42 +0000
commit0a20e78b759efa86a676b4a9fed4027fdd84e90c (patch)
tree272d425dba882c33a8fb5aa28583c5810dc53709
parentc99c043f3f6e79e391debee29371360b0965b2d6 (diff)
downloadriscv-openocd-0a20e78b759efa86a676b4a9fed4027fdd84e90c.zip
riscv-openocd-0a20e78b759efa86a676b4a9fed4027fdd84e90c.tar.gz
riscv-openocd-0a20e78b759efa86a676b4a9fed4027fdd84e90c.tar.bz2
jtag/drivers/cmsis_dap: run queue on reaching transaction limit
We currently fail the transfer when issuing more than 255 transactions at once, e.g. > read_memory 0x10000000 32 256 CMSIS-DAP transfer count mismatch: expected 257, got 1 This is because the protocol only supports 255 transactions per packet (65535 for block transactions), and as a result we truncate the transaction count when assembling the packet. Fix it by running the queue when we hit the limit. Change-Id: Ia9e01e3af5ad035f2cf2a32292c9d66e57eafae9 Signed-off-by: Peter Collingbourne <pcc@google.com> Fixes: 40bac8e8c4e5 ("jtag/drivers/cmsis_dap: improve USB packets filling") Reviewed-on: https://review.openocd.org/c/openocd/+/7483 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
-rw-r--r--src/jtag/drivers/cmsis_dap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c
index 0c42a7f..1e7a851 100644
--- a/src/jtag/drivers/cmsis_dap.c
+++ b/src/jtag/drivers/cmsis_dap.c
@@ -1001,12 +1001,14 @@ static void cmsis_dap_swd_queue_cmd(uint8_t cmd, uint32_t *dst, uint32_t data)
block_cmd);
unsigned int resp_size = cmsis_dap_tfer_resp_size(write_count, read_count,
block_cmd);
+ unsigned int max_transfer_count = block_cmd ? 65535 : 255;
/* Does the DAP Transfer command and the expected response fit into one packet?
* Run the queue also before a targetsel - it cannot be queued */
if (cmd_size > tfer_max_command_size
|| resp_size > tfer_max_response_size
- || targetsel_cmd) {
+ || targetsel_cmd
+ || write_count + read_count > max_transfer_count) {
if (cmsis_dap_handle->pending_fifo_block_count)
cmsis_dap_swd_read_process(cmsis_dap_handle, 0);