Commit Graph

1310 Commits

Author SHA1 Message Date
Spencer Oliver 31496c2bed usb_blaster: fix warning: array subscript has type ‘char’
caught by clang 3.4 running on cygwin.

Change-Id: I59f652337334e557fb50374f5270ba9c30392b6e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2100
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
2014-04-14 18:19:56 +00:00
Paul Fertser 3a590658e9 jtag/drivers/remote_bitbang: use sizeof to determine maximum unix socket path length
Different *nix systems use different constants, so sizeof should be
used instead. This fixes the build on OS X (as sun_path length is
hardcoded to 104 on Darwin).

Change-Id: I1df611383dedcfc6d153ec59b453a895c7d84e94
Reported-by: Xiaofan Chen <xiaofanc@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2095
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-04-14 18:16:52 +00:00
Karl Hammar 7256d6acdf parport: add "aspo" hotpluggable adapter config
This adds a new adapter config.

Design files are available from:

http://turkos.aspodata.se/git/openhw/isp/pp_jtag_arm20.sch
http://turkos.aspodata.se/git/openhw/isp/pp_jtag_arm20.pcb

No need to document it anywhere as only a single device was ever
built.

Change-Id: If031fdb9dedb1e544401747bfb7fbc5afc4d5407
Signed-off-by: Karl Hammar <karl@aspodata.se>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2094
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-14 18:13:03 +00:00
Paul Fertser 45f71f1082 Makefile.am: fix build for libftdi1, pass CFLAGS where appropriate
Change-Id: I9d8afa6ae32fc01e69ec434b5bc9d71524d386a2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2079
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-04-14 18:09:40 +00:00
Paul Fertser 9f2bc3b830 jtag/aice/aice_usb: remove unused constants
Those are breaking the build with clang 3.4 (current default compiler
on OS X 10.9.2).

Change-Id: I9f2fbfbb6d544498cb8d6a62565e4ebe7223e784
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2077
Tested-by: jenkins
Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com>
2014-04-08 11:37:36 +00:00
Andreas Fritiofson e6907e6d7e Don't cast return value of [cm]alloc
Change-Id: I0028a5b6757b1ba00031893d9a2a1725f915a0d5
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2069
Tested-by: jenkins
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-30 03:53:45 +00:00
Paul Fertser 7301bf1a67 Add usb_blaster cheap clone notes to dist
Change-Id: Ie9569634415ef76e88d5ca58bae6184838cf7114
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1908
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:56:13 +00:00
Paul Fertser 7a16340343 Add rlink speed table sources and everything related to dist
GPL requires providing sources for any derived work. I do not see any
reason to not include the rlink stuff into release tarballs.

Change-Id: I686ab88994030312aca5bdfe731a72f10803b5c3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1907
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29 07:55:50 +00:00
Andrey Yurovsky fb897cc805 jlink: add support for Jlink-OB (0x0105) devices
The JLink-OB (onboard) devices work the same way as the normal JLink
except that their PID is 0x0105 (and that's the only one we know of so
far) and their endpoint addresses are different due to there being a
CDC-ACM interface as well.  These JLink-OB devices show up on a lot of
vendors' development kits as an integrated debugger.

This change simply checks whether the adapter we opened has a JLink-OB
PID and, if it does, uses the JLink-OB endpoints rather than the
default.  To do this, we add a new routine, jtag_libusb_get_pid() to the
libusb adapter layer, it in turn just calls
libusb_get_device_descriptor(), which previously had no wrapper.

Also, checkpatch.pl doesn't like the VID/PID macros as defined so I
moved them to the array itself.  This should have no effect on the code.

This change adds the 0102 through 0104 PIDs to openocd.rules as well as this
new 0105 PID.

Tested on an Atmel SAM4S Xplained board which has a JLink-OB, also
regression tested by using a 0x0101 PID normal JLink adapter.

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Change-Id: I121d30e57729cda3adb66e2a5dc72e1fcb7ef8b1
Reviewed-on: http://openocd.zylin.com/2031
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29 07:12:42 +00:00
Andreas Fritiofson 09e9625d6c ft2232: Mark interface driver as deprecated
Change-Id: I5ebc924ab66c86f1902942bebc203a34d97abc64
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1899
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-28 10:07:01 +00:00
Jörg Wunsch d2273d10b6 CMSIS-DAP: print a debug message when the USB product string cannot be read
As suggested by Stian Skjelstad in a comment in:

http://openocd.zylin.com/#/c/2044/

if the USB product string cannot be read, provide a debug message so
users might get aware of a potential permission problem when looking
at the debug output.

Fix style bug found by Jenkins.

