openocd.git
5 years agoChibiOS: struct ChibiOS_params_list[] should not be const 27/2427/3
Tomas Vanek [Mon, 8 Dec 2014 14:16:05 +0000 (15:16 +0100)]
ChibiOS: struct ChibiOS_params_list[] should not be const

Procedure ChibiOS_update_memory_signature() sets struct member signature.

Change-Id: I45adbd14fa7cda99413fd0b516d45b3fb55e322d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2427
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agotransport: clarify error message when transport is not selected 06/2406/2
Karl Palsson [Fri, 21 Nov 2014 22:05:41 +0000 (22:05 +0000)]
transport: clarify error message when transport is not selected

When no transport is selected, the error message dumps the available
transports, but not how to actually select one.

Change-Id: I63da2a4b59e3f6cc8d30bd631e41a82636a056ef
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2406
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoflash: fix kinetis driver typos 85/2385/2
Spencer Oliver [Thu, 20 Nov 2014 21:38:06 +0000 (21:38 +0000)]
flash: fix kinetis driver typos

Change-Id: I0a4557f08507c61cb8ab33b38d2b6b069c344c09
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2385
Tested-by: jenkins
5 years agocfg: fix lpc17xx regression 84/2384/2
Spencer Oliver [Thu, 20 Nov 2014 21:33:42 +0000 (21:33 +0000)]
cfg: fix lpc17xx regression

commit b5a6ba46 broke the following board files, update to new cfg.

Change-Id: Ic3b776bd32eb72eae6ad1e130e329268ce9ba71a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2384
Tested-by: jenkins
5 years agoavoid segfaulting when attempting to set an unavailable type of breackpoint 42/2342/2
Salvador Arroyo [Sat, 11 Oct 2014 21:37:08 +0000 (23:37 +0200)]
avoid segfaulting when attempting to set an unavailable type of breackpoint

For example "bp 0x20000000 8 2" makes openocd segfaulting on a
stm32f4x Discovery board.

Change-Id: I1ddd46b1fa9ade78db2234ed975ccefb72539331
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/2342
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agoMac/PPC: Fix build. 60/2360/2
Jens Bauer [Tue, 28 Oct 2014 04:14:05 +0000 (05:14 +0100)]
Mac/PPC: Fix build.

GCC-4.2 on Mac/PPC complains about size_t is expected for %zx and the build stops.
In order to avoid other problems, I've chosen simply to typecast.

Change-Id: I99b569c4d1100e729712e31d24d6539f8b5971b6
Signed-off-by: Jens Bauer <jens@gpio.dk>
Reviewed-on: http://openocd.zylin.com/2360
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
5 years agoswd: handle various failure conditions 71/2371/3
Paul Fertser [Sun, 2 Nov 2014 12:16:13 +0000 (15:16 +0300)]
swd: handle various failure conditions

When communication with target fails for whatever reason, it makes
sense to do JTAG-to-SWD (in case the target got power-cycled or the
DAP method was reset anyhow), SWD line reset sequence (part of
JTAG-to-SWD already) and the mandatory IDCODE read. Schedule that to
be performed on the next poll.

