]> git.sur5r.net Git - openocd/log
openocd
10 years agotcl/board: add STM32429I-EVAL and STM32439I-EVAL dev boards from ST.
Fredrik Hederstierna [Thu, 12 Jun 2014 22:29:43 +0000 (00:29 +0200)]
tcl/board: add STM32429I-EVAL and STM32439I-EVAL dev boards from ST.

Change-Id: I304b6e7bae832391f11d53003299d68e31b0e4ef
Signed-off-by: Fredrik Hederstierna <fredrik@hederstierna.com>
Reviewed-on: http://openocd.zylin.com/2171
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotcl/target/stm32l: restore slow clock on reset
Paul Fertser [Mon, 23 Jun 2014 12:32:54 +0000 (16:32 +0400)]
tcl/target/stm32l: restore slow clock on reset

Change-Id: I63eafaa38b188fe50c13ab966be44a3eaa2006b0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2188
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoAdding support for the Atmel SAMR21.
Thomas Schmid [Tue, 1 Jul 2014 17:29:56 +0000 (11:29 -0600)]
Adding support for the Atmel SAMR21.

The Atmel SAMR21 is a Atmel SAMD21 with an Atmel RF233 in one package (two
dies). Tested with the SAMR21 Xplained Pro eval kit.

Change-Id: I1d79ea05834b925d7ec810527206fe86854e684b
Signed-off-by: Thomas Schmid <thomas@rfranging.com>
Reviewed-on: http://openocd.zylin.com/2194
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agodrivers/cmsis_dap_usb: Return with ERROR_FAIL if no CMSIS-DAP device is found.
Masaki Muranaka [Tue, 24 Jun 2014 00:33:05 +0000 (09:33 +0900)]
drivers/cmsis_dap_usb: Return with ERROR_FAIL if no CMSIS-DAP device is found.

Even if it does not return, the initialization will be failed.
But it is better to show why the error is caused.

Change-Id: I399c7c94a7156be22723a9715e594061bb414a7e
Signed-off-by: Masaki Muranaka <monaka@monami-ya.com>
Reviewed-on: http://openocd.zylin.com/2189
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agomips_m4k.c: make sure fast_data_area is safe
Oleksij Rempel [Tue, 7 Jan 2014 19:28:12 +0000 (20:28 +0100)]
mips_m4k.c: make sure fast_data_area is safe

If load_image address overlap with fast_data_area,
it will caouse different mysterius issues. This patch
should prevent it.

Change-Id: Ibc95e5aa3ac002a59755029496b6a72616e9287f
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-on: http://openocd.zylin.com/1854
Tested-by: jenkins
Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocfg: Rename leftover cortex_a8 -> cortex_a
Andreas Fritiofson [Thu, 3 Jul 2014 21:44:02 +0000 (23:44 +0200)]
cfg: Rename leftover cortex_a8 -> cortex_a

Change-Id: Id11d89ae2fb78854da4284afb7f14d8a892a2e49
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2197
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agokinetis : Added Kinetis-K Series MDM-AP ID.
Nemui Trinomius [Tue, 1 Jul 2014 22:18:16 +0000 (07:18 +0900)]
kinetis : Added Kinetis-K Series MDM-AP ID.

Kinetis-K series has ID:0x001C0000 on MDM-AP IDR register.
Other Kinetis(L/M/V/E) series have ID:0x001C0020.

Change-Id: Iada37038cd239f7331ba80a3673b36bf7e18c555
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2195
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agocortex_a: target implementation renames cortex_a8 to cortex_a
Kamal Dasu [Thu, 29 Aug 2013 15:53:26 +0000 (11:53 -0400)]
cortex_a: target implementation renames cortex_a8 to cortex_a

A previous commit changes the target name used by tcl scripts.
commit d9ba56c295f057e716519a798bf9cdb4898c24f4
target: rename cortex_a8 to cortex_a

The current change renames target functions and definitions in the
implementation from cortex_a8 to cortex_a.
This prepares the implementation to support Cortex-A8, A9, A15-MPCore
in one place.

Change-Id: I73b5a38a92c12ba5bd3b806fbbb664817575a6d7
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/1599
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agovsllink: Port to libusb-1.0 API
Fatih Aşıcı [Tue, 18 Feb 2014 07:55:15 +0000 (09:55 +0200)]
vsllink: Port to libusb-1.0 API

Change-Id: I8a9a4dace8e7e8152947094b27b86f9a0d90fa61
Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com>
Reviewed-on: http://openocd.zylin.com/1952
Tested-by: jenkins
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agovsllink: Add SWD support
Fatih Aşıcı [Sun, 16 Feb 2014 09:12:39 +0000 (10:12 +0100)]
vsllink: Add SWD support

Tested with stm32f1x, stm32f4x and kl25 targets using SWD transport.

Change-Id: I118d07371b53f402ea9ac73f874460a309c05100
Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1947
Tested-by: jenkins
10 years agojtag/drivers/opendous: remove ftime() calls
Paul Fertser [Mon, 23 Jun 2014 10:01:56 +0000 (14:01 +0400)]
jtag/drivers/opendous: remove ftime() calls

ftime() is deprecated by POSIX.1-2008 and causes a warning on
FreeBSD.

The generic OpenOCD LOG_DEBUG implementation already outputs time of
an event with a millisecond precision.

Change-Id: Ic8e4ea27c268f07554ba519768b9bdfc4343f3e9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2187
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agodrivers/cmsis_dap_usb: restructure init sequence a bit
Paul Fertser [Wed, 25 Jun 2014 18:50:03 +0000 (22:50 +0400)]
drivers/cmsis_dap_usb: restructure init sequence a bit

This fixes the issue of improper initialisation sequence and in
particular makes "cmsis_dap_vid_pid" config specification functional.

Not really elegant but it's in line with the ftdi driver and so can be
reworked in a uniform way later when the internal API is changed.

Change-Id: Ief9fc64ad0ac24e1c66727153f383e4f30a830c7
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2192
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag/drivers/cmsis_dap: fix check for hardcoded vids/pids
Paul Fertser [Tue, 24 Jun 2014 14:10:35 +0000 (18:10 +0400)]
jtag/drivers/cmsis_dap: fix check for hardcoded vids/pids

This is intended to fix cmsis_dap_vid_pid command but it doesn't
because cmsis-dap has only one transport and it's auto-selected from
"interface" command handler (before any other commands are run) and as
the result cmsis_dap_usb_open() is called too early.

Change-Id: Idaade73797d8df67a6439d096f6abc9736495599
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2191
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoOpenocd: svf: Add ability to ignore svf_check_tdo errors
Kamal Dasu [Thu, 20 Feb 2014 22:46:42 +0000 (17:46 -0500)]
Openocd: svf: Add ability to ignore svf_check_tdo errors