Change-Id: I6acb1c6261fec6f2bee80e4be513a5c5e29eff79
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2048
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:49:50 +00:00
Jörg Wunsch 325066149f All Atmel-provided CMSIS-DAP devices use 512 byte packet size
The existing CMSIS-DAP driver matches the USB VID/PID against 0x3eb
(Atmel VID) and 0x2111 (Atmel EDBG embedded CMSIS-DAP debugger), and
then bumps the packet size from its default of 64 to 512.  However, it
turned out that *all* Atmel-provided CMSIS-DAP devices (EDBG with PID
0x2111; JTAGICE3 with firmware version 3.x, PID 0x2140; new Atmel-ICE
[successor of JTAGICE3], PID 0x2141) require a 512-byte packet size.
Obviously, all run the same USB implementation inside their custom
microcontroller.  Thus, it seems best to simply assume that *all*
Atmel CMSIS-DAP devices use this packet size, and don't check the PID
at all.

This has also been filed as Trac bug #68:

https://sourceforge.net/apps/trac/openocd/ticket/68

Change-Id: I942af93060fdf265fca3961841638caa6182f877
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2045
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
2014-03-17 12:49:07 +00:00
Jörg Wunsch 0c7db47e58 Prevent segfault when the USB product string cannot be retrieved
In the CMSIS-DAP driver, if nothing has been specified by the user, an
attempt is made to find the first device with the (mandatory)
substring "CMSIS-DAP" in any USB device's product string.  However,
while (usually) all devices can be traversed, devices the user does
not have permission for cannot be read the product string from,
resulting in a NULL pointer.  Trying to find the substring "CMSIS-DAP"
causes a segementation fault then.

This has also been filed as Trac bug #67:

https://sourceforge.net/apps/trac/openocd/ticket/67

Change-Id: Idfc9f072e34152e9af99fe1c8ec88c99dea4624c
Signed-off-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-on: http://openocd.zylin.com/2044
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:48:29 +00:00
Bartosz Bielawski 4c9d6038b2 stlink_usb.c: add support for STLink V2-1
The new version of STLink (V2-1) has a different USB endpoint layout.
As the PID of the device also changed it's possible to change EPs used
by OpenOCD in runtime. The patch adds three new fields to stlink_usb_handle_s
and assigns right EP numbers in stlink_usb_open().
Parts of the code inspired by and used with consent of Jens Hoffmann.

Change-Id: I93b69fb889f15317e9bf864905f435905db39745
Signed-off-by: Bartosz Bielawski <bartosz.bielawski@gmail.com>
Reviewed-on: http://openocd.zylin.com/2019
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-17 12:41:57 +00:00
Andreas Fritiofson 17fddb4289 stlink: Use callback to increase frequency of trace data sampling
The ST-LINK/V2 has limited internal buffering, such that trace data
can be missed if the target is generating data at a rate quicker than
the OpenOCD trace sampling. The issue of lost data is compounded since
individual TPIU packets may be split across individual STLINK_TRACE_EP
reads, and misleading results can occur if mid-packet loss occurs.

This patch increases the frequency of checking for pending trace data
with the aim of minimising such losses. Note: With the limited (I/O
and memory) bandwidth of the ST-LINK/V2 there cannot, however, be a
guarantee against trace data loss.

The timer callback is only added when enabling tracing, and is removed
when tracing is disabled.

Change-Id: Ibde9794b77793d3068f88cb5c1a26f9ceadcbd8a
Signed-off-by: James G. Smith <jsmith@ecoscentric.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1661
Tested-by: jenkins
2014-03-07 21:19:12 +00:00
Jens Bauer d585c1627a CMSIS-DAP: Fix build errors on Mac OS X
Rename the argument variable 'wait' to 'delay', as 'wait'
conflicts with an API function declared in system header
/usr/include/sys/wait.h on Mac OS X.

Change-Id: I5742da6e5def6e5ec197e774c3844e4bf0424569
Signed-off-by: Jens Bauer <jens@gpio.dk>
Reviewed-on: http://openocd.zylin.com/1973
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-04 20:18:17 +00:00
Antony Pavlov b27c53354d drivers/jtag: usb_blaster: make command handlers more strict
If user used wrong argument number for some usb_blaster_* commands
then openocd show just warning message.
This commit makes command handler's behaviour more strict and
openocd treats wrong argument number as an error.

In addition we already have 'help' and 'usage' information in
struct command_registration ublast_command_handlers[],
so we can drop redundancy messages in command handlers.