Fix the return values for ftdi and jlink drivers to be consistent with
OpenOCD error codes and remove ad-hoc calls to perform DAP method
switching (as it's now done from the upper layer automatically).

Change-Id: Ie18797d4ce7ac43d8249f8f81f1064a2424e02be
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2371
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mateusz Manowiecki <segmentation@fault.pl>
5 years agotarget: improve robustness of polling and reexamination 70/2370/2
Paul Fertser [Sun, 2 Nov 2014 12:03:16 +0000 (15:03 +0300)]
target: improve robustness of polling and reexamination

When a target was present on OpenOCD start but later disappeared for
whatever reason (typically unstable connection or target going to
sleep) and reappeared only for a brief period of time, reexamination
would fail, and poll would no longer run. This patch fixes it.

Change-Id: I61f9b5a3f366a761320e233f4e1689f926b5556d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2370
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
5 years agortos: free gdb packet allocated memory 82/2382/2
Spencer Oliver [Fri, 14 Nov 2014 09:23:12 +0000 (09:23 +0000)]
rtos: free gdb packet allocated memory

compile tested only.

Change-Id: I3bc06c212967a3ce44a875f802b554c178537d1d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2382
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
5 years agocheckpatch: fix check for the FSF address 14/2414/3
Paul Fertser [Thu, 27 Nov 2014 07:54:07 +0000 (10:54 +0300)]
checkpatch: fix check for the FSF address

Commit 4525c0a4c4d0aaa199c37a6d2245617e8445f213 cherry-picked check
for the FSF address presence from upstream. However, it has a typo
resulting in this obscure error when triggered:

Use of uninitialized value in concatenation (.) or string at /home/jenkins/.jenkins/jobs/openocd-gerrit/workspace/tools/scripts/checkpatch.pl line 1258.
ERROR:

This patch fixes it.

Change-Id: Ia417ef4782d21c8b3f1d39de88c4ab850a5a6630
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2414
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
5 years agojtag: Remove unnecessary global variable 35/2235/2
Andreas Fritiofson [Wed, 30 Jul 2014 21:21:09 +0000 (23:21 +0200)]
jtag: Remove unnecessary global variable

Change-Id: I96e5f13b12da2970eafc5fca24b7952d427eeca9
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2235
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
5 years agojtag: Fix memory leaks in jtag_tap_free() 34/2234/2
Andreas Fritiofson [Wed, 30 Jul 2014 21:18:41 +0000 (23:18 +0200)]
jtag: Fix memory leaks in jtag_tap_free()

Change-Id: I953fbb346fbf168fb50b349d245f2aa64dbfdcb3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2234
Tested-by: jenkins
6 years agostm32l: split l0/l1 support no jtag, different HSI settings 05/2405/2
Karl Palsson [Fri, 21 Nov 2014 22:14:57 +0000 (22:14 +0000)]
stm32l: split l0/l1 support no jtag, different HSI settings

L0 is cortex m0+, so different id codes, SWD only, different addresses
for the clock speedup.  It has no endian options, no boundary scan.

Removed all L0 specific portions from L1 files, and renamed files to clarify
their purpose.  The deprecated stm32lx_stlink.cfg is kept as is, as it is only
around for backwards compatibility with prior releases.

Tested on STM32L053 Discovery and STM32L151 Discovery.

Has _not_ been tested with jtag on L1.

Change-Id: I8eea890d2f92a302d9e9c8a8832d218ee1b6bcfc
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2405
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Juha Niskanen <juha.niskanen@haltian.com>
6 years agostm32: Fix L0/1xx CPUTAPID setting and add new L1xx BSTAPIDs 76/2376/2
Juha Niskanen [Wed, 5 Nov 2014 13:39:58 +0000 (15:39 +0200)]
stm32: Fix L0/1xx CPUTAPID setting and add new L1xx BSTAPIDs

Fix script parse error, when using JTAG, introduced in
commit 0187ced9ed2

Add several BS TAPIDs with comments about ST documentation.

Change-Id: I8d0370b244ccaf7ea0dbe1919bfad1915f7317d4
Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com>
Reviewed-on: http://openocd.zylin.com/2376
Tested-by: jenkins
Reviewed-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotcl/target/stm32f4: ramp up JTAG speed, HSI is 16MHz there 83/2383/2
Uwe Bonnes [Tue, 18 Nov 2014 14:30:44 +0000 (17:30 +0300)]
tcl/target/stm32f4: ramp up JTAG speed, HSI is 16MHz there

Since all F4 parts have an internal HSI providing 16MHz, it's safe to
use 2MHz JTAG frequency by default.

Change-Id: I2702d5a1d642d4acd4af2db54c028949132c6900
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2383
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotcl/target/stm32f4x: add F401 and F411 IDs 79/2379/3
Uwe Bonnes [Thu, 6 Nov 2014 15:31:21 +0000 (16:31 +0100)]
tcl/target/stm32f4x: add F401 and F411 IDs

Change-Id: I12079586dafb8a7614bdf4cc0b13cd5030301742
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2379
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agolpc2000: ignore status of part ID IAP command 64/2364/3
Grigori Goronzy [Thu, 30 Oct 2014 00:14:58 +0000 (01:14 +0100)]
lpc2000: ignore status of part ID IAP command

The IAP firmware won't return a proper status with some versions. This
happens on my CCC r0ket board and others have seen it as well [1]. So
just ignore the status code and do a (weak) consistency check instead.

[1] http://www.lpcware.com/content/forum/lpc1343-iap-read-part-identification-command

Change-Id: I0daa779d520a540629677c56857bbc20d6db422d
Signed-off-by: Grigori Goronzy <greg@chown.ath.cx>
Reviewed-on: http://openocd.zylin.com/2364
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
6 years agocheckpatch.pl: check for the FSF mailing address 41/2341/2
Antony Pavlov [Fri, 10 Oct 2014 04:27:14 +0000 (08:27 +0400)]
checkpatch.pl: check for the FSF mailing address

This check code is imported from Linux v3.17 checkpatch.pl.

Change-Id: If39d834ee9b6131bccc92de38fd7c108650bd2f1
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2341
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoor1k: remove address of the Free Software Foundation 40/2340/2
Antony Pavlov [Fri, 10 Oct 2014 04:34:51 +0000 (08:34 +0400)]
or1k: remove address of the Free Software Foundation

The FSF address has changed; The FSF site says that
address is

  Free Software Foundation
  51 Franklin Street, Fifth Floor
  Boston, MA 02110-1301
  USA

(see http://www.fsf.org/about/contact/)

Instead of updating it each time the address changes,
just drop it completely treewide.

Change-Id: I27199f7625901f677d8105d1e8876cff00147b71
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2340
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agocheckpatch.pl: check for openocd tree, not for kernel tree 39/2339/4
Antony Pavlov [Fri, 10 Oct 2014 04:13:46 +0000 (08:13 +0400)]
checkpatch.pl: check for openocd tree, not for kernel tree

checkpatch.pl looks for linux kernel specific paths and files
to check source tree. As openocd misses kernel files it ends
with this error message:

    Must be run from the top-level dir. of a kernel tree

This patch also renames 'kernel' -> 'openocd'
in source tree-related messages.

Due to checkpatch checking modifications on itself, lift the
restriction on having no spaces at the start of a line for Perl
scripts. This can be readded back later.

Change-Id: I89b7ca976bef5e13785bd3a43e597c9feb4c2df4
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2339
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agomips32: fix typos 38/2338/2
Antony Pavlov [Tue, 7 Oct 2014 08:36:55 +0000 (12:36 +0400)]
mips32: fix typos

Change-Id: Ibb98fe3da68bf670a5bb83600bb49647db8a4163
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2338
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agodoc: flash: write_image writes only loadable sections 48/2348/2
Alexei Colin [Sun, 19 Oct 2014 21:46:05 +0000 (17:46 -0400)]
doc: flash: write_image writes only loadable sections

The code that takes only sections marked PT_LOAD is in
image_elf_read_headers in src/target/image.c

(Just trying to save some time for the next person with same question.)

Change-Id: I493c102c908fca2b7238276ddbbecbe8c7cd9a0a
Signed-off-by: Alexei Colin <ac@alexeicolin.com>
Reviewed-on: http://openocd.zylin.com/2348
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoAdded FPU support for ChibiOS/RT 54/2354/2
Christian Gudrian [Fri, 24 Oct 2014 21:22:40 +0000 (23:22 +0200)]
Added FPU support for ChibiOS/RT

When an enabled FPU is detected we now use an appropriate stacking.

Change-Id: I1b0f43ec22e1c55c4f10e2ffa97d4aaa77bca5ee
Signed-off-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-on: http://openocd.zylin.com/2354
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agortos: add support for ChibiOS/RT 3.0 52/2352/5
Christian Gudrian [Tue, 21 Oct 2014 20:23:40 +0000 (22:23 +0200)]
rtos: add support for ChibiOS/RT 3.0

In ChibiOS/RT 3.0 the ready list pointer "rlist" is now part of the system
data structure. Since the ready list is the first element in that
structure it can be accessed via the structure's symbol "ch".

Change-Id: Idc7eaa87cb7bbad0afa0ff1dafd54283bf429766
Signed-off-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-on: http://openocd.zylin.com/2352
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agortos: allow symbols to be optional for a particular RTOS 55/2355/3
Paul Fertser [Sat, 25 Oct 2014 07:20:10 +0000 (11:20 +0400)]
rtos: allow symbols to be optional for a particular RTOS

Default to non-optional.

Change-Id: Ifc9ddb1ab701a19c3760f95da47da6f7d412ff2e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2355
Tested-by: jenkins
Reviewed-by: Christian Gudrian <christian.gudrian@gmx.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash: at91samd: fix use of is_erased in check 68/2368/2
Andrey Yurovsky [Thu, 30 Oct 2014 18:56:08 +0000 (11:56 -0700)]
flash: at91samd: fix use of is_erased in check

is_erased can be one of -1, 0, or 1 so it must not be checked like a
boolean value.  In this case we want to erase a page unless we know it's
already erased so we just check for is_erased != 1.

Thanks to Jim Paris for pointing this out on another driver.

Change-Id: I4591186228153b64e5a9608a2aac18745e578d4a
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2368
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agojtag/drivers/jlink: implement register command to fix SWD 31/2331/6
Paul Fertser [Fri, 31 Oct 2014 11:30:57 +0000 (14:30 +0300)]
jtag/drivers/jlink: implement register command to fix SWD

Some J-Link fw versions require registration to be performed before
SWD operation is possible. It doesn't harm anyway, vendor's utilities
do it unconditionally.

Thanks go to Segger for providing the necessary information.

Change-Id: Iabd76c743eca86e2c817a97cb93c969fec3f7ac6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2331
Tested-by: jenkins
6 years agoat91sam4: Adding support for the AT91SAM4S4A. 54/2254/2
Thomas Schmid [Fri, 15 Aug 2014 21:08:23 +0000 (15:08 -0600)]
at91sam4: Adding support for the AT91SAM4S4A.

Added the chip definition for the Atmel AT91SAM4S4A. This chip is a 48-pin
package with 256k flash and 64k ram.

Change-Id: I8ada7d5735e31e0ce086f96f5906c7358464245c
Signed-off-by: Thomas Schmid <thomas@rfranging.com>
Reviewed-on: http://openocd.zylin.com/2254
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor/lpcspifi.c: fix bug that prevented clean reset after flash write 59/2359/2
Anders [Mon, 27 Oct 2014 19:55:50 +0000 (12:55 -0700)]
flash/nor/lpcspifi.c: fix bug that prevented clean reset after flash write

After SPI flash was written by the assembly language stub,
the last SPI command was not terminated by raising CS.
This left the SPI device in a hung state that prevented the
flash from being read by the M4 SPIFI controller, even after
the M4 was fully reset. To access the flash via SPIFI, it was
necessary to completely power cycle the board.

This fix adds the missing instructions to raise CS and
terminate the SPI command after the last byte. This allows
the M4 to be resumed or reset cleanly after flashing. The
SPIFI memory is now immediately accessable at address
0x1400 0000 after flashing is complete.

Change-Id: I4d5e03bded0fa00c430c2991f182dc18611d5f48
Signed-off-by: Anders <anders@openpuma.org>
Reviewed-on: http://openocd.zylin.com/2359
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoHacking: Some note how to review. 80/2380/3
Uwe Bonnes [Fri, 7 Nov 2014 13:28:43 +0000 (14:28 +0100)]
Hacking: Some note how to review.

Change-Id: Ied682884abdba27da265f1ce3632417f54a80fe2
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Reviewed-on: http://openocd.zylin.com/2380
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agolpc2000: Added LPC1500 series flash programming support. 04/2304/2
Nemui Trinomius [Fri, 19 Sep 2014 15:06:00 +0000 (00:06 +0900)]
lpc2000: Added LPC1500 series flash programming support.

This patch adds flash programming support for LPC1547/8/9 and LPC1517/8/9.
Tested on LPC1549(LPC1549 LPCXpresso Board with CMSIS-DAP firmware).

Change-Id: Ic95b4d62055bb9fdc2ca484696a38ccaf49ad951
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2304
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Grigori G <greg@chown.ath.cx>
6 years agonrf51: fix checks for is_erased 66/2366/3
Jim Paris [Wed, 29 Oct 2014 23:09:49 +0000 (19:09 -0400)]
nrf51: fix checks for is_erased

is_erased can take the value 0 (no), 1 (yes), or -1 (unknown).
Checks like (!is_erased) don't do the right thing if it's -1.

Change-Id: I10ba32c99494ca803e0a7a1ba56fdd78184b96bb
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2366
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agonrf51: verify that UICR needs erasing before triggering an error about it 63/2363/4
Jim Paris [Wed, 29 Oct 2014 23:00:52 +0000 (19:00 -0400)]
nrf51: verify that UICR needs erasing before triggering an error about it

If the UICR is already empty, there's no reason to return an error
just because it can't be erased again.  This happens, for example,
when flashing UICR from GDB after a "monitor nrf51 mass_erase".

Change-Id: Ia6d28c43189205fb5a7120b1c7312e45eb32edb7
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2363
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agonrf51: fix UICR erase 62/2362/3
Jim Paris [Wed, 29 Oct 2014 03:15:31 +0000 (23:15 -0400)]
nrf51: fix UICR erase

nrf51_erase_page() checks for (sector->offset == NRF51_UICR_BASE) to
determine if the UICR should be erased.  However, sector->offset for
the UICR bank is set to 0 in nrf51_probe, so this code is never hit.
Attempting to erase UICR ends up erasing the first flash sector.

Use bank->base instead to determine if UICR is being erased.

Change-Id: Ie5df0f9732f23662085ae2b713d64968cd801472
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2362
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agonrf51: fix UICR region size 61/2361/3
Jim Paris [Tue, 28 Oct 2014 20:20:16 +0000 (16:20 -0400)]
nrf51: fix UICR region size

The UICR region is actually 0x100 bytes in size.  Besides making the
full region accessible, having the right value is important because
GDB rounds flash addresses to the nearest multiple of the block size
when determing which flash blocks to erase.

Change-Id: I416c391cbfc7be41a03a9b9c6e42326c87391f38
Signed-off-by: Jim Paris <jim@jtan.com>
Reviewed-on: http://openocd.zylin.com/2361
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
6 years agoarm_adi_v5: added two CoreSight peripheral IDs 69/2369/4
Peter Lawrence [Sun, 2 Nov 2014 00:31:49 +0000 (17:31 -0700)]
arm_adi_v5: added two CoreSight peripheral IDs

added "Single Wire Output" and "Trace Memory Controller" peripheral
IDs to dap_rom_display(), which is invoked by the "dap info" command

Change-Id: Iea3201007bb98e6376fbb50be40a4a2e031b0a03
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/2369
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agotcl/interface/ftdi/swd-resistor-hack: clarify and add schematic diagram 57/2357/2
Paul Fertser [Sun, 26 Oct 2014 10:49:51 +0000 (13:49 +0300)]
tcl/interface/ftdi/swd-resistor-hack: clarify and add schematic diagram

Change-Id: I8600ee983de85e4225430ae508a50cd938122d89
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2357
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agocmsis-dap: add serial number support 29/2329/3
Spencer Oliver [Thu, 2 Oct 2014 20:54:23 +0000 (21:54 +0100)]
cmsis-dap: add serial number support

Change-Id: I66926d1013e2b3a43ce0d18d3599771428706b6a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2329
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agocmsis-dap: refactor HID PID/VID check loop 28/2328/2
Spencer Oliver [Thu, 2 Oct 2014 20:47:22 +0000 (21:47 +0100)]
cmsis-dap: refactor HID PID/VID check loop

In preparation for adding serial number support.

Change-Id: I3c9fb411b79d54a4d2de067039255436ba6708c7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2328
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agobuild: make makeinfo optional 25/2325/2
Spencer Oliver [Tue, 30 Sep 2014 10:22:40 +0000 (11:22 +0100)]
build: make makeinfo optional

This means the user does not have to install texinfo to build OpenOCD.

Change-Id: Id9f42da798d3c2b79e95214c9e2559cf32802251
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2325
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agocfg: remove incorrect execute permissions 33/2333/2
Spencer Oliver [Mon, 6 Oct 2014 18:50:40 +0000 (19:50 +0100)]
cfg: remove incorrect execute permissions

Change-Id: I0ba9dfdf876bc99df4e2d1f1f3bc0c9ccc6c98c2
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2333

6 years agostm32: add mass erase support for STM32L 19/2319/4
Rémi PRUD'HOMME [Wed, 1 Oct 2014 21:43:03 +0000 (22:43 +0100)]
stm32: add mass erase support for STM32L

The mass erase for STM32L was lack because the procedure is more complex
than the procedure for the STM32F4xx.

The reference manual RM0038 (L100 subfamily) page 79 is more accurate
than the reference manual for the STM32L0xx. On the L0, the mass-erase
erase also the EEPROM. This is a limit to mass erase on L0.

The mass erase procedure is a command of telnet interface.

Tested on Discovery L053 and Discovery L100.

Change-Id: I6a1d7a3669789aea89c59a006ab2d883f3d827ca
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2319
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agostm32: Add config file for a new board STM32L052 dsicovery 17/2317/4
Rémi PRUD'HOMME [Wed, 24 Sep 2014 20:50:51 +0000 (22:50 +0200)]
stm32: Add config file for a new board STM32L052 dsicovery

this board use STLink-V2-1, the STM32L1xx use the STLink-V2.

Change-Id: Ie58f45affcb1e9a6fed711b48c3c03b5035ab2b2
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2317
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agostm32: add L0xx CPUTAPID 15/2315/4
Rémi PRUD'HOMME [Wed, 24 Sep 2014 20:26:50 +0000 (22:26 +0200)]
stm32: add L0xx CPUTAPID

Add CPUTAPID for stm32 L0xx mcu devices. Using -expected-id to
add the new id with the id for L1xx devices. This for reduce the
duplicated code.

Change-Id: I48bd230884ecf38fa200c620b547bdf3b5f59132
Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com>
Reviewed-on: http://openocd.zylin.com/2315
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor/stellaris: implement protection statuses and procedures 67/2267/4
Paul Fertser [Thu, 21 Aug 2014 11:16:55 +0000 (15:16 +0400)]
flash/nor/stellaris: implement protection statuses and procedures

This should make protection work as expected on all stellaris
families, including the latest Tiva C Snowflake.

Run-time tested on TM4C123x (Blizzard).

Change-Id: Ia017edb119bec32382b08fc037b5bbc02dd9000c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2267
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agolibusb: introduce jtag_libusb_choose_interface() and use it for JLink 27/2327/3
Paul Fertser [Wed, 1 Oct 2014 06:36:02 +0000 (10:36 +0400)]
libusb: introduce jtag_libusb_choose_interface() and use it for JLink

This introduces a new common function that allows auto-discovery of a
suitable USB interface based on class, subclass and protocol
matching. It claims the interface and returns the corresponding
endpoints number to the caller.

The need for this arised due to nRF51822 USB dongle which comes with
an "on-board Segger J-link debugger" having 3 interfaces, so the
current code can't work at all with it (in this particular case the
last interface needs to be choosen). This also removes special
handling of JLink-OB endpoint numbers as it's now possible to
autodetect them as well as the standard JLink endpoints.

Change-Id: I4d990a7a3b373efdd2949a394b32d855a168e138
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2327
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor/stellaris: actually enable protection and unprotection with ICDI 64/2264/4
Paul Fertser [Tue, 19 Aug 2014 17:54:31 +0000 (21:54 +0400)]
flash/nor/stellaris: actually enable protection and unprotection with ICDI

This is still limited to pre-Snowflake parts and the first 64K of
flash.

Change-Id: I9ca872ada3d1a87dba6261464b2a72a15eda5ecf
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2264
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agohla: add a way to pass arbitrary commands from user to layout and use for ICDI 63/2263/4
Paul Fertser [Tue, 19 Aug 2014 17:16:20 +0000 (21:16 +0400)]
hla: add a way to pass arbitrary commands from user to layout and use for ICDI

TI's ICDI adapter supports some additional commands which a user might
want to run for debugging or other purposes, the most useful of them
being "debug unlock" that fully mass-erases the device and unprotects
the flash.

Change-Id: I26990e736094367f92106fa891e9bb8fb0382efb
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2263
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agointerface/ftdi/olimex-arm-usb-ocd-h: fix nTRST control definition 86/2286/4
Paul Fertser [Wed, 10 Sep 2014 08:29:23 +0000 (12:29 +0400)]
interface/ftdi/olimex-arm-usb-ocd-h: fix nTRST control definition

According to my inspection of an Olimex ARM-USB-OCD-H adapter ACBUS0
is connected directly to an SN74LVC2T45 buffer input B2, and the
corresponding output A2 is connected directly to the JTAG
connector. It seems the information in the Olimex flyer is incorrect
for the -H version and TRST can't be tri-stated, ACBUS2 is unused.

The older ARM-USB-OCD device has SN74AC244 for an output buffer and
ACBUS2 controls its !2OE, ACBUS0 connected to 2A1 (2Y1 is nTRST), in
accordance with the information flyer.

Change-Id: I22828b7b959b6f62c3f51367feb8fab9705641e5
Reported-by: Tim Sander <tim@krieglstein.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2286
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Tim Sander <tim@krieglstein.org>
6 years agojtag/drivers/jlink.c: fix for LPC Link-2 running JLink firmware on Linux 97/2297/3
Anders [Fri, 12 Sep 2014 15:44:33 +0000 (08:44 -0700)]
jtag/drivers/jlink.c: fix for LPC Link-2 running JLink firmware on Linux

Change 2288 fixed the extraneous reset caused by set_configuration that
crashed the LPC Link-2 running JLink firmware and works on windows platforms.
On Linux however, conditional code was still calling USB reset and caused
the adapter to crash on any non-windows platforms.

Change-Id: Ibf2a02d0dcdd91ccb71d86231cd8311dcadfee1e
Signed-off-by: anders@openpuma.org
Reviewed-on: http://openocd.zylin.com/2297
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agojtag/drivers/libusb1_common: avoid device reset when reselecting configuration 88/2288/4
Anders [Thu, 2 Oct 2014 02:42:33 +0000 (19:42 -0700)]
jtag/drivers/libusb1_common: avoid device reset when reselecting configuration

According to [1], we shouldn't reselect an already active configuration to avoid needless device reset. This is known to cause issues with e.g. LPC Link2 with JLink firmware.

[1] http://libusb.sourceforge.net/api-1.0/caveats.html#configsel

Change-Id: I3568ada77780a521548c450090db7173f8d0b2dd
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anders Oleson <anders@openpuma.org>
Reviewed-on: http://openocd.zylin.com/2288
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agohelper: constify log_strings 96/2296/4
Spencer Oliver [Thu, 11 Sep 2014 21:14:58 +0000 (22:14 +0100)]
helper: constify log_strings

Change-Id: I5bdd8958e79b754d56bb7aee2892856e557eed76
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2296
Tested-by: jenkins
6 years agotarget: constify structures 95/2295/4
Spencer Oliver [Thu, 11 Sep 2014 21:14:31 +0000 (22:14 +0100)]
target: constify structures

Change-Id: I875cfab8dec4ade72ed9c9cd7d52baaca182a1ef
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2295
Tested-by: jenkins
6 years agojtag: constify driver arrays 94/2294/4
Spencer Oliver [Thu, 11 Sep 2014 21:09:36 +0000 (22:09 +0100)]
jtag: constify driver arrays

Change-Id: I81574fa8ca3cc748526dc61b75a2c75d6335ef04
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2294
Tested-by: jenkins
6 years agoflash: constify driver data structures 93/2293/3
Spencer Oliver [Thu, 11 Sep 2014 21:08:34 +0000 (22:08 +0100)]
flash: constify driver data structures

Change-Id: Ia5c3de48119f036e1d7a41be62a672a6fb37e59b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2293
Tested-by: jenkins
6 years agortos: constify symbol names and lists 92/2292/3
Spencer Oliver [Thu, 11 Sep 2014 21:07:10 +0000 (22:07 +0100)]
rtos: constify symbol names and lists

Change-Id: I72f3cd50fc6a33a178e72e169c9660e707751524
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2292
Tested-by: jenkins
6 years agonuc1x: fix typos 91/2291/2
Spencer Oliver [Thu, 11 Sep 2014 21:03:00 +0000 (22:03 +0100)]
nuc1x: fix typos

Change-Id: Ia67b55ccb2bea71a99daa176def82960f487ca9f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2291
Tested-by: jenkins
6 years agoat91samd: fix protect, add EEPROM and boot commands 26/2326/5
Andrey Yurovsky [Tue, 30 Sep 2014 20:02:49 +0000 (13:02 -0700)]
at91samd: fix protect, add EEPROM and boot commands

There were two problems with the _protect() feature:
1. The address written was off by a factor of two because the address
register takes 16-bit rather than 8-bit addresses.  As a result the
wrong sectors were (un)protected with the protect command.  This has
been fixed.
2. The protection settings issued via the lock or unlock region commands
don't persist after reset.  Making them persist requires modifying the
LOCK bits in the User Row using the infrastructure described below.

The Atmel SAMD2x MCUs provide a User Row (the size of which is one
page).  This contains a few settings that users may wish to modify from
the debugger, especially during production.  This change adds commands
to inspect and set:
- EEPROM size, the size in bytes of the emulated EEPROM region of the
  Flash.
- Bootloader size, the size in bytes of the protected "boot" section of
  the Flash.

This is done by a careful read-modify-write of the special User Row
page, avoiding erasing when possible and disallowing the changing of
documented reserved bits.  The Atmel SAMD20 datasheet was used for bit
positions and descriptions, size tables, etc. and testing was done on a
SAMD20 Xplained Pro board.

It's technically possible to store arbitrary user data (ex: serial
numbers, MAC addresses, etc) in the remaining portion of the User Row
page (that is, beyond the first 64 bits of it).  The infrastructure used
by the eeprom and bootloader commands can be used to access this as
well, and this seems safer than exposing the User Row as a normal Flash
sector that openocd understands due to the delicate nature of some of
the data stored there.