Added Openocd commandline argument to ignore_error when the
read back TDO does not match to expected value specified with
TDO after masking with what is specified in MASK. This allows
to continue to play entire SVF file ignoring errors.
Error logs clearly show the failure reason and prints
read back TDO value.

Change-Id: I324f476fc16a003b35e6f2c5b63976431f49d54a
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/2129
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoAdd error handling and remove double readout.
Mathias K [Tue, 26 Feb 2013 16:24:41 +0000 (17:24 +0100)]
Add error handling and remove double readout.

Remove double readout of DCB_DHCSR in target poll. The return value
of the endreset event is handled and not ignored in target poll.

Change-Id: I8fe026418dadcf0b0dcbb09acee871ad950937a2
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1181
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agojtag/drivers/ftdi: do not touch unavailable reset signals
Paul Fertser [Sun, 22 Jun 2014 19:23:31 +0000 (23:23 +0400)]
jtag/drivers/ftdi: do not touch unavailable reset signals

If the current reset_config doesn't specify availability of nTRST or
nSRST, just leave them alone, do not try to deassert them ever
(asserting would be prevented by the upper layer).

Change-Id: I90123c666e05a1c26f1e164625e82d766a3e3744
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2186
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agocfg: add SWD configs for stellaris ftdi based adapters
Spencer Oliver [Fri, 20 Jun 2014 22:59:30 +0000 (23:59 +0100)]
cfg: add SWD configs for stellaris ftdi based adapters

Tested on hardware.

Change-Id: Ib0191e97988dc79e9a62da74bd7fe25f548ff5a2
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2185
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
10 years agotcl/interface/ftdi: add SWD configs for kt-link, olimex, rowley and resistor hack
Paul Fertser [Fri, 20 Jun 2014 10:48:05 +0000 (14:48 +0400)]
tcl/interface/ftdi: add SWD configs for kt-link, olimex, rowley and resistor hack

Resistor hack is runtime-tested, other configs are based on
schematics.

Change-Id: I8daffa0434cd41d142fbec7c230a302284f7aa31
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2184
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agojtag/drivers/ftdi: require defining SWD_EN signal for SWD mode
Paul Fertser [Fri, 20 Jun 2014 09:31:25 +0000 (13:31 +0400)]
jtag/drivers/ftdi: require defining SWD_EN signal for SWD mode

Use a special signal instead of a dedicated swd mask. Amend
jtag-lock-pick_tiny_2 config accordingly.

Change-Id: Ifb007a0b5434b590c52f936efd5f5458e913e2e4
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2183
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
10 years agojtag/drivers/ftdi: declare standard JTAG signals on SWD init
Paul Fertser [Fri, 20 Jun 2014 09:13:27 +0000 (13:13 +0400)]
jtag/drivers/ftdi: declare standard JTAG signals on SWD init

Unfortunately, this means they're available for config files only
after selecting swd transport.

Change-Id: Ia2afc1f3bfdba8d81efbb8ab964b174c0f7e2811
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2182
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agojtag/drivers/ftdi: add option to declare signal aliases
Paul Fertser [Fri, 20 Jun 2014 08:47:24 +0000 (12:47 +0400)]
jtag/drivers/ftdi: add option to declare signal aliases

This adds -alias|-nalias options to ftdi_layout_signal command that
allow to declare a new signal based on an already defined one.

Change-Id: I552578ebcd12ae21957a1c0d3b7e878adeff6df0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2181
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoAuto-select JTAG transport when appropriate
Paul Fertser [Thu, 19 Jun 2014 10:21:21 +0000 (14:21 +0400)]
Auto-select JTAG transport when appropriate

I looked through all the target configs after stripping comments and
such from them with sed to see what jtag-specific commands can appear
first, and it looks like all the meaningful combinations should be
covered.

Change-Id: I8d543407b7f4ac8aca7354ecd50e841c8a04d5f3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2179
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoRelax polling check if not in JTAG mode
Andreas Fritiofson [Wed, 14 May 2014 20:14:10 +0000 (22:14 +0200)]
Relax polling check if not in JTAG mode

Polling was disabled based on global variables jtag_trst and jtag_srst
which were never touched in non-JTAG mode. Modify the check and remove
the ugly workaround to avoid calls to a possibly uninitialized JTAG
subsystem.

Change-Id: I3b18c81e0fba7aaf35afe6f08c3fe8fa6f8443fd
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2143
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agocfg: Add SWD support to JTAG-lock-pick Tiny 2
Andreas Fritiofson [Fri, 9 May 2014 20:38:45 +0000 (22:38 +0200)]
cfg: Add SWD support to JTAG-lock-pick Tiny 2

Change-Id: I61eac507fa6861b7daf603ebca58e8bf3cc699c1
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2136
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoAdd FTDI SWD driver
Andreas Fritiofson [Sat, 10 May 2014 09:31:49 +0000 (11:31 +0200)]
Add FTDI SWD driver

This is usable on most or all FTDI adapters using a small hardware tweak.

TCK goes to SWCLK as expected. TDO should be wired to SWDIO. For TDI there
are two options:

Either add a 74HC126 or similar tri-state buffer between TDI and SWDIO,
with OE controlled by a signal named SWDIO_OE. Or simply connect TDI and
SWDIO together via a suitable resistor (220-470 ohms or so depending on
the drive capability of the target and adapter).

nSRST (and of course Vcc, GND) may be connected too but all other signals
should be NC.

Change-Id: Id36cf4577439be96bd4e5955c3026236e1cabced
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1958
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agotransport: Constify the transports vector
Andreas Fritiofson [Sat, 10 May 2014 09:31:35 +0000 (11:31 +0200)]
transport: Constify the transports vector

Change-Id: I0c874b5d4c97cf781d83bd381d701f770e069f72
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2135
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoswd: Add frequency setting and special/switching sequences to the API
Andreas Fritiofson [Sun, 2 Mar 2014 19:35:32 +0000 (20:35 +0100)]
swd: Add frequency setting and special/switching sequences to the API

Change-Id: I6f3950374f2525a18bbcb9cbd340c447c20fb704
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2134
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5: Make sure all bit masks are unsigned and wide enough.
Andreas Fritiofson [Sun, 2 Mar 2014 19:33:54 +0000 (20:33 +0100)]
adi_v5: Make sure all bit masks are unsigned and wide enough.

Also align them with spaces instead of tabs.

Change-Id: I1c01412a3ea77b29e8e133f5c92d05ed79d7c0f3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2133
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoswd: Remove support for turnaround periods other than 1
Andreas Fritiofson [Fri, 9 May 2014 20:50:34 +0000 (22:50 +0200)]
swd: Remove support for turnaround periods other than 1