Change-Id: I73b8c75ec60a18e5258a4bdffe972e8a1afc1066
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/1942
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24 12:09:15 +00:00
Paul Fertser bb0ef230ca tcl/drscan: handle invalid syntax with a conditional, not assert
When "drscan" command is used improperly, such as in:
drscan stm32f1x.cpu -endstate drpause
there're no fields to scan, and so the assert leads to a
segfault. This should be treated like any other syntax error instead.

Change-Id: Id1743f5d641038e1e3754c6f3097aabc5d1916b9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1927
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24 12:01:52 +00:00
Antony Pavlov 98b808923f usb_blaster: ublast_access.h: add guard macro
Change-Id: I10f6e2048cf88f64f5dce275a273783365afd65c
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/1941
Tested-by: jenkins
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-02-24 12:01:34 +00:00
Paul Fertser 1f35e124d3 drivers/ftdi: warn the user if he tries to use undefined reset signals
It is really an error to try to use a reset_config that doesn't match
adapter's capabilities, however OpenOCD has no way to specify them.

Using wrong reset_config might lead to very confusing behaviour, so I
think LOG_ERROR is justified here.

Change-Id: I1c6dcfa7c0d78829229a850189cad646b565dd66
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1948
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24 11:57:07 +00:00
Paul Fertser 6d46ad11b5 ft2232: warn about lack of TRST on "turtle" adapter
This patch fixes a build error (assigning a variable to itself) with
clang.

Since this adapter lacks trst, trying to use it in reset_config will
fail silently. Warn the user accordingly.

Change-Id: I16fd20936f00d7ff82962f4fcc629ff434aa4dce
Reported-by: Rainer Müller <raimue@codingfarm.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1946
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24 11:56:54 +00:00
Peter Lawrence 3271e6d4d5 CMSIS-DAP: auto-detect CMSIS-DAP USB VID:PID
The current OpenOCD implementation requires CMSIS-DAP adapter USB
VID:PID values to either be hard-coded in the source or manually
supplied by the user's configuration files.  The CMSIS-DAP
specification stipulates that all compliant adapters should have
"CMSIS-DAP" in the product string.  This should obviate the need
for hard-coding.

This patch was previously submitted as changes 1882, 1883, and 1886
but amendments failed to be registered by the server.  The
functionality was changed from 1886 in response to comments so that
user-supplied VID:PID values overrided the CMSIS-DAP auto-detect.

Change-Id: Ifb2dc217248359f448e0a42bd1527dd744c434b0
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/1888
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-23 21:32:46 +00:00
Andreas Fritiofson 63fa73169b Retire jtag_add_dr_out
The out only version of jtag_add_dr_scan smells like a bogus optimization
that complicates the minidriver API for questionable gain.

The function was only used by four old ARM targets. Rewrite the callers
to use the generic function and remove all implementations.

Change-Id: I13b643687ee8ed6bc9b6336e7096c34f40ea96af
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1801
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-20 13:28:26 +00:00
Franck Jullien 87e91f4db9 jtag/drivers: add USB-Blaster II
This patchs adds a new access driver for the existing
USB-Blaster interface driver.

This interface (as it is build-in on the sockit development
board) is composed of a Cypress EZ-USB plus a CPLD.

The Cypress chip as an embedded 8051 microcontroller.
When it's powered up, the firmware is downloaded to the
chip then the device is disconnected and reconnected with
the new firmware.

The USB-Blaster II protocol is almost identicial to
the old one. The only difference is that you need to
send a 0x5F before read TDO back. This command
seems to copy TDO buffer datas to the endpoint buffer.

Driver will be auto enabled if libusb-1.0 is detected.

Change-Id: I562a720a68cb4dcabeab791947d5d38776cb70fa
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1791
Tested-by: jenkins
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-20 13:28:02 +00:00
Hsiangkai Wang 94d64ccaeb Conform to C99 integer types format specifiers
Review and modify to conform to C99 integer types format specifiers.
Use arm-none-eabi toolchain to build successfully.

Change-Id: If855072a8f88886809309155ac6d031dcfcbc4b2
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Signed-off-by: Hsiangkai <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1794
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-15 12:40:42 +00:00
Spencer Oliver 4dc8cd201c cmsis-dap: add initial cmsis-dap support
This is based on work from:
https://github.com/TheShed/OpenOCD-CMSIS-DAP/tree/cmsis-dap

Main changes include moving over to using HIDAPI rather than libusb-1.0
and cleaning up to merge into master. Support for reset using srst has
also been added.

It has been tested on all the mbed boards as well as the Freedom board
from Freescale. These boards only implement SWD mode, however JTAG mode
has been tested with a Keil ULINK2 and a stm32 target - but requires a lot
more work.