Change-Id: I29ca1bdbdc7884bc0ba0ad18af1b6bab78c7ad38
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2326
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoat91samd: add erase/secure commands, minor fix 39/2239/7
Andrey Yurovsky [Wed, 6 Aug 2014 21:28:37 +0000 (14:28 -0700)]
at91samd: add erase/secure commands, minor fix

Reference code for the SAMD2x disables caching in the NVM controller when
issuing NVM commands.  Let's do this as well to be consistent and safer.

Add a "chip-erase" for the Atmel SAMD targets that issues a complete Chip Erase
via the Device Service Unit (DSU).  This can be used to "unlock" or otherwise
unbrick a chip that can't be halted or inspected, allowing the user to reflash
with new firmware.

Add a "set-security" command which issues an SSB.  Once that's done and the
device is power-cycled, the flash cannot be written to until a "chip-erase" is
issued.  The chip-erase cannot be issued by openocd at this time because
the device will not respond to a request for the DAP IDCODE.

Change-Id: I80122f0bbf7e3aedffe052c1e77d69dc2dba25ed
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2239
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoarm_adi_v5: make dap_lookup_cs_component() traverse subtables and handle multicore 20/1920/4
Paul Fertser [Sun, 2 Feb 2014 21:19:00 +0000 (01:19 +0400)]
arm_adi_v5: make dap_lookup_cs_component() traverse subtables and handle multicore

