aboutsummaryrefslogtreecommitdiff
path: root/src/jtag/drivers
AgeCommit message (Collapse)Author
2018-12-06stlink: add STLINK_F_HAS_SWD_SET_FREQAntonio Borneo
Change-Id: Ibba786c7e18bf15a04b85a2071c79f631a252ccf Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4709 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_TARGET_VOLTAntonio Borneo
Use an alias to STLINK_F_HAS_TRACE, both are added in the same version Change-Id: Iabf2fdac407f5c4737c3da942323d60ee50c3470 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4708 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add STLINK_F_HAS_TRACEAntonio Borneo
Fix the condition for ST-Link/V1; it does not support trace. Trace is added on ST-Link/V2 and ST-Link/V2.1 only. Change-Id: I17416edd05a2c8ece605560b7533edac4f982cfc Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4707 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: simplify maintenance of version and featuresAntonio Borneo
The number of stlink firmware version is growing, each carrying new features. Today's code has several check distributed here and there and it's already hard to track them and verify the correctness. The introduction of STLINK-V3 will make the situation much worst, and the code much less readable. Add a "flags" bitmask in the struct stlink_usb_version to allow setting individual bits for each feature available or for specific quirks and workarounds. This patch does not implement setting nor testing "flags"; it would be introduced in following patches, one bit at a time. Change-Id: I09d78202646a6c8330731f8aa96dc9d295fa5655 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4706 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: check for SWD supportAntonio Borneo
The old ST-Link/V1 can either run an obsolete firmware with API_V1 or a more recent firmware (from V1J11 to last V1J13) with API_V2. SWD is only provided by the latter API. Return error is SWD is selected on adapters that does not support it. Change-Id: Iac4ba54d191ba80fb445a7cd3d8c2621dc7a4846 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4705 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add support for 16 bit memory read/writeLaurent LEMELE
Recent stlink version V2J26 introduces support for 16 bit memory read/write. Add the new API and modify the wrappers stlink_usb_{read|write}_mem For older version of stlink keep the same behavior as in current code. While there, fix some minor typo in comments inside the wrappers. This fixes ticket #204 ("st-link can't flash stm32f2x based flash without target algorithms"). Change-Id: Id7d404e588f10a4b0f8a93d7ca44cef8e4c49b4f Author: Laurent LEMELE <laurent.lemele@st.com> Rebased-by: Antonio Borneo <borneo.antonio@gmail.com> Ticket: https://sourceforge.net/p/openocd/tickets/204/ Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4704 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-12-06stlink: add JTAG speed selectionLaurent LEMELE
ST-Link uses two separate API for setting the interface speed in SWD and JTAG. Add the missing API for JTAG and run the proper API depending on the selected mode. Change-Id: I71e955e23c1d82c2ea1c8bfade7612c5a0377a74 Author: Laurent LEMELE <laurent.lemele@st.com> Rebased-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4703 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06stlink: add usb pid for v2.1 without mass storage deviceAntonio Borneo
New version of ST-Link/V2.1 without mass storage device. From debug point of view, it is compatible with existing ST-Link/V2.1 It uses a new USB PID because the USB endpoints and interfaces are different from usual ST-Link/V2.1 Add the new PID in the driver, in the tcl interface script and in the udev configuration script. Change-Id: Id2e1b5a5d0347c5d951a86a9cdb76be52cfd4ea3 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4702 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-12-06jtag: drivers: ft232r: unhardcodedEMARD
FT232R: introducing configurable parameters for pinout, initial buffer size, state of RS232 signals at exit with option to reattach kernel driver. All this was hardcoded before. New parameters are documented in "openocd.texi" file. Allows hopfully self-explainable and user-friendly adaptation to various pinouts and similar chips like FT230X and FT231X. Change-Id: Ib807f2ea3d4c1a164d351d65aeacd1978318d217 Signed-off-by: EMARD <vordah@gmail.com> Reviewed-on: http://openocd.zylin.com/4681 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-11-26Set TCP_NODELAY for local connections to jtag_vpi.Darius Rad
This increases performance drematically for local connections, which is the most likely arrangement for a VPI connection. Change-Id: Id15b29ae663f5d8100b2175357649bd03d05b7c8 Signed-off-by: Darius Rad <darius@bluespec.com> Reviewed-on: http://openocd.zylin.com/4549 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-11-10jtag/bitq: array boundary overflowxuguangxiao
The for loop inside bitq_path_move function is not correct, this will overflow the cmd->path array and produces an unpredictable result. Change-Id: I81e3bc9ee6d1dd948acd2fe4c667103ac22bb26f Signed-off-by: xuguangxiao <szgxxu@qq.com> Reviewed-on: http://openocd.zylin.com/4733 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-10-28drivers/cmsis-dap: speed up sending multiple HID requestsTomas Vanek
The performance of CMSIS-DAP in long data transfers was improved substantially in ef02b69b14d133b061217a91add5a028a77e86bc. But it not as good as some other USB/MCU based adapters. Using HID and therefore interrupt endpoint is slower than USB bulk transfer. CMSIS-DAP adapter implements multiple HID buffer handling and OpenOCD already reads number of buffers from info command. This change adds capability to sumbit more than one HID requests before driver waits for a HID response. This scenario is used for long transfers only. Results show about double speed on USB FS and ~140% speed on USB HS: | w/o this change | with multi HIDrq -----------------------------------------+-----------------+----------------- Open source CMSIS-DAP, USB FS, adapter_khz 1000 dump_image ram32k.bin 0x1fffe000 0x8000 | 23.225 KiB/s | 45.901 KiB/s load_image ram32k.bin 0x1fffe000 | 23.324 KiB/s | 46.552 KiB/s Cypress' Kitprog in CMSIS-DAP mode, USB FS, adapter_khz 1000 (over firmware limit) dump_image ram64k.bin 0x20000000 0x10000 | 15.537 KiB/s | 42.558 KiB/s load_image ram64k.bin 0x20000000 | 15.605 KiB/s | 43.291 KiB/s Atmel's EDBG, USB HS, adapter_khz 10000 (#3945 applied) dump_image ram384k.bin 0x20400000 0x6000 | 248.402 KiB/s | 345.250 KiB/s load_image ram384k.bin 0x20400000 | 256.039 KiB/s | 365.945 KiB/s Change-Id: I9edbe018086176d357c6aaba5d6b657a5e5e1c64 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4080 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-10-16ftdi: demote unhelpful debug messagesSteven Stallion
Some protocols make use of empty scan fields for optional padding, which causes the log to fill with unhelpful messages that a field is empty. The remaining LOG_DEBUG messages in ftdi_execute_scan have been demoted to DEBUG_JTAG_IO such that these messages are only seen when debugging JTAG. Change-Id: I61fd4551411ce851da34e67d003bca5d7a71cd92 Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4112 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2018-10-16jtag: make cmd_queue_scan_field_clone publicSteven Stallion
This patch makes the cmd_queue_scan_field_clone function public. This permits targets to insert fields without affecting the submitted scan_field list. This will be used in an upcoming target implementation that needs to insert additional padding bits. Change-Id: I8fbd3b9b4e413432471f4f1444048932c8fa189e Signed-off-by: Steven Stallion <stallion@squareup.com> Reviewed-on: http://openocd.zylin.com/4082 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-10-09drivers: cmsis-dap: fix connection in JTAG modeAntonio Borneo
Commit 5aceec24122bc222896cfcfd91f7f082f630ac83 ("drivers: cmsis-dap: pull up common connect code") breaks the driver and it cannot connect anymore in JTAG mode. The issue is caused in cmsis_dap_init() by anticipating the call to cmsis_dap_usb_open(), which then sets cmsis_dap_handle and makes the following test to always fail. Actually the original code was quite tricky: if (swd_mode) do something that also sets cmsis_dap_handle; if (cmsis_dap_handle == NULL) do something for !swd_mode; Convert the sequence of tricky "if"s in a single "if-then-else" to handle clearly the cases swd_mode and !swd_mode. Change-Id: I359a23bf26a3edc2461f4352daa0be83e78868f7 Fixes: 5aceec24122b ("drivers: cmsis-dap: pull up common connect code") Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4697 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2018-09-10ftdi: extend ftdi_location formatOleksij Rempel
To existing <bus>:<port>,<port> format add <bus>-<port>.<port> support. The last format is used by kernel and other drivers. Change-Id: I6528970d3af4f6a8bf7b27a0f7a763b5957fdf2b Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-on: http://openocd.zylin.com/4631 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-09-07libusb: return oocd error valuesOleksij Rempel
keep same return style where possible Change-Id: I2f9b85dbc307a483609f76a84de77e3c74d346c7 Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-on: http://openocd.zylin.com/4588 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-07-25drivers: cmsis-dap: print serial if availableKarl Palsson
Helpful for sanity checking connections Change-Id: Ife0d8b4e12d4c03685aac8115c9739a4c1e994fe Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/3405 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-07-24usb_blaster: Don't unnecessarily go through DR-/IR-PauseDaniel Glöckner
There is no need to pass through DR-/IR-Pause after a scan if we want to go to DR-/IR-Update. We just have to skip the first step of the path to the end state because we already did that step when shifting the last bit. v2: - Fix comments as remarked in review of v1 Change-Id: I3c10f02794b2233f63d2150934e2768430873caa Signed-off-by: Daniel Glöckner <daniel-gl@gmx.net> Reviewed-on: http://openocd.zylin.com/4245 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-07-23drivers: cmsis_dap_usb: implement cmd JTAG_TMSAntonio Borneo
Simply add a wrapper around cmsis_dap_cmd_DAP_SWJ_Sequence() Change-Id: Icf86f84b24e9fec56e2f9e155396aac34b0e06d2 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4517 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2018-07-23Avoid dereferencing NULL pointer.Darius Rad
If a NULL pointer is passed, don't attempt to increment it. This avoids passing the now not-NULL pointer on and eventually segfaulting. Also remove some unnecessary temporary variables. Change-Id: I268e225121aa283d59179bfae407ebf6959d3a4e Signed-off-by: Darius Rad <darius@bluespec.com> Reviewed-on: http://openocd.zylin.com/4550 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2018-07-19target/armv7m_trace: Use prefix for enumsMarc Schink
Change-Id: I3f199e6053146a1094d96b98ea174b41bb021599 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3905 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-07-19target/armv7m_trace: Fix typo in enumMarc Schink
Change-Id: I6364ee5011ef2d55c59674e3b97504a285de0cb2 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3904 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-07-18drivers: cmsis-dap: Print version info when availableKarl Palsson
No need to wait until after connecting, might help diagnose part information by printing earlier. Change-Id: I51eb0d584be306baa811fbeb1ad6a604773e602c Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/3404 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-07-18drivers: cmsis-dap: pull up common connect codeKarl Palsson
Just a minor deduplication Change-Id: Idd256883e5f6d4bd4dcc18462dd5468991f507b3 Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/3403 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-07-03jtag/drivers/cmsis-dap: fix connect in cmsis_dap_swd_switch_seq()Antonio Borneo
The proc cmsis_dap_swd_switch_seq() is part of the SWD API for this interface driver. It is valid only when the interface is used in SWD mode. In this proc there is the need to call, in sequence, first cmsis_dap_cmd_DAP_Disconnect() then cmsis_dap_cmd_DAP_Connect(). The latter call requires the connection mode as parameter, that inside cmsis_dap_swd_switch_seq() can only be CONNECT_SWD. The current implementation is not correct and in some cases can pass mode CONNECT_JTAG. Moreover, JTAG is optional in CMSIS-DAP and passing mode CONNECT_JTAG triggers an error with SWD-only interfaces. Use mode CONNECT_SWD in SWD specific cmsis_dap_swd_switch_seq(). Change-Id: Ib455bf5b69cb2a2d146a6c8875387b00c27a5690 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4571 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-06-06drivers: xds110: Remove unnecessary and deprecated libusb function.Edward Fewell
libusb-1.0.22 has deprecated the libusb_set_debug function. This function was present in the XDS110 driver as an artifact left over from early debugging. It isn't required because logging is disabled by default. Removing it to simplify the code and no longer need to have libusb version specific #if's in the code. Change-Id: I9c3f16c039da3f3fad9c4a1169978b0d85a1b45c Signed-off-by: Edward Fewell <efewell@ti.com> Reviewed-on: http://openocd.zylin.com/4553 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2018-06-05Fix libusb-1.0.22 deprecated libusb_set_debug with libusb_set_optionKhem Raj
libusb_set_debug is deprecated in libusb >= 1.0.22 therefore replace with equivalent libusb_set_option() API Change-Id: Ic0287a1bc0ccc90afe8e4c688085f0b25a7fb004 Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-on: http://openocd.zylin.com/4540 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-05-31jtag: drivers: sysfsgpio: lift upper gpio number limitPaul Fertser
Recent Linux maps GPIOs from 1023 downwards so do not limit the number to 1000. This should fix #183. Change-Id: I6d4f493b670be9ed9b82759f0fb686a9faddbbf5 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4502 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-05-31jtag/drivers: Add support for TI XDS110 debug probeEdward Fewell
Add support for the XDS110 debug probe using the APIs in the probe's firmware. Includes support for older versions of the firmware (with reduced performance) and support for a newer version that includes OpenOCD specific APIs. Tested on various TI LauchPads including MSP432P4, MSP432E4, CC2650, CC2652, and CC3220SF. Updated to add better support for swd switch. Removed issues found with clang static analysis. Updated to add rules entry for the XDS110 probe and Tiva DFU mode (which affects both XDS110 and ICDI probes). Change-Id: Ib274143111a68e67e80003797c6a68e3e80976b2 Signed-off-by: Edward Fewell <efewell@ti.com> Reviewed-on: http://openocd.zylin.com/4322 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-05-30Fix warnings exposed by GCC8Paul Fertser
gcc (GCC) 8.1.0 generates new warnings and thus fails the build. The ARM disassembler warnings actually exposed a bug in SMALW, SMULW and SMUL instructions decoding. Reported by Eimers on IRC. Change-Id: I200c70f75a9e07a1f13a592addc1c5fb37714440 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4526 Tested-by: jenkins Reviewed-by: Jiri Kastner <cz172638@gmail.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-04-04drivers/kitprog: workaround KitProg firmware bug of missing ZLPTomas Vanek
KitProg firmware does not send a zero length packet at the end of the bulk-in transmission of a length divisible by a bulk packet size. This is inconsistent with the USB specification and results in jtag_libusb_bulk_read() waits forever when a transmission of specific size is received. Limit bulk read size to expected number of bytes for problematic tranfer sizes. Use 1 second timeout as the last resort. Change-Id: Ice80306424afd76e9fbc6851911ffd5109c84501 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4426 Tested-by: jenkins Reviewed-by: Bohdan Tymkiv <bhdt@cypress.com>
2018-03-15drivers/ftdi: free allocated memoryTomas Vanek
Also uses calloc() for mpsse_ctx->write_buffer to prevent a false positive valgrind report "Syscall param ioctl(USBDEVFS_SUBMITURB).buffer points to uninitialised bytes(s)" Change-Id: I91963371d15c21ea0fee4c40c1da86174db44520 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4418 Tested-by: jenkins
2018-03-13jtag: drivers: add support for FT232R sync bitbang JTAG interfacesMatej Kogovsek
Change-Id: Ib88a9e270f5c2a50902a137bcc97fdefd5aad1c6 Signed-off-by: Matej Kogovsek <matej@hamradio.si> Reviewed-on: http://openocd.zylin.com/4215 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2018-03-12jtag: drivers: buspirate: fix abuse of "char" typePaul Fertser
Change occurrences of char to uint8_t where appropriate as a binary protocol is used to talk to this adapter. This fixes a build issue with modern clang. Change-Id: I21cc82c8cad148bd0977533c12c74a9d6ba2faff Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4462 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-03-12Add SWD protocol support to buspirate (2nd try)Mateusz Manowiecki
This is a second try for this patch. I removed the queues from the previous version. I made it compatible with SRST reset and added support for those features that could be supported in raw binary mode. Change-Id: I96fc06abbea9873e98b414f34afd9043fd9c2a41 Signed-off-by: Mateusz Manowiecki <segmentation@fault.pl> Reviewed-on: http://openocd.zylin.com/3960 Tested-by: jenkins Reviewed-by: Eric Work <work.eric@gmail.com> Reviewed-by: Thomas Jarosch <thomas.jarosch@intra2net.com> Reviewed-by: Jacob Alexander <haata@kiibohd.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-02-03jtag: drivers: stlink: ignore write verify errorPaul Fertser
This looks like some inappropriate stlink (mis-)feature and it messes operations for writing to certain memory-mapped registers. Discussed at https://forum.sparkfun.com/viewtopic.php?f=18&t=44949 . Also known to be problematic for working with Kinetis parts. Reported by robertfoss_ on IRC. Change-Id: I8633aed13346c596000ba6c377758e1bb96db73f Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4368 Tested-by: jenkins Reviewed-by: Robert Foss <robert.foss@memcpy.io> Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2018-01-27jtag: drivers: usb_blaster: clarify lowlevel driver selection codePaul Fertser
This patch should make the code logic more transparent and user notifications more useful. It also fixes a warning "array subscript is below array bounds" that leads to FTBFS on Raspbian GNU/Linux 8 (jessie). Change-Id: I626b6a5bc013dfee7d36cf196f0abab981d30675 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3931 Tested-by: jenkins
2018-01-25Add read buffer to bitbang, improving performance.Tim Newsome
Previously for every bit scanned OpenOCD would write the bit, wait for that bit to be scanned, and then read the result. This involves at least 2 context switches. Most of the time the next bit scanned does not depend on the last bit we read, so with a buffer we now write a bunch of bits to be scanned all at once, and then we wait for them all to be scanned and have a result. This reduces the time for one testcase where OpenOCD connects to a simulator from 12.30s to 5.35s! Running all our tests went from 13m13s to 3m55s. Change-Id: Ie9fcea043ac1d7877a521125334ed47d4b3e1615 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4312 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2018-01-25Use timeval helpersChristopher Head
Some of these changes actually fix broken comparisons which could occasionally fail. Others just clean up the code and make it more clear. Change-Id: I6c398bdc45fa0d2716f48a74822457d1351f81a5 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4380 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-13ftdi swd: disable SWD output pin during inputPatrick Stewart
* Disables the data output pin while SWD is reading, so that a simple FTDI SWD interface can be made by connecting TCK to SWD_CLK and TDI+TDO directly to SWDIO. Enabled by setting SWDIO_OE to 0. Change-Id: I7d3b71cf3f4eea163cb320aff69ed95d219190bd Signed-off-by: Patrick Stewart <patstew@gmail.com> Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com> Reviewed-on: http://openocd.zylin.com/2274 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2018-01-13jtag: drivers: sysfsgpio, bcm2835gpio: remove requirement to have trst or srstPaul Fertser
This doesn't seem to make any sense. Change-Id: I272de0ea3c0e86cc9a798cbd864050aaa597c3f0 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3933 Tested-by: jenkins
2018-01-12stlink_usb: Changes to make connect_under_reset workAke Rehnman
Leaving mode before closing added Resolved a collision with JTAG API v1 error/status checking overwriting SWIM status bytes Change-Id: I35444ec0e6caace3e072c60085059602f4cdf0a4 Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com> Reviewed-on: http://openocd.zylin.com/4265 Tested-by: jenkins Reviewed-by: Philipp Klaus Krause Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-12jtag/drivers/stlink_usb : implemented and repaired SWIM supportAke Rehnman
Fixed a bug in stlink_usb_read_mem/write_mem preventing large data transfers The SWIM support in stlink_usb was basically non existent so I have implemented the missing parts. The bCBWCBLength and dCBWDataTransferLength for STLINK-V1 protocol was not correct so that was fixed. The reason for adding SWIM support is to add STM8 support for OpenOCD. I have tested the driver on: STM8 discovery board with the built-in STLINK-V1 STM8 discovery board with STLINK-V2 dongle STM32 vldiscovery board with the built-in STLINK-V1 STM32F1xxx processor with STLINK-V2 dongle Change-Id: I4aa80a92fb0226174356adaf2f8ff949920a621f Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com> Reviewed-on: http://openocd.zylin.com/3952 Tested-by: jenkins Reviewed-by: Philipp Klaus Krause Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-09jtag/drivers/kitprog: Enable LOG_DEBUG_IOForest Crossman
Change-Id: Ic01b0acf01e18bcb2bf98c101c7b5888cdc10186 Signed-off-by: Forest Crossman <cyrozap@gmail.com> Reviewed-on: http://openocd.zylin.com/4323 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-01-03jtag/drivers/cmsis-dap: fix connect under resetTomas Vanek
Commit ef02b69b14d133b061217a91add5a028a77e86bc included a call to cmsis_dap_cmd_DAP_Connect() before calling cmsis_dap_cmd_DAP_SWJ_Sequence(). According to comment it is necessary for at least Keil ULINK-ME. Commit 72c3464be42088dc75245cf2fcc8f5c6e6959b4b added a cmsis_dap_cmd_DAP_Disconnect() before connect call to pair connection/disconnection. It solves some problems on Atmel EDBG. Unfortunately calling either of cmsis_dap_cmd_DAP_Connect() or cmsis_dap_cmd_DAP_Disconnect() deasserts reset signal. So these workarounds break ability to connect under reset. Use cmsis_dap_cmd_DAP_Disconnect() and cmsis_dap_cmd_DAP_Connect() pair only if both SRST and TRST are deasserted. Change-Id: I0914dae0a1360b8c7fe48231ff3867caedfb2dbe Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reported-by: Leonardo Sabino dos Santos <leonardo.sabino@gmail.com> Reviewed-on: http://openocd.zylin.com/4100 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-12-12jtag: drivers: stlink: handle all versions with single configPaul Fertser
Extend HLA interface to allow multiple VID/PID pairs and use it to autodetect the connected stlink version. Change-Id: I35cd895b2260e23cf0e8fcb1fc11a78c2b99c69b Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3961 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-12-06Only call cmsis_dap_cmd_DAP_SWD_Configure when swd_mode is enabledBas Vermeulen
The CMSIS-DAP used by NXP's LS1012ARDB board only supports JTAG, and not SWD. Calling cmsis_dap_cmd_DAP_SWD_Configure returns with an error (and doesn't actually do anything in the debugger). Wrap the call to cmsis_dap_cmd_DAP_SWD_Configure in a check for swd_mode, to make sure initialisation doesn't fail needlessly. Change-Id: Id7e568cb6e36886bd7c5b3699d198a77a51c28c9 Signed-off-by: Bas Vermeulen <bas@daedalean.ai> Reviewed-on: http://openocd.zylin.com/4294 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2017-10-27ftdi: Enable SWDIO output before sending data on itJonas Norling
The SWDIO buffer has to be enabled, by setting SWDIO_OE, for data on SWDIO to reach the target. Explicitly do this before sending the switch sequences for JTAG-to-SWD, etc. This makes the code insensitive to the state of SWDIO_OE specified in ftdi_layout_init. It used to work only on adapters with a non-inverted SWDIO_OE inited to 1, or inverted SWDIO_OE inited to 0. Change-Id: I4b9e520ac1c7ce2a437251a05fc036bc68de718e Signed-off-by: Jonas Norling <jonas.norling@cyanconnode.com> Reviewed-on: http://openocd.zylin.com/4270 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-10-23Fix GCC7 warnings about switch-case fallthroughsFreddie Chopin
GCC7 with -Wextra warns about switch-case blocks which fallthrough with "this statement may fall through [-Werror=implicit-fallthrough=]". This can be fixed by adding "special" comments: "/* fallthrough */". See https://gcc.gnu.org/gcc-7/changes.html Change-Id: Iba0be791dbdd86984489b2d9a0592bb59828da1e Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/4174 Tested-by: jenkins