ARM deprecated other trn periods in ADIv5.1 and one cycle is the only
setting that is guaranteed to be implemented, as well as being the reset
value in ADIv5.0.

Thus it makes no sense supporting anything else.

Change-Id: Iffa16bb0ce74788bca88fd3ace8a026148013d00
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2132
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoswd: Fix park bit polarity according to ADIv5.1 Supplement
Andreas Fritiofson [Fri, 9 May 2014 20:49:21 +0000 (22:49 +0200)]
swd: Fix park bit polarity according to ADIv5.1 Supplement

Change-Id: I27293defd3f3c3bf37c9662f88689e85ba593d86
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2131
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoswd: Convert API to asynchronous
Andreas Fritiofson [Wed, 18 Jun 2014 22:47:17 +0000 (00:47 +0200)]
swd: Convert API to asynchronous

Change-Id: I859568dbb2ad4e92411980751c3f747bd70638b8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1959
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5_cmsis_dap.c: Simplify debugging output
Andrey Smirnov [Wed, 18 Jun 2014 21:41:00 +0000 (23:41 +0200)]
adi_v5_cmsis_dap.c: Simplify debugging output

Name of the function is already a part of the LOG_DEBUG macro, so
there's no need to include it in the string itself.

Change-Id: I18c3d5b746e9106d55104e490ccf5bc5e85cc380
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2138
Tested-by: jenkins
10 years agocortex_m: Do additional initialization during reset
Andrey Smirnov [Thu, 3 Apr 2014 21:59:44 +0000 (14:59 -0700)]
cortex_m: Do additional initialization during reset

SAM4L requires additional steps to be taken right after SYSRESETREQ is
issued in order to function robustly:

       - CMSIS-DAP DAP driver needs to explicitly check for sticky bit
         errors since it is possible for adapter to perform successful
         write opration, report no errors and then, under the hood, do
         some other things that will result in sticky bit being set.

       - Debugger needs to wait for security system to finish
         intialization and assert CDBGPWRUPACK before proceeding

This change is related to commit http://openocd.zylin.com/#/c/1995/

Change-Id: I741c95a809bfd60d930cec9482239e4796a62326
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2088
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
10 years agoadi_v5_cmisis_dap: Separate ABORT from clearing sticky errors
Andrey Smirnov [Wed, 18 Jun 2014 21:33:51 +0000 (23:33 +0200)]
adi_v5_cmisis_dap: Separate ABORT from clearing sticky errors

We don't need to do full blown AP ABORT in case of CMSIS-DAP errors,
and the code that was in place was not doing that(issuing AP ABORT)
anyway.

Change-Id: Ide83b1f8875d725da6cb0d53aae8229f8c6316b3
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2112
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
10 years agodrivers/cmsis_dap_usb: remove jtag reset hacks
Paul Fertser [Fri, 9 May 2014 13:57:20 +0000 (17:57 +0400)]
drivers/cmsis_dap_usb: remove jtag reset hacks

This should no longer be needed after tcl scripts are fixed to avoid
calling jtag subcommands when jtag is not used.

Barely tested with an frdm board.

Change-Id: I75f02b088e6134562ae634417d97c48e377df6e9
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2130
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotcl: introduce using_(jtag|swd|hla) helpers and use them in reset handler
Paul Fertser [Sat, 1 Mar 2014 18:40:54 +0000 (22:40 +0400)]
tcl: introduce using_(jtag|swd|hla) helpers and use them in reset handler

Barely tested with plain SWD transport.

Change-Id: I48b59136bf4294ffed737dba01f1b30ef83aa86b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2003
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoswd: Improve parity calculation and move it to types.h
Andreas Fritiofson [Sun, 16 Feb 2014 23:27:09 +0000 (00:27 +0100)]
swd: Improve parity calculation and move it to types.h

It could be reused by SWD drivers and in other places.

Change-Id: Ieed0cf70c111a73d3a42ed59f46a0cdd177a73d5
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1957
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5_swd: Separate sticky error clearing from AP abort
Andreas Fritiofson [Sat, 10 May 2014 16:49:44 +0000 (18:49 +0200)]
adi_v5_swd: Separate sticky error clearing from AP abort

Swd_queue_ap_abort should set DAPABORT, not only clear sticky errors.
However, DAPABORT should not be set as soon as there is a single
FAULT/WAIT response. It's an "emergency only" operations for use only when
the AP have stalled the transfer for a long time. So these need to be
separate functions.

Change-Id: I37618447884faad54d846c2b07fa668ad505919d
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1956
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5: Remove unused features of the DAP and SWD interfaces
Andreas Fritiofson [Tue, 18 Feb 2014 21:23:44 +0000 (22:23 +0100)]
adi_v5: Remove unused features of the DAP and SWD interfaces

These features are not currently used so remove or disable them before
something starts to. Not having them around simplifies redesign of the
APIs.

Change-Id: Iad25cc71c48b68a1fa71558141bf14d5ab20d659
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1955
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5_swd: Read RDBUFF once after a sequence of AP reads
Andreas Fritiofson [Sun, 16 Feb 2014 08:29:01 +0000 (09:29 +0100)]
adi_v5_swd: Read RDBUFF once after a sequence of AP reads

Increases performance by a factor of two for long reads.

Change-Id: I81a7a83835058560c6a53a43c3cc991100f01766
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1954
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5: Remove strange IDCODE check from dap info handler
Andreas Fritiofson [Sun, 16 Feb 2014 01:22:41 +0000 (02:22 +0100)]
adi_v5: Remove strange IDCODE check from dap info handler

Otherwise it breaks SWD targets. The check seems really weird anyway since
it loops through *all* TAPs after the ADIv5 target but doesn't do anything
at all with the result, other than not setting the return values despite
returning ERROR_OK.

Remove a bogus initialization that was needed because of the odd
behaviour of this routine when an IDCODE wasn't found.

Change-Id: Ic086352f6af868b3406b00420291a0a671e3acac
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1953
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoadi_v5_swd: Improve SWD support
Fatih Aşıcı [Fri, 14 Feb 2014 11:37:04 +0000 (13:37 +0200)]
adi_v5_swd: Improve SWD support

Fix bug in parity calculation macro.

Cache and update the selected DP bank when necessary.

Add aborts when the Ack code signals a failure (we should really only
clear the sticky bits, but this will do for now).

Change-Id: I38a4da136ba1d9e989b33c1875a80c0b1b2be874
Signed-off-by: Fatih Aşıcı <fatih.asici@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1950
Tested-by: jenkins
10 years agoconfigure: fix formatting when "echo -n" is not supported
Paul Fertser [Sun, 15 Jun 2014 06:20:45 +0000 (10:20 +0400)]
configure: fix formatting when "echo -n" is not supported