When looking for a debug base address of a core, one should search
through all the ROM tables, not just the top-level one.

This code also assumes that the first found entry (in a depth-first
search) will correspond to core 0, the second to core 1 etc.

The patch is supposed to be an alternative implementation of
http://openocd.zylin.com/#/c/1313/.

Change-Id: Ifc88971a02fe3d9c00d9bf72a822ade5804d4e09
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1920
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agodoc/openocd.texi: add SWD to the transports supported by jlink 24/2324/2
Paul Fertser [Mon, 29 Sep 2014 13:11:53 +0000 (17:11 +0400)]
doc/openocd.texi: add SWD to the transports supported by jlink

Since 67332532194b16b99f0535a41b4179ca5df349b0 jlink adapter driver
supports SWD in addition to JTAG.

Change-Id: I9376aa02d9281f3e2734d8f127cd42162633d95b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2324
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agogdb_server: Include current RTOS thread in signal packets 03/2303/2
Jon Burgess [Thu, 18 Sep 2014 18:57:34 +0000 (19:57 +0100)]
gdb_server: Include current RTOS thread in signal packets

This allows GDB to automatically switch to the thread that has
been interrupted and show you where it has stopped.

Change-Id: Icb9500dc42a61eb977e9fac55ce9503c9926bf5d
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
Reviewed-on: http://openocd.zylin.com/2303
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agocortex_m.c: Use two byte breakpoint for 32bit Thumb-2 request 12/2312/2
Jon Burgess [Sun, 21 Sep 2014 19:40:01 +0000 (20:40 +0100)]
cortex_m.c: Use two byte breakpoint for 32bit Thumb-2 request