Change-Id: I96d5ee1993bc9c0526219ab754c5aad3b55d812d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1542
Tested-by: jenkins
2014-01-09 15:20:51 +00:00
Franck Jullien bc256b17d5 jtag_vpi: make the server address configurable
Change-Id: I58e89c789b79ffb0b54ef94d208be876c271ddf7
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1840
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-31 12:00:49 +00:00
Mathias K 963214c83d stlink: remove stlink_api command
Remove stlink_api command.

Change-Id: I8f7885d3756fec462f9ebbee2ed285a98a51366c
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1760
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-22 20:24:56 +00:00
Franck Jullien 0da3f66ed4 jtag_vpi: fix build errors under MinGW
Change-Id: Ic13f9982014ead811e2f2d737ca1621e0e85577e
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1839
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-22 13:14:04 +00:00
Andreas Fritiofson 255301fb50 versaloon: Finish support for serial number matching
Add a command to specify the serial string and pass it to the find helper.
Actual matching was already supported for both serial and product but was
using hard coded string indices. Instead use the indices from the device
descriptor.

Change-Id: I17c7538e5ad301ef41eace1ee70a202adab23bb4
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1816
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-17 22:55:31 +00:00
Mathias K 1e6970dafd hla: Make consistent parameter naming
Rename fd to handle.

Change-Id: I98615aed1546976d00b0f20856d4e8e75f83c575
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1761
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-07 22:19:50 +00:00
Andreas Fritiofson 2ad2554e52 ulink: Fix libusb include changed since pkg-config merge
Change-Id: I1556aaf117f99de046e3c16d5386faaaefdfefd8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1795
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
2013-11-06 13:10:16 +00:00
Paul Fertser 56d4a59548 jtag: fix support for really long scans
When programming large FPGAs the generated SVF files might contain really
long SDR scans. They won't fit in the 1MiB jtag scan page at all, so in
this case the allocated page needs to be bigger. The current code was
silently corrupting memory.

One particular example was sent by Volter targetting XC3S4000. It has an
SDR 11316992 bits long, that is 1414624 bytes.

Change-Id: I39f18d7e0654f2dbdf37df58c837c9ec1fb2aa2a
Reported-by: "Voltner, Jiří" <j.voltner@era.aero>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1792
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-06 13:08:38 +00:00
Alan Bowman 6adc1ced89 Correct argument numbering in trace command
The trace command was opening a file named with the source frequency.
This change correctly passes the filename that is specified.

Change-Id: Ia2eb8eda0e1e0f4f44b05c3a0ce7bef3bda51446
Signed-off-by: Alan Bowman <alan.michael.bowman@gmail.com>
Reviewed-on: http://openocd.zylin.com/1800
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-06 12:59:04 +00:00
Andreas Fritiofson 484dbcc302 ti_icdi_usb: Remove unnecessary casts and fix byte order bugs
Found by grepping for pointer casts.

Some additional cast can be removed if hexify/unhexify arguments are
changed to a more suitable type.

Change-Id: I13796b056f00976979bf0e754de3aa7648f7f321
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1778
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:45:46 +00:00
Andreas Fritiofson 582c8b0147 ftdi: Remove unnecessary cast
Also make sure future growth of the tap_get_tms_path() return value will
get noticed.

Change-Id: Id859b463e5fdc819a4bc3b4845bf4363fbe713af
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1768
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:43:35 +00:00
Andreas Fritiofson ba2fbe2247 Remove unnecessary casts
Change-Id: Ia97283707282ccccdc707c969f59337313b4e291
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1767
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:43:27 +00:00
Andreas Fritiofson 517ba0690d Clean up const usage to avoid excessive casting
Don't use const on pointers that hold heap allocated data, because that
means functions that free them must cast away the const.

Do use const on pointer parameters or fields that needn't be modified.

Remove pointer casts that are no longer needed after fixing the constness.

Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1668
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31 20:42:34 +00:00
James G. Smith 0ebf1eb94d hla/stlink: Re-order trace parameters to allow trace output file to be optional
Re-order the "trace" parameters to allow the raw capture (log) file to
be an optional feature. The clock frequency for calculating the "Async
Clock Prescalar" is always required when enabling trace processing and
is now the first "required" parameter.

The ST-Link driver is updated to use the (required parameter)
"trace_source_hz" non-zero value as the indicator of trace being
required, rather than the now optional output file descriptor being
non-NULL.

Background: This patch is groundwork for extending the OpenOCD SWO
capture to implement other (OpenOCD built-in) ITM/DWT processing where
the core trace support is required, but there is no requirement to
store raw trace data to a configured host file. By itself this patch
is almost a functional NOP, since without the other processing in
place there is no reason NOT to specify a capture file.