The -n option is non-standard and is unavailable on some systems
(e.g. OS X's shell builtin).

Change-Id: Ia2fed186dee5fa6da543944873d67ebee1d9354e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2172
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agojtag/drivers/jlink: better diagnostics for RCLK problems
Paul Fertser [Thu, 12 Jun 2014 14:56:32 +0000 (18:56 +0400)]
jtag/drivers/jlink: better diagnostics for RCLK problems

The JLink protocol description doesn't really specify it for
JTAG-level commands but the real life evidence is that 0x01 error code
means "Adaptive clocking timeout" as it does for e.g. WRITE_MEM_ARM79.

Change-Id: I4e3b568742814271919f92d202713968c8fcccfb
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2169
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash: samd: add SAMD10 and SAMD11 part IDs
Andrey Yurovsky [Thu, 12 Jun 2014 16:57:29 +0000 (09:57 -0700)]
flash: samd: add SAMD10 and SAMD11 part IDs

Add part IDs for the new SAMD10 and SAMD11 parts within the Atmel SAMD
family, they have the same Flash controller as the other samd parts and
should be supported by the at91samd driver.  Compile-tested only.

Change-Id: I493ae96a7d7e8d19e607fd9a4b6544a982be42b3
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2170
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotcl/target/fm3.cfg: use a CHIPNAME known by the flash driver
Paul Fertser [Wed, 4 Jun 2014 07:49:58 +0000 (11:49 +0400)]
tcl/target/fm3.cfg: use a CHIPNAME known by the flash driver

fm3 flash driver needs to know which chip variant is used.

This fixes "unknown fm3 variant: mb9bf500.cpu" error if the config is
used as is.

Change-Id: I500fcfb413f23ee246678cec5bd19d14139a28e2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2160
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: arm_adi_v5: added types and subtypes based on latest coresight documentation
Jiri Kastner [Tue, 10 Jun 2014 08:37:50 +0000 (10:37 +0200)]
target: arm_adi_v5: added types and subtypes based on latest coresight documentation

while investigating coresight components, i've found some new partnumbers and devtypes.

Change-Id: Ie68032b0b21d542c2084f80db38b06f5cd4c7591
Signed-off-by: Jiri Kastner <cz172638@gmail.com>
Reviewed-on: http://openocd.zylin.com/2166
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoopenrisc: add support for JTAG Serial Port
Franck Jullien [Fri, 30 May 2014 14:49:42 +0000 (16:49 +0200)]
openrisc: add support for JTAG Serial Port

Change-Id: I623a8c74bcca2edb5f996b69c02d73a6f67b7d34
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/2162
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoopenrisc: restore current JTAG module while polling the CPU
Franck Jullien [Mon, 9 Jun 2014 19:31:47 +0000 (21:31 +0200)]
openrisc: restore current JTAG module while polling the CPU

Change-Id: I93827afaa164d23a93bdddbfa864624b18473f45
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/2163
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash/nor/tcl.c: fix formatting in "rejected" error message
Paul Fertser [Wed, 4 Jun 2014 07:59:35 +0000 (11:59 +0400)]
flash/nor/tcl.c: fix formatting in "rejected" error message

The error message (with the usage field unpopulated) looks like this,
obviously missing at least a space before Usage:

Error: 'fm3' driver rejected flash bank at 0x00000000Usage (null)

Change-Id: I2a625676e784d02942823f972a201f7f4f810c68
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2161
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agosvf: Only read TDO back from the device if we actually need to look at the bits.
Joshua Wise [Fri, 16 May 2014 08:08:43 +0000 (01:08 -0700)]
svf: Only read TDO back from the device if we actually need to look at the bits.

This results in a 90% speedup on USB-Blaster, which serializes repeated
TDI input against TDO readback; program time on an 5CGXFC5C6F27 part was
dropped from 2m30s to 9s.

Signed-off-by: Joshua Wise <joshua@joshuawise.com>
Change-Id: I92d5a8b800492283d619328549235b610528c338
Reviewed-on: http://openocd.zylin.com/2145
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotcl/target/am335x.cfg: Drop gdb-attach stanza
Tom Rini [Fri, 21 Mar 2014 13:48:33 +0000 (09:48 -0400)]
tcl/target/am335x.cfg: Drop gdb-attach stanza

This isn't needed nor a recommended practice now, was a simple
copy/paste from amdm37x.cfg anyhow.

Change-Id: I064226dc859d7563cfad945b577279fc37448645
Signed-off-by: Tom Rini <trini@ti.com>
Reviewed-on: http://openocd.zylin.com/2068
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoefm32 : Added ZeroGecko family support.
Nemui Trinomius [Thu, 27 Feb 2014 14:57:09 +0000 (23:57 +0900)]
efm32 : Added ZeroGecko family support.

Added Cortex-M0plus "ZeroGecko" Family to flash driver.
Tested on EFM32ZG222F32.

Change-Id: I1660b34ef6ee04837e97581504fff0faf84d1c6d
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1994
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocortex_a: fix lockup when writing to high address
Seth LaForge [Tue, 6 May 2014 23:02:23 +0000 (16:02 -0700)]
cortex_a: fix lockup when writing to high address

On a processor with caches, when you write data to memory OpenOCD invalidates
the cache lines affected. If you write to an address within 64 bytes of
UINT32_MAX, then the for loop control variable wrapped around resulting in an
infinite loop. Change control variable to be an offset from the address
involved. We should never be asked to write 2^32 bytes, so wraparound should
not be a problem.

Change-Id: Ibfe654113eff71684862ff651e7a1cd05ccc6760
Signed-off-by: Seth LaForge <sethml@google.com>
Reviewed-on: http://openocd.zylin.com/2126
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocfg: Added Nucleo-F334R8 board config.
Nemui Trinomius [Mon, 16 Jun 2014 14:10:19 +0000 (23:10 +0900)]
cfg: Added Nucleo-F334R8 board config.

It supports STLink/V2-1.

Change-Id: I0a8c01247a7a0165321818ca222479e3ae67ce5c
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2175
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32f1x: add STM32F33x support.
Nemui Trinomius [Mon, 16 Jun 2014 13:58:17 +0000 (22:58 +0900)]
stm32f1x: add STM32F33x support.

Added STM32F33x series to flash driver.
Tested on NUCLEO-F334R8 board(STM32F334R8T6).

Change-Id: I2fe70d40eb7613a7a3cfa63d25fa83f7bc055fb4
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2174
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash/nor/kinetis: prevent segfaulting with an HLA
Paul Fertser [Sun, 15 Jun 2014 14:33:30 +0000 (18:33 +0400)]
flash/nor/kinetis: prevent segfaulting with an HLA

HLAs do not provide direct DAP access, so the best we can do about it
is skipping it.

Change-Id: I877ef8fd2d86e40e7442a637cdba182cfd60e05a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2173
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotcl/board: add Atmel SAM4E-EK
Marco Cruz [Thu, 29 May 2014 18:18:11 +0000 (15:18 -0300)]
tcl/board: add Atmel SAM4E-EK

Change-Id: I07d7e0528ed4e88b070ba4e7598a193ec8e9e37d
Signed-off-by: Marco Cruz <marco.caratuva@gmail.com>
Reviewed-on: http://openocd.zylin.com/2158
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoflash/nor/at91sam4: add SAM4E16 support
Marco Cruz [Thu, 29 May 2014 17:15:06 +0000 (14:15 -0300)]
flash/nor/at91sam4: add SAM4E16 support

Change-Id: I7ab4750073c9d34812b690996eef76fccf70c627
Signed-off-by: Marco Cruz <marco.caratuva@gmail.com>
Reviewed-on: http://openocd.zylin.com/2157
Reviewed-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoREADME.OSX: mention Gentoo Prefix and clarify other options
Paul Fertser [Sat, 17 May 2014 08:46:06 +0000 (12:46 +0400)]
README.OSX: mention Gentoo Prefix and clarify other options

Change-Id: I431bfb9acf7dd6ad61b9e8f5c20568be22e9f39d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2146
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: or1k: remove wrong endian swap from or1k generic code
Franck Jullien [Mon, 25 Nov 2013 22:18:19 +0000 (23:18 +0100)]
target: or1k: remove wrong endian swap from or1k generic code

We don't need to swap the endianness in the target generic code.
This swap is necessary because of the adv_debug_if debug unit.
This patch moves this specific piece of code from or1k.c to
or1k_du_adv.c.

Change-Id: I3acea092fe6edfa79b4a87861b5f01204f071bf0
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1663
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotcl/target/kl25.cfg: add maximum speed specification
Paul Fertser [Wed, 23 Apr 2014 08:22:39 +0000 (12:22 +0400)]
tcl/target/kl25.cfg: add maximum speed specification

Maximum frequency wasn't tested on hardware but the docs seem to be
quite explicit and do not mention any restrictions for that.

Change-Id: Idcf58df5358d06525e683f07c76eedad8f0b292d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2120
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotcl: add ASUS RT-N66U config
Paul Fertser [Sat, 24 May 2014 06:04:14 +0000 (10:04 +0400)]
tcl: add ASUS RT-N66U config

CFI flashing verified with real hardware. RAM configuration wasn't
attempted.

Change-Id: I9185ab71430d799793befef708a15f62edba1663
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2153
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agojtag/drivers/osbdm: downgrade init message severity, fix wording
Paul Fertser [Thu, 29 May 2014 07:13:24 +0000 (11:13 +0400)]
jtag/drivers/osbdm: downgrade init message severity, fix wording

Change-Id: Iacf874b0fe9fbf840e82e6b63f1c97031f4720de
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2156
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoFlash/LPC2000: Add support for auto-probing flash size
Cosmin Gorgovan [Sat, 29 Mar 2014 22:34:43 +0000 (22:34 +0000)]
Flash/LPC2000: Add support for auto-probing flash size

Adds support for auto-probing on devices which support the IAP
Read Part ID command. Includes IDs for all LPC17XX, LPC13XX,
LPC11XX and LPC11XXX devices with publicly available user
manuals.

To use auto-probing, select the 'auto' lpc2000 variant.

Change-Id: Ic617c32925c9ebe0e9d9192ed8ddbfa08e9f0aaa
Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Reviewed-on: http://openocd.zylin.com/2075
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoFlash/LPC2000: Add support for LPC11(x)xx, LPC13xx
Cosmin Gorgovan [Sat, 29 Mar 2014 19:20:08 +0000 (19:20 +0000)]
Flash/LPC2000: Add support for LPC11(x)xx, LPC13xx

LPC11(x)xx and LPC13xx devices are mostly compatible with the lpc1700
variant of the LPC2000 driver, but use a fixed flash sector size of 4KB.

Change-Id: I033515f4ff6bc61d3b9babd27096f78c99cea927
Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Reviewed-on: http://openocd.zylin.com/2071
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agoSTM32F2x: Don't clear FLASH_OPTCR bits when locking register
Elliott Partridge [Wed, 28 May 2014 16:20:44 +0000 (12:20 -0400)]
STM32F2x: Don't clear FLASH_OPTCR bits when locking register

stm32x_write_options is locking the FLASH_OPTCR register by
writing 0x00000001 to it, which clears the other bits. This
causes problems with subsequent flash operations; the hardware
is probably seeing the write protection bits in the register
set to '0' (protect), causing a WRPERR.
This patch ORs the value of the register with 0x00000001, so that
the only change is the lock bit itself.

Change-Id: I0e3ca9aa6563ce1b57a01fc0faf7563b6b85f620
Signed-off-by: Elliott Partridge <elliott.partridge@gmail.com>
Reviewed-on: http://openocd.zylin.com/2155
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoDisable multiprocessor-id read on ARMv7-R cores
Alex Ray [Sun, 6 Apr 2014 14:34:27 +0000 (07:34 -0700)]
Disable multiprocessor-id read on ARMv7-R cores

ARMv7-R cores are largely uniprocessor-configured, and when they are
multiprocessor-configured the format of the MPIDR register isn't
compatible with ARMv7-A cores.

Change-Id: I024ec514496fbab5075c6fb34b6acd870e68e1fc
Signed-off-by: Alex Ray <a@machinaut.com>
Reviewed-on: http://openocd.zylin.com/2096
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agosrc/target: select the last created target as current
Paul Fertser [Thu, 15 May 2014 18:17:13 +0000 (22:17 +0400)]
src/target: select the last created target as current

Configuration commands assume the last created target is the one they
should be applied to. An example of this is sourcing an stm32f1.cfg
several times to access several microcontrollers on the same JTAG chain
where cortex_m reset_config should apply to the target that was just
created, not to the first one.

This fixes http://sourceforge.net/p/openocd/tickets/71/ .

Change-Id: I1ca41cc05fe5f36c4bc62dde4614da1405754fd8
Reported-by: Michael Eischer <mieischer@users.sf.net>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2142
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag/drivers/stlink: allow to reconnect seamlessly after polling failure
Paul Fertser [Fri, 23 May 2014 11:53:59 +0000 (15:53 +0400)]
jtag/drivers/stlink: allow to reconnect seamlessly after polling failure

If the communication with the target was failing (either because of an
intermittent connection or the target was rebooted), this is needed to
reestablish operational state.

Reported-by: Tim Sander <tim@krieglstein.org>
Tested-by: Tim Sander <tim@krieglstein.org>
Change-Id: I91ea2e2b2b5ef8eb27dfe9bae95ef2a919f67e4e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2152
Tested-by: jenkins
Reviewed-by: Tim Sander <tim@krieglstein.org>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: reexamine after polling succeeds again
Paul Fertser [Fri, 23 May 2014 11:17:31 +0000 (15:17 +0400)]
target: reexamine after polling succeeds again

If polling was failing, it likely meant that either the target was
disconnected or rebooted. In the latter case it needs to be reexamined
to be properly configured for the debug session, so do it just in
case.

Reported-by: Tim Sander <tim@krieglstein.org>
Tested-by: Tim Sander <tim@krieglstein.org>
Change-Id: I5b067c18d9276d4e86cc59739f196ae7d0931622
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2151
Tested-by: jenkins
Reviewed-by: Tim Sander <tim@krieglstein.org>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoadi_v5_cmsis_dap: Fix logging order of appearance
Andrey Smirnov [Thu, 3 Apr 2014 21:44:31 +0000 (14:44 -0700)]
adi_v5_cmsis_dap: Fix logging order of appearance

Move logging for cmsis_dap_queue_ap_read/write to happen after a call
to cmsis_dap_ap_q_bankselect so that that SWD operation would appear
in the log in the same sequence they happen on the bus.

Change-Id: Ic046bc753e661da7924b019c9100d6932fb686bf
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2087
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
10 years agoarm_adi_v5: Do not ignore register polling timeout
Andrey Smirnov [Thu, 3 Apr 2014 21:27:27 +0000 (14:27 -0700)]
arm_adi_v5: Do not ignore register polling timeout

Previous to this commit 'ahbap_debugport_init' would ignore if timeout
happened or not when waiting for CDBGPWRUPACK and CSYSPWRUPACK and would
continue initialization regardless. It also would not reset the
timeout counter after finishing polling for CDBGPWRUPACK and starting
for CSYSPWRUPACK which could potentially cause some problems.

Also refactor code of both snippets into a more generic function to
avoid duplication.

Change-Id: I16e4f50e6819e08c4126e71ef8cec7db559d608e
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2086
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
10 years agoarm_adi_v5: Add convenience "atomic"" function for DP reads
Andrey Smirnov [Thu, 3 Apr 2014 21:03:04 +0000 (14:03 -0700)]
arm_adi_v5: Add convenience "atomic"" function for DP reads

Add convenience "atomic"" function dap_dp_read_atomic_u32()

Change-Id: Ic9ebb58959d2f14bbf03be42a26b0fe58ecfeddb
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2085
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoconfigure.ac: correct test for USB_BLASTER_DRIVER AM symbol
Paul Fertser [Sat, 31 May 2014 04:19:51 +0000 (08:19 +0400)]
configure.ac: correct test for USB_BLASTER_DRIVER AM symbol

Blaster II should depend on the corresponding symbol, not on libusb-1
presence.

Change-Id: I3d27a1005a78fe81042cb7b515618604612c3ece
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2159
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoflash/nor/stm32f1x: add support for F04x parts
Paul Fertser [Fri, 23 May 2014 03:55:21 +0000 (07:55 +0400)]
flash/nor/stm32f1x: add support for F04x parts

Ref. RM0091 Rev.6.

Change-Id: I13bcdb1741edc59712e4fa1849fff38d17709fa7
Reported-by: efuentes@irc.freenode.net
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2150
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoserver: fix confusing wording for incoming tcp connections
Paul Fertser [Thu, 6 Feb 2014 10:03:02 +0000 (14:03 +0400)]
server: fix confusing wording for incoming tcp connections

Change-Id: I40d5de322f3fc38097e04ce538b0fc2b136e0d6a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1937
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotarget/mips32_pracc: fix C99 format specifiers
Paul Fertser [Mon, 12 May 2014 07:57:40 +0000 (11:57 +0400)]
target/mips32_pracc: fix C99 format specifiers

Warnings exposed by arm-none-eabi build.

Change-Id: Icdaf168d7aaa1a62bdfd41a64e43ef94816d3721
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2140
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoquark_x10xx: cleanup of LOG format specifiers
Ivan De Cesaris [Wed, 21 May 2014 13:20:08 +0000 (15:20 +0200)]
quark_x10xx: cleanup of LOG format specifiers

Fix for LOG format specifiers, this is a superset of those
exposed by the arm-none-eabi build.

Add 0x prefix for all values printed in hex.

Add LOG messages for error cases when enabling or disabling
paging.

Change-Id: I070c556e0ad31204231a2b572e7b93af22a9bc61
Signed-off-by: Ivan De Cesaris <ivan.de.cesaris@intel.com>
Reviewed-on: http://openocd.zylin.com/2149
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
10 years agolpcspifi: setup a valid stack pointer before calling ROM code using stack
Aurelien Jacobs [Wed, 18 Dec 2013 23:17:49 +0000 (00:17 +0100)]
lpcspifi: setup a valid stack pointer before calling ROM code using stack

The spifi_init_code blob is calling the spifi_init() function from the ROM.
This ROM function is making use of the stack. So if the stack pointer is
invalid, trying to execute this code leads to a double fault and the
target_run_algorithm() call return with an error.
This patch simply ensure that the stack pointer is properly setup before
calling the spifi_init() ROM function.

Change-Id: I42a2163cfc2c6dfe5ada97ae8eb2bb6d2e283ff7
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-on: http://openocd.zylin.com/1836
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoKS869x: add new target
Yegor Yefremov [Mon, 5 May 2014 15:36:27 +0000 (17:36 +0200)]
KS869x: add new target

This patch adds Micrel's KS869x target. The configuration was taken from
http://www.mmnt.net/db/0/0/www.micrel.com/ethernet/8695 - Micrel's
FTP server i.e. their OpenOCD 7.0 package.

The only change compared to the original file is the removal of
reset configuration, as it belongs to the board configuration.

Change-Id: Ic8509aa5fe5ce3166a3129e1c055280a3b2b9312
Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Reviewed-on: http://openocd.zylin.com/2125
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agokinetis: Revise CPU un-securing code
Andrey Smirnov [Sat, 8 Mar 2014 22:42:28 +0000 (14:42 -0800)]
kinetis: Revise CPU un-securing code

Old version of the code had several problems, among them are:
 * Located in a generic ADI source file instead of some Kinetis
   specific location
 * Incorrect MCU detection code that would read generic ARM ID
   registers
 * Presence of SRST line was mandatory
 * There didn't seem to be any place where after SRST line assertion
   it would be de-asserted.
 * Reset was asserted after waiting for "Flash Controller Ready" bit
   to be set, which contradicts official programming guide AN4835
 * Mass erase algorithm implemented by that code was very strange:
   ** After mass erase was initiated instead of just polling for the
      state of "Mass Erase Acknowledged" bit the code would repeatedly
      initiate mass erase AND poll the state of the "Mass Erase
      Acknowledged"
   ** Instead of just polling for the state of "Flash Mass Erase in
      Progress"(bit 0 in Control register) to wait for the end of the
      mass erase operation the code would: write 0 to Control
      register, read out Status register ignoring the result and then
      read Control register again and see if it is zero.
 * dap_syssec_kinetis_mdmap assumed that previously selected(before
   it was called) AP was 0.

This commit moves all of the code to kinetis flash driver and
introduces three new commands:

o "kinetis mdm check_security" -- the intent of that function is to be used as
  'examine-end' hook for any Kinetis target that has that kind of
  JTAG/SWD security mechanism.

o "kinetis mdm mass_erase""  -- This function removes secure status from
  MCU be performing special version of flash mass erase.

o "kinetis mdm test_securing" -- Function that allows to test securing
  fucntionality. All it does is erase the page with flash security settings thus
  making MCU 'secured'.

New version of the code implements the algorithms specified in AN4835
"Production Flash Programming Best Practices for Kinetis K-
and L-series MCUs", specifically sections 4.1.1 and 4.2.1.
It also adds KL26 MCU to the list of devices for which this security
check is performed. Implementing that algorithm also allowed to simplify
mass command in kinetis driver, since we no longer need to write security
bytes. The result that the old version of mass erase code can now be
acheived using 'kinetis mdm mass_erase'

Tested on accidentally locked FRDM-KL26Z with KL26 Kinetis MCU.

Change-Id: Ic085195edfd963dda9d3d4d8acd1e40cc366b16b
Signed-off-by: Andrey Smrinov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2034
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agomips32: new code for pracc exec
Salvador Arroyo [Tue, 3 Dec 2013 22:25:20 +0000 (23:25 +0100)]
mips32: new code for pracc exec

This is only the basic code proposed for mips32_pracc_exec() function.
It checks every pracc address against the expected address when
reading (instruction fetch).
The code expects to start at PRACC_TEXT and any subsequent read address
is obtained by adding 4 to the previous one.
After shifting out all the instructions the code executes a final check.
It checks now for the first pass trough PRACC_TEXT and shift out
only NOP instructions.
A mips core does not need an additional NOP and after the first check
it exits if there is no store access pending.
After shifting out one NOP the core must be reading at pracc text or the
code exits with error.
The code continues shifting out NOPs until all store accesses have
been performed.
After shifting out 10 NOPs it exits with error.
No assumption is made about the number of store instruction shifted out or
the ordering of the store accesses. It only checks that the number of
store accesses is the same as the number of store instructions at dmseg
after execution.
mips32_pracc_read_ctrl_addr() and mips32_pracc_finish() are added to
simpify a bit the code. Fields pa_ctrl and pa_addr are added
in ejtag_info for storing values of pracc control and address.

Change-Id: If6322d5c8cbeadcd4acd3972c0f72c8490f53c34
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1827
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agomips32: cleanups in legacy pracc code
Salvador Arroyo [Sun, 1 Dec 2013 09:40:34 +0000 (10:40 +0100)]
mips32: cleanups in legacy pracc code
This is the first patch intended to make a more precise pracc check
when running in legacy mode (code executed by mips32_pracc_exec()).
It only makes some cleanups, mostly due to unnecessary code.
With the last cache optimizations for processor access (pa for short)
all the pracc functions generate the code following some rules that
make pa more easily to check:
There are no load instructions from dmseg. All the read pas are
instruction fetches. PARAM_IN related stuff is not needed.
Registers are restored either from COP0 DeSave or from ejtag
info fields. PRACC_STACK related stuff is not needed any more.
The code starts execution at PRACC_TEXT and there are no branch or jump
instruction in the code, apart from the last jump to PRACC_TEXT.
The fetch address is ever known.
For every store instruction to dmseg the function code sets
the address of the write/store pa.
The address of every store pa is known.
Current code ends execution when reading a second pass through PRACC_TEXT.
This approach has same inconveniences:
If the code starts in the delay slot of a jump it makes a jump
to PRACC_TEXT after executing the first instruction. A second pass
through PRACC_TEXt is read and the function exits without any warning.
This seems to occur sometimes when a 24kc core is halted in the delay
slot of a branch.
If a debug mode exception is triggered during the execution of a
function the core restarts execution at PRACC_TEXT. Again the function
exits without any warning.
If for whatever reason the core starts fetching  at an unexpected
address the code now sends a jump instruction to PRACC_TEXT, but due
to the delay slot the core continues fetching at whatever address + 4
and a second jump instruction will be send for execution. The result
of a jump instruction in the delay slot of another jump is
UNPREDICTABLE. It may work as expected (ar7241), or let the core in
the delay slot of a jump to PRACC_TEXT for example. This means the
function called next may also fail (pic32mx).

Change-Id: I9516a5146ee9c8c694d741331edc7daec9bde4e3
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1825
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agomips: use cp0 DeSave to cache $15 / t7
Salvador Arroyo [Sun, 25 Aug 2013 10:21:18 +0000 (12:21 +0200)]
mips: use cp0 DeSave to cache $15 / t7

Near all pracc functions store $15 in DeSave and
restore it when exiting.
There is no need to save it, if mips32_pracc_read_regs()
save this register in Desave when entering debug mode.
mips32_pracc_write_regs() needs to update it when
exiting debug mode.
Other pracc functions must not modify DeSave.
The jump code in the fastdata transfer function needs also
some little modifications.
Remark:
Like in current code the user can read/modify $15
with the cp0 31 commands.

Change-Id: I5b7dfc1b6169da846f5d2dd3ad4209a9da2c3fad
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1565
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agomips: load fast data transfer handler code with mips32_pracc_write_mem()
Salvador Arroyo [Sat, 24 Aug 2013 12:18:09 +0000 (14:18 +0200)]
mips: load fast data transfer handler code with mips32_pracc_write_mem()

Currently the code is loaded calling mips32_pracc_write_mem_generic().
Cache synchronization is not performed.
If configured as write back cache there is no chance to execute the
handler. If configured as write through cache and the cache
lines written to are not cache resident (I-side cache miss) may work.
The patch makes possible to execute the handler in a cached active
memory segment (mainly from KSEG0), but nothing else. The data
is still loaded without performing cache synchronization, code loaded
may not be executable.
Performance may not be faster. At start, for example, the code resides in
main memory, not in cache, and the core must transfer code from
memory. We can really modify the code to force a wait for the first
transfer like we do with start and end addresses, making sure the code
is cache resident for the rest of the queued transfers.
This can also may happen if we execute code (greater than the I cache size)
and the handler code is evicted from the cache.
Code tested on ar7241.

Change-Id: Iffdb4dae108b872fef0e7bacc5ea99649cdc1630
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1564
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agomips: load code in buffer mode
Salvador Arroyo [Fri, 23 Aug 2013 16:50:43 +0000 (18:50 +0200)]
mips: load code in buffer mode

Currently the functions mips32_checksum_memory() and mips32_blank_check_memory()
load the code word by word.
The bug in cache code is a good reason for doing so.
If there is no other reason we can load the code as a buffer to save time.
mips_m4k_write_memory() expect a buffer in target endianness, this is done by
target_buffer_set_u32_array().
Cleaned up exit code.
Tested on ar7241 big endian and pic32mx little endian with verify_image.
Flash erase check only tested in pic32mx.

Change-Id: Ib63ed98732b2e23b058e7349a0a57934b7604905
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1562
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agomips32: optimized cache code for pracc access
Salvador Arroyo [Sat, 18 Jan 2014 22:21:16 +0000 (23:21 +0100)]
mips32: optimized cache code for pracc access

Follows the the same rules of optimization used by all pracc functions.
Solves some bugs in previous code and adds support for write through caches.

Change-Id: If88c6738ca8c8197f327f22b766120a24f71b567
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/1557
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agoUpdate to the current Jim Tcl
Paul Fertser [Mon, 28 Apr 2014 10:34:47 +0000 (14:34 +0400)]
Update to the current Jim Tcl

This is a post-release version but hopefully some fixes that went in
are worth it; also the changes here make OpenOCD compatible with stock
0.75 version if a distro maintainer decides to use it.

Change-Id: I7ad1814c7c4868198475cdca4750c3d0ee4f5f8b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2121
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agoREADME.OSX: recommend XCode 5 as that's the current version
Paul Fertser [Thu, 8 May 2014 13:56:23 +0000 (17:56 +0400)]
README.OSX: recommend XCode 5 as that's the current version

Using current "Command Line Tools" with XCode 4 is known to provoke
issues (the build "hangs"), see e.g.

http://stackoverflow.com/questions/18667916/xcrun-lipo-freezes-with-os-x-mavericks-and-xcode-4-x

This fixes https://sourceforge.net/p/openocd/tickets/70/ .

Change-Id: I511b347b9388e0e3f1d136b566915021c4b5fbde
Reported-by: n321203 <n321203@users.sf.net>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2128
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agoftdi: Optimize GPIO toggling
Andreas Fritiofson [Thu, 27 Feb 2014 21:23:58 +0000 (22:23 +0100)]
ftdi: Optimize GPIO toggling

Only send the new I/O state for the bytes that changed.

Change-Id: I930edc9518e6019331e68e4756acc5e92dda25a4
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1999
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
10 years agosvf: Fix debug and error messages that print hex buffer
Kamal Dasu [Tue, 3 Dec 2013 21:15:42 +0000 (16:15 -0500)]
svf: Fix debug and error messages that print hex buffer

Added SVF_BUF_LOG macro to properly print the hex buffer of parsed
string for SIR, SDR, TDI, TDO and MASK. The original debug and error
logs with respect to printing real values were misleading and also
had endianess issues. All the bits are printed now instead of just
u32 values.

Change-Id: Ie89902403bdb61ff458418446c2ca1253ea2a63f
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
Reviewed-on: http://openocd.zylin.com/1964
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
10 years agodoc: document [start end] parameters of "profile" command
Paul Fertser [Wed, 16 Apr 2014 10:37:36 +0000 (14:37 +0400)]
doc: document [start end] parameters of "profile" command

Change-Id: I56561b08304e5b854a67b06ab6b9cee7a24919b2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2115
Tested-by: jenkins
10 years agogeneralplus: Add configuration file for General Plus GP326XXXA series
Andrey Smirnov [Fri, 21 Mar 2014 02:00:24 +0000 (19:00 -0700)]
generalplus: Add configuration file for General Plus GP326XXXA series

Add configuration file for General Plus GP326XXXA series. Tested on
GP326833A on GPC-1737B board.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Change-Id: I1ad0e22598b01317bbc823870a7a262e9192c595
Reviewed-on: http://openocd.zylin.com/2058
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarmv7a: fix typo in cache_config help text
Spencer Oliver [Tue, 15 Apr 2014 14:24:32 +0000 (15:24 +0100)]
armv7a: fix typo in cache_config help text

Change-Id: I48cb83bf56b2f6841c3add68ed94b9f92037357d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2114
Tested-by: jenkins
10 years agoFix some C99 format specifiers
Paul Fertser [Mon, 28 Apr 2014 11:05:02 +0000 (15:05 +0400)]
Fix some C99 format specifiers

As exposed by arm-none-eabi build, fix the wrong modifiers.

Change-Id: Ia6ce7c5c1d40e95059525c3e5d81b752df2fea7c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2122
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoAdd support for Gumstix AeroCore device
Ash Charles [Thu, 17 Apr 2014 00:32:23 +0000 (17:32 -0700)]
Add support for Gumstix AeroCore device

The Gumstix AeroCore board [1] contains a STM32F427 microcontroller.
Schematics for this board will also be made available [2].
The JTAG interface for this chip can be accessed via a USB connection
provided by an FTDI chip (0403:6011).

[1] https://store.gumstix.com/index.php/products/585/
[2] https://pubs.gumstix.com/boards/AEROCORE

Change-Id: I0bf3bb525f51528bedd807b1f7210b09ef2e1015
Signed-off-by: Ash Charles <ashcharles@gmail.com>
Reviewed-on: http://openocd.zylin.com/2117
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoRestore normal development cycle
Paul Fertser [Sun, 27 Apr 2014 11:07:08 +0000 (15:07 +0400)]
Restore normal development cycle

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
10 years agoThe openocd-0.8.0 release v0.8.0
Paul Fertser [Sun, 27 Apr 2014 10:28:21 +0000 (14:28 +0400)]
The openocd-0.8.0 release

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
10 years agonrf51: remove dereference of null pointer
Spencer Oliver [Tue, 22 Apr 2014 19:53:50 +0000 (20:53 +0100)]
nrf51: remove dereference of null pointer

found by clang 3.4.

Change-Id: Id499b546f65acd7a719498bc97e33b21d1ba565a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2119
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Andrey Smirnov <andrew.smirnov@gmail.com>