When GDB requests a breakpoint on a 32bit Thumb-2 instruction it
sends a length of 3 which the current code rejects. Using the
existing two byte breakpoint for this case appears to work fine.

The use of length==3 for this case is mentioned in a few places:
https://sourceware.org/gdb/onlinedocs/gdb/ARM-Breakpoint-Kinds.html
http://sourceforge.net/p/openocd/mailman/message/30012280/

Change-Id: I59cd69ba4d1bc9a37b86569738c6bb2a67c3eb7a
Signed-off-by: Jon Burgess <jburgess777@gmail.com>
Reviewed-on: http://openocd.zylin.com/2312
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agovsllink: improve the performance when using swd 02/2302/3
Simon Qian [Tue, 16 Sep 2014 13:10:13 +0000 (21:10 +0800)]
vsllink: improve the performance when using swd

Versaloon firmware has been updated for reporting
errors if fail on swd transactions.

Change-Id: I49ac0ad034cc9ad83cc4e43953579811d1243063
Signed-off-by: Simon Qian <openocd@versaloon.com>
Reviewed-on: http://openocd.zylin.com/2302
Reviewed-by: Fatih Aşıcı <fatih.asici@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotcl/board: add TI Tiva C ek-tm4c1294xl config 63/2063/5
Karl Palsson [Mon, 24 Mar 2014 17:38:12 +0000 (21:38 +0400)]
tcl/board: add TI Tiva C ek-tm4c1294xl config

Change-Id: Iab070fe4c0f03ecc0db035b16dfb64105b0841be
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2063
Tested-by: jenkins
6 years agocommand: Fix confusing syntax error message 85/2285/2
Andreas Fritiofson [Tue, 9 Sep 2014 22:13:09 +0000 (00:13 +0200)]
command: Fix confusing syntax error message

If the user executes a command with an invalid subcommand, the error
message is extremely unhelpful:

> flash write test.elf
flash write test.elf: command requires more arguments

This is because any command line that starts with a valid command group is
classified as a group, triggering ocd_bouncer to print the confusing
message.

Fix by requiring that to be a command group, the command line must not
contain any unknown tokens after the last valid (sub-)command group. That
is OK because command groups don't have handlers defined and thus can't
take any parameters.

Also fix the error message for "unknown" type to be similar to the error
message that is printed (by Jim) for non-existent primary commands.