Change-Id: Ibc385dd0a7adaf9bd652bceded27262fef35fd59
Signed-off-by: James G. Smith <jsmith@ecoscentric.com>
Reviewed-on: http://openocd.zylin.com/1660
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-29 22:54:34 +00:00
Sergey A. Borshch 2b10052097 hla_interface: init trst, srst variables.
There is an remark in jtag_srst and jtag_trst variables declaration:
  /*
   * JTAG adapters must initialize with TRST and SRST de-asserted
   * (they're negative logic, so that means *high*).  But some
   * hardware doesn't necessarily work that way ... so set things
   * up so that jtag_init() always forces that state.
   */

  but in hla_target such forsing is missed and both variables remains
  uninitialized until "reset" command issued, It prevents target polling
  when connecting to running target.

Change-Id: Ia620d8794cca8ba1403f5c5f24767e730033748a
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1698
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
2013-10-29 22:49:05 +00:00
Franck Jullien 1211b8ea48 jtag_vpi: use DIV_ROUND_UP
Change-Id: I31d315a79a1587d7873c5b8713daf8276fa146d0
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1683
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-10-15 20:39:33 +00:00
Franck Jullien 7ef6a54da2 jtag_vpi: fix path move function
Change-Id: I82bf6f733e0d9cb5c86553d0827c558fa98aa247
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1672
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-10-15 20:39:28 +00:00
Paul Fertser d4993beec4 bcm2835gpio: use maximum drive strength
According to the docs, the default drive strength for the GPIO pads is
8mA but they're capable of 16mA. Configure GPIO 0-27 to use the maximum
(as they might be used on high enough frequency with JTAG).

Change-Id: I621737a1b0a855bb97b56ce2cc46c0e385b74f5d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1633
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-15 20:38:21 +00:00
Andreas Fritiofson 85830c32bf jtag/tcl: Avoid casting away const
Here, in_value == out_value, so free the non-const one.

Change-Id: I017ad9e7519711ac0c9da79265be7daaa846f356
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1667
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-07 19:03:30 +00:00
Andreas Fritiofson d96010ae71 jtag/tcl: Remove no-op free
And use calloc instead of malloc+memset.

Change-Id: Icc1ed6e34904972bb5d3728307dcae5c55b32fc3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1666
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-07 19:03:18 +00:00
Andreas Fritiofson 2a0ed1ee7f jtag/tcl: Fix double free in jtag newtap argument parsing
Found when grepping for void* casts. I'm pretty sure there are about
*picking a number out of the blue* 0.31 bugs per pointer cast in OpenOCD.

Verified by valgrind, i.e.:
valgrind openocd -f interface/jtagkey.cfg -c "jtag newtap dummy cpu -irlen foo"

Change-Id: Idc12e8f18036cc908fdb572828fa46563be14242
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1665
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-07 19:03:02 +00:00
Paul Fertser ff94e02b7c hla: if the idcode callback returns 0, treat as a wildcard
Also document the callback accordingly.

Change-Id: I7e8ef481e8b5391b763b7f7187fac023e9fe04df
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1673
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-03 11:24:24 +00:00
Philip Craig ff120440d6 jlink: improve USB read during jlink_tap_execute
Previously, when doing EMU_CMD_HW_JTAG3 commands we would do two reads,
one to read the data, and one to read the result. However, we can just
do a single larger read instead.

The motivation for this change is a weird problem. If I run the Segger
software before running OpenOCD, then the first read always fails:
Error: usb_bulk_read failed (requested=1, result=0)
Error: jlink_tap_execute, wrong result -107 (expected 1)

Sniffing the USB traffic shows that the J-Link is returning an
overflow error, meaning it is expecting to return the full result
in a single read.

Change-Id: I75e020d3b3732c9a74ee3d31838fdf17a7fac24c
Signed-off-by: Philip Craig <phil@blackmoth.com.au>
Reviewed-on: http://openocd.zylin.com/1447
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-25 15:28:07 +00:00
Andreas Fritiofson 18fda50111 jlink: Replace crazy home cooked assertion with a real one
Change-Id: I83d66ddef34965dd94a0ff76aa1367cc9d19f2df
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1644
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-25 14:43:55 +00:00
Søren Jørvang 3f34ed9c79 bus_blaster: do not fail on missing get_latency_timer
Patch submitted from Trac #64
Seems certain clones do not correctly emulate the ftdi chip, if
the call to read the latency timer fails then do not treat this as a
failure.

Change-Id: Iae671b926d101adf1010639d11ca46c58d0af524
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1627
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2013-09-25 13:55:27 +00:00