aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2021-06-08Call keep_alive() more often. (#616)Tim Newsome2-6/+7
When it doesn't do anything (most of the time) it has negligible performance impact. With slower remote bitbang, and multiple spike instances being tested in a single chain, things are sufficiently slow that if a computer is busy then this is required to pass riscv-tests/debug. Change-Id: I8816efedaa0cc3b25734ba8fdc979ee4502284a1 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-06-07Print dcsr.cause always (#617)Jan Matyas1-1/+3
Minor change/debug print: Made sure that dcsr.cause is printed into the log always.
2021-05-28Refactor opcodes.h (#613)Xiang W1-105/+82
Simplify the code and prevent some field of the instruction from overflowing Change-Id: I0acade05ad351d0e1918be4b75702b1637aa02c9 Signed-off-by: Xiang W <wxjstz@126.com>
2021-05-28Remove gnulib. (#615)Tim Newsome39-6204/+33
Just use regular lists in FreeRTOS.c. O(n) lookups should be fine. Change-Id: I5dc7b2fd209e0214a87d73bd6c4b63fd664bf49a Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-20remove needless function declaration from src/target/riscv/program.h (#608)wxjstz1-10/+0
Signed-off-by: Xiang W <wxjstz@126.com>
2021-05-20Add keepalive for vector register access. (#611)Tim Newsome1-0/+2
(And whatever else does a lot of register writes.) Change-Id: I86a1a784fb7b9430aa470dbb39a495b89f56d8c9 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-18Merge pull request #604 from riscv/remote_bitbang_bufTim Newsome1-35/+78
Remote bitbang buf
2021-05-17remote bitbang, flush resets.Tim Newsome1-1/+7
Waiting until the next execute_queue() might mean the target doesn't see the reset signal asserted for a significant amount of time. Change-Id: Id8514ddb30e88040131a6dba2b90b65463f10b76 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-17Merge pull request #605 from riscv/rtos_riscvTim Newsome1-19/+0
Remove enable_rtos_riscv command.
2021-05-16riscv: replace macro DIM() with ARRAY_SIZE()Antonio Borneo3-15/+9
OpenOCD already defines the macro ARRAY_SIZE, while riscv code uses a local macro DIM. Prefer using the macro ARRAY_SIZE() instead of DIM(). Not all the riscv code has been upstreamed, yes; this patch only covers the code already upstreamed. Change-Id: I89a58a6d91916d85c53ba5e4091b558271f8d618 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-16riscv: prefer ARRAY_SIZE() to DIM()Antonio Borneo2-8/+8
OpenOCD already defines the macro ARRAY_SIZE, while riscv code uses a local macro DIM. Prefer using the macro ARRAY_SIZE() instead of DIM(). Not all the riscv code has been upstreamed, yes; this patch only covers the code not upstreamed. Change-Id: Ie3e411280f76bc798f1d51c2574cfec148ee0d0d Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-16riscv: drop unused variableAntonio Borneo1-3/+0
The array newly_halted[] is assigned but its value is never used. Drop it! Change-Id: I678812a31c45a3ec03716e3eee6a30b8e8947926 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-14Remote enable_rtos_riscv command.Tim Newsome1-19/+0
I'd missed this when that functionality was removed. Change-Id: If5b697d9dbac517a077d9c1826c747fc95b19f1f Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-14Also flush in execute_queue().Tim Newsome1-1/+12
This improves CheckMisa time from 3.11s to 2.94s. (Why are both these times slower than in yesterday's commit message? I have no idea. Gremlins in my PC?) Change-Id: I05bd868b8aaf4220dca265bd494dfe889552716f Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-14Rename existing buffer to recv_buf.Tim Newsome1-24/+24
Change-Id: I11105e7a962e498e04758eada0f6eb589f8fcfb7
2021-05-13Fill the buffer before blocking on 1-byte read.Tim Newsome1-0/+4
Speeds up spike64-2 CheckMisa from 3.49s to 2.92s. Change-Id: Id4d4042b043f560ef90d58777d99cdcc41053b18 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-12Keep alive when accessing registers.Tim Newsome1-0/+4
With the bitbang performance decrease and talking to slower targets (daisy chain spike) we more often don't meet the expected keepalive time for gdb. This addresses the cases I ran into. Change-Id: Ie69c2c602c3be9c156e508fdfa6d0178f104e1d8 Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-11Speed up a little again by buffering writes.Tim Newsome1-11/+33
We need to read more than one byte at a time to get the original speed back. OpenOCD mailing list suggests using fread/fwrite instead of implementing our own buffering as we did here. Change-Id: I261c743ee6c40c54bfd57a919f074512a1c40bee
2021-05-03Add keep_alive() to system bus read loop.Tim Newsome1-0/+1
Without it the repeat read test wasn't passing any longer. This is because 7dd323b26d93e49e409e02053e30f53ac8138cd5 reduced the remote bitbang performance. I've notified the mailing list about this. Change-Id: Ie71592792202423aec89fa889b9e3d2a60a3c25f Signed-off-by: Tim Newsome <tim@sifive.com>
2021-05-03Fix build.Tim Newsome1-1/+1
Change-Id: Icb7318c8ea6eaeace503d6d2171b34e59a6449db
2021-05-03Merge branch 'master' into from_upstreamTim Newsome55-860/+1933
I may have broken memory sampling with this merge. Conflicts: doc/openocd.texi src/helper/command.c src/jtag/drivers/ftdi.c src/rtos/FreeRTOS.c Change-Id: I2b7e09b2d3b244db546c5212532e6b48fb66dca4
2021-05-02cortex_m: implement hit_watchpoint functionTarek BOCHKATI1-0/+30
this change aims to provide a better gdb debugging experience, by making gdb understand what's really happening. before this change when hitting a watchpoint - openocd reports "T05" to gdb - gdb displays: Program received signal SIGTRAP, Trace/breakpoint trap. after the change - openocd reports "T05watch:20000000;" to gdb - gdb displays: Hardware watchpoint 1: *0x20000000 Old value = 16000000 New value = 170000000 ... Change-Id: Iac3a85eadd86663617889001dd04513a4211ced9 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6181 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-02tcl/board: add pico-debug supportPeter Lawrence3-0/+456
pico-debug is not a board; it is a virtual CMSIS-DAP adapter that runs on the same RP2040 also being debugged. This is possible due to pico-debug running on the normally-dormant second Cortex-M0+ core (Core1), providing debugging of the first core (Core0). As such, it could be used on a variety of RP2040-based boards. Since a flash driver is useful (if not essential), a flash driver is included. This driver code originated on RPi's bespoke OpenOCD fork; lipstick was added to this particular pig to make it more presentable on OpenOCD proper. no new Clang analyzer warnings Change-Id: I31f98b5ea1664f0adfbc184b57efba963acfb958 Signed-off-by: Peter Lawrence <majbthrd@gmail.com> Reviewed-on: http://openocd.zylin.com/6075 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-02flash/nor/stm32f1x: Add support for GD32F1x0/3x0asier701-4/+34
Nowadays, when it's difficult to buy STM32F030, the use of GD32F130 seems to be an interesting functional alternative. This is cortex-M3 and it works with the stm32f1x driver, but unfortunately not fully. The main difference is another offset of user option bits (like WDG_SW, nRST_STOP, nRST_STDBY) in option byte register (FLASH_OBR/FMC_OBSTAT 0x4002201C). Any use of functions like lock or unlock results in change default values of the those bits stored in flash. Thus broken microcontroller is malfunctioning, e.g. flash block programming is interrupted by unexpected active hardware watchog (after 0.4s). This patch is a simplified version of #4592 done by Dominik Peklo (http://openocd.zylin.com/#/c/4592/). GigaDevice GD32F1x0 & GD32F3x0 series devices share DEV_ID with STM32F101/2/3 medium-density line, however they use a REV_ID different from any STM32 device, so can be succesfully detected. Change-Id: I252cdf738d94983b70676a3497326f90c329e292 Signed-off-by: asier70Andrzej Sierżęga <asier70@gmail.com> Reviewed-on: http://openocd.zylin.com/6164 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01Cleanup of config/includes.Tim Newsome55-12/+81
Remove a use of AH_BOTTOM from configure.ac. This macro is used by autoheader to add '#include' of some include file to the end of config.h.in and then to config.h. OpenOCD can be built with a custom config.h, so it's preferable to move these '#include' statement directly in the C files that need them dropping this unneeded dependency. It also causes problems when I want to use the gnulib library (which comes with its own Makefile, and does not have the same include path as the top-level Makefile). So this change touches a lot of files, but is actually really simple. It does not affect functionality at all. Change-Id: I52c70bf15eb2edc1dd10e0fde23b2bcd4caec000 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/6171 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-01drivers/ftdi: drscan: Skip DR-PAUSE when endstate == IDLELuis de Arquer1-8/+23
Currently, all drscan commands will cycle through DR-PAUSE before reaching TAP-IDLE. This patch provides a different path on FTDI driver. This change is required for the ST On Chip Emulator (OnCE), to avoid re-enabling the OnCE tap after every DRSCAN. This is because the OnCE TAP (see ST Application Note AN4035) gets disabled if DR-PAUSE is entered before DR-UPDATE. With this commit, the current path: DR-SHIFT -> DR-EXIT1 -> DR-PAUSE -> DR-EXIT2 -> DR-UPDATE -> IDLE is changed to: DR-SHIFT -> DR-EXIT1 -> DR-UPDATE -> IDLE only if IDLE is the endstate (which is the driver default). Before this patch, once the SHIFT sequence is complete, the driver would normally move to the nearest stable state, which is DR-PAUSE, by clocking out a '10' binary sequence. Then it would follow the path provided by tap_get_tms_path() to reach endstate. It is done this way because tap_get_tms_path() only supports stable states. After this patch, the strategy is mostly the same, with the exception that, if TAP_IDLE is the endstate, a '110' binary sequence is output after completing the SHIFT sequence. This takes the TAP directly to IDLE, with no further action required. A scheme of the DR chain is shown below. A * character is used to mark the stable states. ---------------------------------------------------------------------- | | 0 v 1 0 0 1 0 1 1 | IDLE* -> SEL-DR -> CAPTURE -> SHIFT* -> EXIT1 -> PAUSE* -> EXIT2 -> UPDATE | ^ 1 | | ----------------------------- Change-Id: Ib413e5c4c0bbf75dae0b4672119bae4ef03d0258 Signed-off-by: Luis de Arquer <luis.dearquer@inertim.com> Reviewed-on: http://openocd.zylin.com/6123 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2021-05-01telnet: auto-completion of "registered" commandsTarek BOCHKATI1-25/+223
auto-completion behavior: - if there is only one matched command complete the user-command - else if multiple matches add the common part then in second step list all matched commands - sub-commands are handled in the same way - auto-completion restarts after these characters ';', '[', '{' Change-Id: I1b81dd19191a5785e68d0bb5cd244e01a4dd0587 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6095 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-01jtag: simplify the calls to Jim_SetResultFormatted()Antonio Borneo2-11/+6
The documentation of Jim_SetResultFormatted() reports that the jim objects passed as arguments would be freed if have zero refcount. Remove the useless Jim_IncrRefCount()/Jim_DecrRefCount(). Remove the dangerous Jim_FreeNewObj() that should trigger a double free(). Not tested due to lack of aice adapter. While there, rename some CamelCase symbol. Change-Id: Ic56704c83d6391c38f6b0efa6566784d453bc0fb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6190 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/command: drop the TCL variable 'ocd_HOSTOS'Antonio Borneo1-34/+0
Commit 7a731eb63731 ("Added HostOS variable"), merged in 2009, adds a TCL global variable 'ocd_HostOS' that reports in a string the OS of the host. This was proposed as a workaround for jimtcl that didn't define the standard TCL variable 'tcl_platform(os)'. With commit 42f3fb7b7f46 ("Determine platform_tcl() settings with configure"), merged in 2010 and part of jimtcl 0.70 issued in early 2011, jimtcl provides the requires TCL standard variable 'tcl_platform(os)'. The variable 'ocd_HostOS' has never been used by any TCL script distributed with OpenOCD. Drop the TCL variable 'ocd_HostOS'. Change-Id: I27858de35cc9d30df97145ca1ccd24877be4af11 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6189 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/command: fix memory leak on malloc() failAntonio Borneo1-5/+9
If malloc() fails, the just allocated Jim_Obj will leaks. Move Jim_IncrRefCount() before the malloc() and deallocate the Jim object with Jim_DecrRefCount() on malloc() fail. While there, add the 'out of memory' log and fix the CamelCase name of the symbol tclOutput. Change-Id: Ic733db229d5aa5d477d758ea9cb88cd81d7542cd Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6188 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/jim-nvp: remove unused function Jim_nvpInit()Antonio Borneo1-6/+0
The files jim-nvp.[ch] were originally inside jimtcl, then in 2011 they were dropped by jimtcl and integrated in OpenOCD. The initial purpose was to make them as an independent library, thus the presence of an 'init' function. Being now part of OpenOCD do not require the 'init' function anymore, that is still empty and unused, plus its name is in violation of the coding style. Drop the function Jim_nvpInit(). Change-Id: I429e10444c86a26dbdc22aa071315324dc5edc3e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6187 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/types: remove type '_Bool'Antonio Borneo1-7/+1
Accordingly to OpenOCD coding style, both typedef and Camelcase symbols are forbidden. The type '_Bool' is not used in the code, having 'bool' as preferred choice. Remove the definition of '_Bool' from 'types.h'. Change-Id: I8863f9836ccd9166e0c69fa5d75d6fef79ae7bfb Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6186 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/replacements: remove unused typedef'sAntonio Borneo1-2/+0
The ELF typedef's 'Elf32_Sword' and 'Elf32_Hashelt' are not used within OpenOCD. Plus, being their name in CamelCase require extra effort to include them in the exceptions for checkpatch. Remove the unused typedef's. Change-Id: I18f039567edd5b24dbb41df5406c154f31022ae7 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6178 Tested-by: jenkins Reviewed-by: Christian Hoff <christian.hoff@advantest.com>
2021-05-01target/image: report error if ELF file contains no loadable sectionsChristian Hoff1-2/+8
The existing code asserted in that case, which is not correct. This would allow the user to crash OpenOCD with a bad ELF file, which is not what we want. A proper error should be reported in that case and OpenOCD should not crash. Change-Id: Ied5a6a6fd4ee0fd163f3fe850d304a121ecbe33a Signed-off-by: Christian Hoff <christian.hoff@advantest.com> Reviewed-on: http://openocd.zylin.com/6172 Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-05-01target/image: allow loading of 64-bit ELF filesFlorian Meister3-59/+346
Change-Id: I9b88edacf5ffcc3c1caeab8c426693de0d92a695 Signed-off-by: Florian Meister <florian.meister@advantest.com> Signed-off-by: Christian Hoff <christian.hoff@advantest.com> Reviewed-on: http://openocd.zylin.com/5204 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Ooi, Cinly <cinly.ooi@intel.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01libusb: don't use typedef'sAntonio Borneo12-40/+40
Libusb defines both the struct and a typedef to the struct using the same struct name. It's then possible to use either 'struct x' and 'x'. E.g.: typedef struct libusb_device libusb_device; OpenOCD is not consistent and uses a mix of 'struct x' and 'x'. To make OpenOCD code uniform, stick at project's coding style and use 'struct x' in place of the typedef'd name. Change-Id: I901458b680e42830d3f371e47997157f91b7f675 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6165 Tested-by: jenkins Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li> Reviewed-by: Marc Schink <dev@zapb.de> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-05-01helper/command: fix build with jimtcl 0.79 or olderAntonio Borneo1-0/+4
Commit a7d68878e4ba ("helper/command: unregister commands through their full-name") introduces for the first time in OpenOCD the use of jimtcl API Jim_DeleteCommand(). The prototype of Jim_DeleteCommand() has changed with jimtcl 0.80 and the current code doesn't build with jimtcl 0.79 or older. This is an issue for those distributions, like Debian, that provide jimtcl as a separate package/library and have not switched yet to the new jimtcl version. Add a compile-time condition to cope with the jimtcl API change. Change-Id: Ic813ab7c0ebd3c8772f27775ba3912a47d5c275c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Fixes: a7d68878e4ba ("helper/command: unregister commands through their full-name") Reviewed-on: http://openocd.zylin.com/6191 Tested-by: jenkins
2021-04-30cortex_m: mark FPU register as non-existent instead of playing with num_regsTarek BOCHKATI2-15/+11
Change-Id: Iac7c5bfbb95c8d9a8c6d65104d138692a44eca78 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/6015 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-04-30target/armv7m: change FPv4_SP and FPv5_SP/DP identifiers to uppercaseTomas Vanek4-8/+8
Change-Id: Ia421a973e5fb4767715c9f95c91745f8ca1de1da Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6177 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-04-25target/arm_adi_v5: move DP register definitions to one blockTomas Vanek1-8/+9
DP and MEM-AP definitions were mixed. Change-Id: I2f691b2274c01e9090c1e5160c6903d3207e35c2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6138 Tested-by: jenkins
2021-04-25target/adi_v5_swd: remove double space from swd_cmd() parametersTomas Vanek1-4/+4
Change-Id: I6b68868947010512c4de76e5d37142f067e27b06 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6137 Tested-by: jenkins
2021-04-25drivers/cmsis-dap: add multidrop capabilityPeter Lawrence1-2/+65
Uses CMSIS-DAP v 1.2 or higher protocol command DAP_SWD_Sequence to write to DP TARGETSEL register. This write is not acknowledged by device so we cannot use standard DAP_Transfer Change-Id: Ib252d09570bcc2282be5f854e0ab9a0dfda06189 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6117 Tested-by: jenkins Reviewed-by: Peter Lawrence <majbthrd@gmail.com>
2021-04-25target/arm_adi_v5: add JTAG_TO_DORMANT sequenceTomas Vanek1-0/+1
Change-Id: Ie9e32e42a84cf88bf779e691a67c114eef1bb457 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6136 Tested-by: jenkins
2021-04-25smp: move command deprecation to startup.tclAntonio Borneo2-34/+31
Commit 246782229f8f ("smp: replace commands smp_on/smp_off with "smp [on|off]"") deprecates some multi-word comments, when openocd was unable to properly handle mixes of multi-word commands and tcl procedures having a common initial word. This limitation is over, so move in startup.tcl the multi-word commands deprecation, making it easy to remove them after a grace period. Change-Id: Icb550d1fa7559b95692d2a1244880da6c90ec0b2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5677 Tested-by: jenkins
2021-04-24remote_bitbang: Add Windows supportYun Liu1-36/+19
Windows socket descriptor is not file descriptor, so when using remote_bitbang on Windows, it fails with "fdopen: failed to open write stream". This patch removes the file write stream, replaces it with socket write calls. Change-Id: Ifd7c8a4139a5ac51ecd2846835a7a947a90fe16c Signed-off-by: Yun Liu <liuyun.97@gmail.com> Reviewed-on: http://openocd.zylin.com/6096 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2021-04-22flash/nor/nrf5: Fix data types and const correctnessMarc Schink1-14/+7
Change-Id: I8c5bac7098d92e9b3bd1b045735879cf32ac218d Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6163 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2021-04-22flash/nor/numicro: Use 'bool' data typeMarc Schink1-1/+1
Change-Id: Ib4ee64dec9c1253ae45bc58e9f175ab36964180a Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/6162 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2021-04-20Fix build on systems without usb.h (#599)Rupert Swarbrick1-1/+0
This include seems to have been left over from a merge commit (7420382). Change-Id: I930f53fe943654d23fe915a50856512546d4f10d Signed-off-by: Rupert Swarbrick <rswarbrick@gmail.com>
2021-04-18drivers/cmsis-dap: flush readTomas Vanek1-0/+19
Some CMSIS-DAP adapters keep buffered packets over USB close/open so we need to flush up to 64 old packets to be sure all buffers are empty. Flush just after cmsis_dap_open() and in the case of command mismatch. Change-Id: If21a118639e64d90635b4ecf81013d29a7b9f78d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6135 Tested-by: jenkins Reviewed-by: Adrian M Negreanu <adrian.negreanu@nxp.com>
2021-04-18drivers/cmsis-dap: improve error checkingTomas Vanek1-20/+43
Check returned HID report number (or the first byte of returned bulk packet) which should be equal to the issued command or 0xff in case of the command is not implemented. Fix error return paths in cmsis_dap_init() to clean up the adapter connection. Don't fail cmsis_dap_init() when an unimportant function fails (for the case the adapter doesn't implement some parts of protocol). Change-Id: Ief8382aabe9915346b2273702fb2ff17bbb5eb1b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/6121 Tested-by: jenkins Reviewed-by: Peter Lawrence <majbthrd@gmail.com>