Change-Id: I26950349f0909fd3961c4f9ab9b198c221cea9fc
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2285
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotarget: Remove "-variant" argument 83/2283/2
Andreas Fritiofson [Mon, 8 Sep 2014 20:11:02 +0000 (22:11 +0200)]
target: Remove "-variant" argument

Remove this underutilized feature. Despite the fact that a lot of configs
specifies a arbitrary "variant", only the xscale target actually defines
any.

In the case of xscale, the use of -variant is dubious since

1) it's used as a redundant irlen specifier,
2) it carries a comment that it doesn't really need it and
3) only two xscale configs even specify it.

If there's a future target that needs a variant set, a target specific
option could be added when needed.

Change-Id: I1ba25a946f0d80872cbd96ddcc48f92695c4ae20
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2283
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agompsse: Display libusb error names instead of numbers 89/2289/2
Joakim Gebart [Mon, 8 Sep 2014 13:15:42 +0000 (15:15 +0200)]
mpsse: Display libusb error names instead of numbers

Added calls to libusb_error_name() where applicable in order to easier
understand the error messages.

Change-Id: I3fe3d4b5624ae0de37c36e54a371eba5535ccaa1
Signed-off-by: Joakim Gebart <joakim.gebart@eistec.se>
Reviewed-on: http://openocd.zylin.com/2289
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor/tcl.c: Do not double probe banks 93/2093/2
Andrey Smirnov [Fri, 4 Apr 2014 14:41:58 +0000 (07:41 -0700)]
flash/nor/tcl.c: Do not double probe banks

Previous to this version the code of handle_flash_probe_command would
probe a bank twice: first time by auto-probe through a call to
flash_command_get_bank and second time by calling the probe function
directly. This change adds a flash_command_get_bank_maybe_probe wich
is a more generic version of the flash_command_get_bank, that would
allow commands to decide whether auto-probing should be performed or
not.

Change-Id: If150ca9c169ffe05e8c7eba36338d333360811e3
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2093
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotarget/arm_dpm: prevent endless loop in arm_dpm_full_context() 78/2278/2
Paul Fertser [Sun, 31 Aug 2014 07:04:39 +0000 (11:04 +0400)]
target/arm_dpm: prevent endless loop in arm_dpm_full_context()

The code treats registers that are shadowed in FIQ mode in a special
way: to read them out the target is first switches to USR mode. But
since USR != ANY the current implementation later skips register read,
and the loop becomes endless in case any !valid ARM_MODE_ANY is
present at the moment arm_dpm_full_context() is called. This was
reported in https://sourceforge.net/p/openocd/tickets/76/. The issue
surfaced because 2efb1f14f611f2ff8a380b703f3e8bcb8a95d1ad added two
ARM_MODE_ANY registers ("sp" and "lr") which were not normally read,
so at the time a user was calling "arm reg" they were not valid.

Fix this by changing the mode appropriately while keeping the "mode"
variable state intact so it would later match register's mode.

Compile-tested only.

Change-Id: I01840e8fa20ec392220138a3f1497ac25deb080a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2278
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor: add mrvlqspi flash controller driver 80/2280/4
Mahavir Jain [Thu, 4 Sep 2014 10:01:16 +0000 (15:31 +0530)]
flash/nor: add mrvlqspi flash controller driver

This patch adds support for QSPI flash controller driver for
Marvell's Wireless Microcontroller platform.
For more information please refer,
https://origin-www.marvell.com/microcontrollers/wi-fi-microcontroller-platform/

Following things have been tested on 88MC200 (Winbond W25Q80BV flash chip):
1. Flash sector level erase
2. Flash chip erase
3. Flash write in normal SPI mode
4. Flash fill (write and verify) in normal SPI mode

Change-Id: If4414ae3f77ff170b84e426a35b66c44590c5e06
Signed-off-by: Mahavir Jain <mjain@marvell.com>
Reviewed-on: http://openocd.zylin.com/2280
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoflash/nor/spi: Add Winbond w25q32fv flash support 73/2273/3
Mahavir Jain [Tue, 26 Aug 2014 09:52:51 +0000 (15:22 +0530)]
flash/nor/spi: Add Winbond w25q32fv flash support

Change-Id: I2919d462e04b489cc793b82ec347838a08cb8c48
Signed-off-by: Mahavir Jain <mjain@marvell.com>
Reviewed-on: http://openocd.zylin.com/2273
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agoSupport hla_serial command for ST-LINK adapters. 98/2198/8
Austin Phillips [Thu, 18 Sep 2014 04:39:41 +0000 (14:39 +1000)]
Support hla_serial command for ST-LINK adapters.

The hla_serial command allows for a programming device serial number to be
specified in addition to USB VID/PID.  This allows for multiple ST-LINK/V2
programmers to be attached to a single machine and operated using openocd.

Change-Id: I350654bf676eb26ba3a90450acfa55d2a5d2d791
Signed-off-by: Austin Phillips <austin_phillips@hotmail.com>
Reviewed-on: http://openocd.zylin.com/2198
Tested-by: jenkins
Reviewed-by: Martin Glunz <mg@wunderkis.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agojtag: drivers: stlink: remove unnecessary '\n' in LOG_* entries 20/2220/3
Andrey Skvortsov [Wed, 16 Jul 2014 12:40:34 +0000 (16:40 +0400)]
jtag: drivers: stlink: remove unnecessary '\n' in LOG_* entries

Change-Id: Ia2dc3efc27b53334af4d85f9807abba0463c291b
Signed-off-by: Andrey Skvortsov <andrej.skvortzov@gmail.com>
Reviewed-on: http://openocd.zylin.com/2220
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agoflash: added new Spansion S25FL116K, S25FL132K, and S25FL164K devices 81/2281/2
Anders [Mon, 8 Sep 2014 04:18:55 +0000 (21:18 -0700)]
flash: added new Spansion S25FL116K, S25FL132K, and S25FL164K devices

The new FL1-K family is replacing the FL-K family. The data from all
three was based on the datasheet. In addition the 8MB S25FL164K was
tested successfully with OpenOCD on a custom board.

Change-Id: Idafeed86da12a481c0db92cc0de7ba28f50c2252
Signed-off-by: Anders <anders@openpuma.org>
Reviewed-on: http://openocd.zylin.com/2281
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agostm32lx: don't allow part_info to be uninitialized 76/2276/5
Andrey Yurovsky [Thu, 28 Aug 2014 18:54:29 +0000 (11:54 -0700)]
stm32lx: don't allow part_info to be uninitialized

It's possible for us to fail to read the part ID code so make sure that
part_info is initialized to NULL before attempting to do so, otherwise
we could proceed and use it uninitialized and then segfault.

Change-Id: I0a3f3d3947690b66f0981b5046340449521e0b33
Signed-off-by: Jack Peel <jack.peel@synapse.com>
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2276
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agocortex_m: Check return value from cortex_m_dcc_read. 79/2279/2
Andreas Fritiofson [Tue, 2 Sep 2014 19:51:51 +0000 (21:51 +0200)]
cortex_m: Check return value from cortex_m_dcc_read.

Caught by clang.

Change-Id: I26d2b845aca431612862ef432b217ca397d9b893
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/2279
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agocfg: Added Nucleo-F411RE board config. 59/2259/2
Nemui Trinomius [Mon, 18 Aug 2014 14:58:37 +0000 (23:58 +0900)]
cfg: Added Nucleo-F411RE board config.

It supports STLink/V2-1 debug adapter.

Change-Id: Ifbc610cd68ec929608369e69d0b1395fe04956cd
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2259
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
6 years agotcl/board/sheevaplug: add adapter_khz setting 66/2266/2
Paul Fertser [Wed, 20 Aug 2014 08:04:18 +0000 (12:04 +0400)]
tcl/board/sheevaplug: add adapter_khz setting

This combination is known to work properly with 2MHz JTAG clock.

Change-Id: Ie5ec3d3b415efbb13faee7d34e0c7f862b78350c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2266
Tested-by: jenkins
6 years agotcl/interface/ftdi/sheevaplug: fix device description 65/2265/2
Paul Fertser [Wed, 20 Aug 2014 06:28:08 +0000 (10:28 +0400)]
tcl/interface/ftdi/sheevaplug: fix device description

Without this SheevaPlug debugging interface can't be matched.

Change-Id: Ifca149130d03c1aa165ed1123e8540e49485f023
Reported-by: Andreas Schneider <schneider.andi@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2265
Tested-by: jenkins
6 years agocfg: refactor lpc1xxx targets onto one base config 60/1960/13
Vanya Sergeev [Thu, 20 Feb 2014 09:06:04 +0000 (01:06 -0800)]
cfg: refactor lpc1xxx targets onto one base config

Since now auto-detection for flash size works nicely, there's no
reason to keep numerous configs around.

Change-Id: If0cbc37985abf17ef7c1f7d0688e76500fac228f
Signed-off-by: Vanya Sergeev <vsergeev@gmail.com>
Reviewed-on: http://openocd.zylin.com/1960
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotcl/target: add config for К1879ХБ1Я, a hybrid ARM11/DSP SoC by RC Module 72/2272/2
Бурага Александр [Mon, 25 Aug 2014 17:42:59 +0000 (21:42 +0400)]
tcl/target: add config for К1879ХБ1Я, a hybrid ARM11/DSP SoC by RC Module

This adds config to allow JTAG debugging of an ARM core of a modern
hybrid SoC by Research Centre "Module"
(http://www.module.ru/en/company/). К1879ХБ1Я is targetted at set-top
boxes and other multimedia equipment, the official SDK is Linux-based.

Change-Id: Ib2ae5784d25699f952682e66b025a3f677a76d5d
Signed-off-by: Бурага Александр <dtp-avb@yandex.ru>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2272
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agostm32f2x: added STM32F411xx series support. 58/2258/2
Nemui Trinomius [Mon, 18 Aug 2014 14:46:21 +0000 (23:46 +0900)]
stm32f2x: added STM32F411xx series support.

Added STM32F411xx series to flash driver.

Tested on NUCLEO-F411RE board(STM32F411RET6).

Change-Id: Id7d1f2858c09815a013e0590e65ad193fb039157
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/2258
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agotcl/interface/ftdi: fix TRST for Olimex TINY adapters 47/2247/2
Paul Fertser [Thu, 14 Aug 2014 15:57:47 +0000 (19:57 +0400)]
tcl/interface/ftdi: fix TRST for Olimex TINY adapters

According to the research by Eldar, TINY-H adapter has nTRST connected
to ACBUS0 directly via a 100 Ohms series resistor. I think it's safe
to assume the older TINY adapter does the same.

See high-res photos at [1].

This patch should fix issues with JTAG for the case when nTRST is
actually connected but is missing from the config.

[1] https://wikidevi.com/wiki/Olimex_ARM-USB-TINY-H

Change-Id: Iaaee7be30536ebb502802d38b82cd9573408f854
Reported-by: Хайруллин Эльдар <eldar.khayrullin@mail.ru>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2247
Tested-by: jenkins
Reviewed-by: demokmail <demokmail@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agoflash/nor/stellaris: add all Tiva C parts IDs 62/2262/4
Paul Fertser [Tue, 19 Aug 2014 14:49:53 +0000 (18:49 +0400)]
flash/nor/stellaris: add all Tiva C parts IDs

Luckily, TI's website has predictable URLs for the datasheets, so it
was trivial to download all the pdfs corresponding to the currently
available 71 TivaC devices. Then they were processed with pdftotext
and parsed by this script:

BEGIN { capture = -1 }
/^Device Identification 0 \(DID0\)$/ { state = "waitingclass0" }
/^Device Identification 1 \(DID1\)$/ { state = "waitingpartno0" }
/^CLASS$/ { if (state == "waitingclass0") state = "waitingclass"
    else if (state == "waitingclass") capture = 4 }
/^PARTNO$/ { if (state == "waitingpartno0") state = "waitingpartno"
    else if (state == "waitingpartno") capture = 4 }
(FNR == 3) { family = $2 }

{
    if (capture >= 0) {
if (capture == 0) {
    if (state == "waitingclass")
class = $0
    else if (state == "waitingpartno")
partno = $0
}
capture--
    }
}

END { print "{" class ", " partno ", \"" family "\"}," }

Change-Id: I6820c409fe535f08394c203276b5af4406fe8b92
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2262
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agoflash/nor/stellaris: improve support for Tiva C (Blizzard and Snowflake) 57/2257/4
Paul Fertser [Sun, 17 Aug 2014 09:58:07 +0000 (13:58 +0400)]
flash/nor/stellaris: improve support for Tiva C (Blizzard and Snowflake)

This should make current Tiva C parts usable apart from the protection.

Runtime tested on TM4C123GXL (Blizzard) and TM4C1294XL (Snowflake).

Change-Id: Ia64e9d39fbd2b7049578bbfade72435e5203ddf5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2257
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agotcl/interface/ftdi: add kt-link config (with SWD) for DP BusBlaster 69/2269/2
Paul Fertser [Sun, 24 Aug 2014 05:50:17 +0000 (09:50 +0400)]
tcl/interface/ftdi: add kt-link config (with SWD) for DP BusBlaster

Change-Id: Icbeca8c0c3845c0b777fb2e4c81b17e7b7cc5ff8
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2269
Tested-by: jenkins
Reviewed-by: Ben Gamari <bgamari@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agojtag/drivers/libusb0_common: fix FTBFS (libusb_device_descriptor error) 52/2252/3
Paul Fertser [Fri, 15 Aug 2014 15:30:47 +0000 (19:30 +0400)]
jtag/drivers/libusb0_common: fix FTBFS (libusb_device_descriptor error)

This struct and libusb_get_device_descriptor() method are not present
in libusb-0.1 API, so when libusb-1.0 is unavailable, this code breaks
the build. Fix by using the appropriate struct (which is apparently
filled automatically on device initialisation).

While at it, change return values for consistency with the callers.

Change-Id: I7d85ab9a70401a155a65122397008ae4d81382fe
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2252
Tested-by: jenkins
Reviewed-by: Austin Phillips <austin_phillips@hotmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agotcl/target/imx6: add yet another SJC tapid 53/2253/3
Paul Fertser [Fri, 15 Aug 2014 16:34:35 +0000 (20:34 +0400)]
tcl/target/imx6: add yet another SJC tapid

This is for mx6q TO1.1.

Change-Id: Id6af2ed232fc19be9bf49eb6d2df0004c6668698
Reported-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2253
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agotarget/adi_v5_swd: fix segfault when calling jtag_to_swd 56/2256/2
Paul Fertser [Sun, 17 Aug 2014 08:19:47 +0000 (12:19 +0400)]
target/adi_v5_swd: fix segfault when calling jtag_to_swd

When SWD mode is not supported by the target adapter, the call should
return an error instead of segfaulting.

Change-Id: I1626097deb93ecfbe78a6e82d812c7a673dbbde5
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2256
Tested-by: jenkins
6 years agojtag: always configure enabled tap parameter appropriately 61/2261/3
Paul Fertser [Tue, 19 Aug 2014 07:44:42 +0000 (11:44 +0400)]
jtag: always configure enabled tap parameter appropriately

Commit f701c0cb seems to have introduced a regression for non-JTAG
transports as the newly created "tap" (DAP actually) ended up being
disabled, thus resulting in total lack of functionality.

This was exposed by a debug log demonstrating ftdi SWD transport
connection to mdr32f9q2i, the target wasn't examined on init and
couldn't be reset.

Change-Id: If53cbe800d4adc177aa3ac3219860e7fa15b3e49
Reported-by: Хайруллин Эльдар <eldar.khayrullin@mail.ru>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2261
Tested-by: jenkins
Reviewed-by: Angus Gratton <gus@projectgus.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agotarget async loader: add offset to debug lines 03/2203/5
Angus Gratton [Tue, 1 Jul 2014 08:13:28 +0000 (18:13 +1000)]
target async loader: add offset to debug lines

This was very helpful when debugging programs during async loading.

Change-Id: Ia2eacc3e105403f70f51b1242b675e2ffe86e8ca
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/2203
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agostm32lx: refactor and add support for STM32L0xx 00/2200/7
Andrey Yurovsky [Thu, 10 Jul 2014 21:24:18 +0000 (14:24 -0700)]
stm32lx: refactor and add support for STM32L0xx

This adds initial support for the STM32L0 family, specifically the ID
code 417 variant.  The 'L0 has 128B rather than 256B pages as well as a
different number of pages per sector.  It also has several key registers
and register sets in different locations from the STM32L1xx parts.

This change therefore takes the opportunity to reorganize part information into
a const table (it was previously determined by a set of control statements) and
abstracts away some of the low-level details to make them generic for L1 and
L0 parts.

We also include the first bank's size (for dual bank parts) in the new
device information table (and correct that size for the 0x437 variant
which is 256 rather than 192KB).

The 'L0 parts will not use the built-in loader/helper for Flash writing.

Tested on STM32L053 (dicovery board and Nucleo board) and STM32L152
(discovery board).

Change-Id: I57f7a8ab02caee266de71b31ae82a50d85728a0b
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2200
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agojtag/drivers/ftdi: Use adapter_khz value for initial clock speed (was default 1kHz) 23/2223/3
Angus Gratton [Sat, 19 Jul 2014 08:50:55 +0000 (18:50 +1000)]
jtag/drivers/ftdi: Use adapter_khz value for initial clock speed (was default 1kHz)

nrf51822 doesn't like a 1kHz initial clock rate, puts the DAP into a bad state.

Mailing list discussion thread: http://sourceforge.net/p/openocd/mailman/openocd-devel/thread/20140718081528.GA5554%40ex2.lan/#msg32621853

Change-Id: I71aa75505cc1b41ee80c7b9db415f6ac738c2916
Signed-off-by: Angus Gratton <gus@projectgus.com>
Reviewed-on: http://openocd.zylin.com/2223
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
6 years agoflash: samd: add missing ID for SAMD20E18A 60/2260/2
Andrey Yurovsky [Mon, 18 Aug 2014 16:05:56 +0000 (09:05 -0700)]
flash: samd: add missing ID for SAMD20E18A

This was somehow missed in the chip ID table and of course that's
exactly the one on my board (as such, tested on hardware).

Change-Id: I212d7c729d979e0357f1d4635f40935e25fe6ff3
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/2260
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agojlink: Constantify string arrays 45/2245/2
Spencer Oliver [Fri, 8 Aug 2014 21:22:30 +0000 (22:22 +0100)]
jlink: Constantify string arrays

Change-Id: Ib63f4c32e6d5a7dad21567521d938142ea40b308
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2245
Tested-by: jenkins
6 years agojlink: add variant "J-Link Lite-ADI" 44/2244/2
Spencer Oliver [Fri, 8 Aug 2014 21:07:38 +0000 (22:07 +0100)]
jlink: add variant "J-Link Lite-ADI"

Fitted to various Analog Devices ADuCM36x dev boards.

Change-Id: Ib3691704c0ecd2f8cba1abba284aee695d6bc135
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2244
Tested-by: jenkins
6 years agojlink: fix typo 43/2243/2
Spencer Oliver [Fri, 8 Aug 2014 21:01:08 +0000 (22:01 +0100)]
jlink: fix typo

Change-Id: If495b819c0532a97447ec7208c13d8a66a3ad47d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/2243
Tested-by: jenkins
6 years agoflash/nor/stm32f1x: add STM32F302x6/8 IDs, clarify STM32F302xB/C 49/2249/2
Paul Fertser [Thu, 14 Aug 2014 16:36:27 +0000 (20:36 +0400)]
flash/nor/stm32f1x: add STM32F302x6/8 IDs, clarify STM32F302xB/C

Change-Id: I22afbe30f32b0ea9b59c3de8d15ce14bdc4763cc
Reported-by: Luis Rodrigues <lfrodrigues@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2249
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
6 years agojtag: usb_blaster: fix initialization regression 29/2229/2
Robert Jarzmik [Sun, 27 Jul 2014 10:30:13 +0000 (12:30 +0200)]
jtag: usb_blaster: fix initialization regression

As Daniel pointed out, since the rewrite of the USB Blaster driver, the
initialization behaviour has change. The initial flush of the FIFOs is
not longer done with a specific USB setup packet, but with a write
filling up the blaster queues.

The problem is, quoting Daniel :

    When the CPLD is in bit banging mode (as is usually the case), the
    first 0x00 byte sets all pins to low and disables the output
    driver. Disabling the output drivers is a few nanoseconds slower
    than changing a pin from high to low, so I see a spike towards GND
    on my reset line when that byte is sent over USB. The spike is too
    short to have an effect on the board.

    When the 4096 0x00 bytes are processed and the TMS=1 is to be
    generated, all I see is several microseconds of low level on all
    pins, resetting my board.

This patch changes the way the initialization is done :
 - at driver init, nothing is sent towards the usb-blaster
   This gives time for init script to setup PIN6 and PIN8 (resets)
 - at the very first driver command, the initialization is done :
   - the output is in bit bigbang mode
   - the PIN6 and PIN8 are computed according to init script
   - the 4096 computed output is sent

Change-Id: If7ceee957f6b59bcb27c8f912f1cfdd0f94f75ed
Reported-by: Daniel Glöckner <daniel-gl@gmx.net>
Cc: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-on: http://openocd.zylin.com/2229
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Daniel Glöckner <daniel-gl@gmx.net>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>