openocd.git
10 years agotopic: Added Spansion S25FL128S and S25FL256S spifi devices. 44/1844/2
Steve Moorby [Sat, 28 Dec 2013 15:23:41 +0000 (15:23 +0000)]
topic: Added Spansion S25FL128S and S25FL256S spifi devices.

S25FL256S device tested on mbest LPC4357 EVM, S25S128S untested but
from the same data sheet.

Change-Id: Idf58416aab08671fe29d22c3c34c2118b25a9d45
Signed-off-by: Steve Moorby <steve.moorby60@gmail.com>
Reviewed-on: http://openocd.zylin.com/1844
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agokinetis : Add timeouts to flash status checking in dap_syssec_kinetis_mdmap(). 19/1819/2
Per Ekman [Fri, 29 Nov 2013 07:11:44 +0000 (08:11 +0100)]
kinetis : Add timeouts to flash status checking in dap_syssec_kinetis_mdmap().

Change-Id: Ifc8fe7aa4c2a40a78fa0655435e82418f549bad3
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1819
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostlink: remove stlink_api command 60/1760/4
Mathias K [Sun, 10 Nov 2013 08:13:53 +0000 (09:13 +0100)]
stlink: remove stlink_api command

Remove stlink_api command.

Change-Id: I8f7885d3756fec462f9ebbee2ed285a98a51366c
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1760
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agokinetis : Detect MCU flash parameters based on the SDID register. 23/1823/2
Per Ekman [Fri, 29 Nov 2013 10:30:07 +0000 (11:30 +0100)]
kinetis : Detect MCU flash parameters based on the SDID register.

Try to detect the flash parameters based on the MCU SDID register. The hope
is that this works for K and KL series MCUs but it has only been tested on
a K21. YMMV.

Change-Id: Idfe71383a449065267f393b09ee3c3b24ac6a803
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1823
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoAdd %APPDATA%\OpenOCD to script search path on win 97/1797/2
Andreas Fritiofson [Tue, 30 Jul 2013 20:56:57 +0000 (22:56 +0200)]
Add %APPDATA%\OpenOCD to script search path on win

Change-Id: I01e9715fe064f3ff41e41a59a4764d6474f82183
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1797
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoRemove special handling of script search path on Windows 96/1796/2
Andreas Fritiofson [Sat, 27 Jul 2013 15:27:01 +0000 (17:27 +0200)]
Remove special handling of script search path on Windows

On all platforms, search for scripts in
$HOME/.openocd
${run_prefix}${pkgdatadir}/site
${run_prefix}${pkgdatadir}/scripts

On Windows, set run_prefix to the runtime path of the executable, minus
${bindir}. This is to enable the install dir to be moved anywhere, as long
as the structure of the install dir is kept intact. On all other platforms,
run_prefix is empty.

The script paths can now be adjusted on Windows builds the normal way; by
overriding pkgdatadir at build time. For example, to create a Windows
package layout of

bin/openocd.exe
scripts/interface/...
scripts/target/...

you can do
configure --prefix= --enable-... and then
make pkgdatadir= DESTDIR=/some/path clean all install

Also, remove the unused PKGLIBDIR define.

Change-Id: If2c8228fc80c598d763efad21c5f51695ff9b6cf
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1796
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget/imx6: Fix typo in setting _SJC_TAPID from SJC_TAPID variable 11/1811/2
Alex Murray [Tue, 19 Nov 2013 22:47:04 +0000 (09:17 +1030)]
target/imx6: Fix typo in setting _SJC_TAPID from SJC_TAPID variable

The set command was missing the $ prefix on the SJC_TAPID variable
and so would fail if SJC_TAPID was set

Change-Id: Ib9af58f5188bd8a2bc3f888309f203d624476c27
Signed-off-by: Alex Murray <alex.murray@cohdawireless.com>
Reviewed-on: http://openocd.zylin.com/1811
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoAvoid 'may be used uninitialized' warning from FreeBSD base GCC 35/1835/2
Ed Maste [Wed, 18 Dec 2013 16:18:14 +0000 (11:18 -0500)]
Avoid 'may be used uninitialized' warning from FreeBSD base GCC

Change-Id: Ice2472bf7a467652485a5a8c36880c6a47d64c6c
Signed-off-by: Ed Maste <emaste@freebsd.org>
Reviewed-on: http://openocd.zylin.com/1835
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agobuild: remove hard coded ftdi and usb libraries 59/1759/13
Mathias K [Wed, 30 Oct 2013 15:52:10 +0000 (16:52 +0100)]
build: remove hard coded ftdi and usb libraries

This patch remove the hardcoded libraries. Also a check for
libftdi1 installations was added. This check fix an issue
with gentoo and maybe other systems.

Change-Id: Ieff9ec4d66ee0f3e6b22261a10e4cab9f26b6b51
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1759
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag_vpi: fix build errors under MinGW 39/1839/2
Franck Jullien [Sat, 21 Dec 2013 20:54:40 +0000 (21:54 +0100)]
jtag_vpi: fix build errors under MinGW

Change-Id: Ic13f9982014ead811e2f2d737ca1621e0e85577e
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1839
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: add kl25z HLA (stlink) config 03/1803/2
Paul Fertser [Thu, 7 Nov 2013 19:26:45 +0000 (23:26 +0400)]
target: add kl25z HLA (stlink) config

Based on Nemuisan Tokusei's. Untested, but original config was reported
to work ok.

Change-Id: Ic991dce55bfca266880081fe2bbd9e6e263b0fc0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1803
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoat91sam7sx.cfg: fix use $_TARGETNAME as target identifier, not '0' warning 12/1812/2
Sergey A. Borshch [Fri, 22 Nov 2013 10:16:41 +0000 (12:16 +0200)]
at91sam7sx.cfg: fix use $_TARGETNAME as target identifier, not '0' warning

all other at91 cfg files already has this fix.
It also fix "No flash at address 0x...." error when JTAG chain consist of
more than one at91sam7sx cores during attempt to flash other than first mcu
in chain.

Change-Id: I7785d9103d0fc494b6a823e2c73f850373ffe112
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1812
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocfg: Add new BSTAPID for STM32F42xxx and STM32F43xxx series 08/1808/2
Nemui Trinomius [Sun, 17 Nov 2013 01:22:37 +0000 (10:22 +0900)]
cfg: Add new BSTAPID for STM32F42xxx and STM32F43xxx series

STM32F42xxx & STM32F43xxx series boudary scan TAP-ID are differ from
STM32F405xx/07xx & STM32F415xx/17xx.
And Section number was also fixed for RM0090 rev5.
Tested on a STM32F427IIT6 and STM32F429ZIT6.

Change-Id: Ie9c54c55b97b9c396ace752d94ea2ad916cc8479
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1808
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agofix flash bank auto_probe() fail with multiple targets 13/1813/2
Sergey A. Borshch [Fri, 22 Nov 2013 15:27:40 +0000 (17:27 +0200)]
fix flash bank auto_probe() fail with multiple targets

  get_flash_bank_by_addr() iterates through all flash banks
trying to auto_probe() every bank, even if bank can belongs to
target other than requested, and this other target can be
in non-halted state, which leads to error message and
operation abort.
  Same situation in gdb_new_connection() and gdb_memory_map():
get_flash_bank_by_num() tries to auto_probe() requested bank,
so first get bank by get_flash_bank_by_num_noprobe(), check
if it belongs to current connection's target and skip
get_flash_bank_by_num() (actually autoprobing) if not.

Change-Id: I48b3f93dddcd9283394f14ad2de3248397c75ab3
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1813
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoversaloon: Finish support for serial number matching 16/1816/2
Andreas Fritiofson [Mon, 25 Nov 2013 22:50:37 +0000 (23:50 +0100)]
versaloon: Finish support for serial number matching

Add a command to specify the serial string and pass it to the find helper.
Actual matching was already supported for both serial and product but was
using hard coded string indices. Instead use the indices from the device
descriptor.

Change-Id: I17c7538e5ad301ef41eace1ee70a202adab23bb4
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1816
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotcl/target: add config for Milandr's 1986ве1т controller 18/1818/3
Paul Fertser [Tue, 26 Nov 2013 17:33:48 +0000 (21:33 +0400)]
tcl/target: add config for Milandr's 1986ве1т controller

This is a Cortex-M1 controller targetting aviation appliances.

Contributed (and live-tested) by 8daemon.

Change-Id: I133d6122cf6492b51ddbdbd800c16ba121d51bf3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1818
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoftdi/neodb.cfg: mark as tested 14/1814/2
Paul Fertser [Mon, 25 Nov 2013 06:39:25 +0000 (10:39 +0400)]
ftdi/neodb.cfg: mark as tested

Working against openmoko gta02 target, including TRST and SRST (the
stupid samsung chip fully resets under trst, so it's actually of
little use here).

Change-Id: I831124659fc12efbccef536f07d15509c2112f92
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1814
Tested-by: jenkins
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotopic: Support for the Xilinx BSCAN_* Virtual JTAG in Openrisc 06/1806/4
Sergio Chico [Sun, 10 Nov 2013 15:03:40 +0000 (16:03 +0100)]
topic: Support for the Xilinx BSCAN_* Virtual JTAG in Openrisc

This add support to the Xilinx BSCAN_* virtual JTAG interface.
This is the Xilinx equivalent of the Altera sld_virtual_jtag interface,
it allows a user to connect to the debug unit through the main
FPGA JTAG connection.

Change-Id: Ia438e910650cff9cbc8f810b719fc1d5de5a8188
Signed-off-by: Sergio Chico <sergio.chico@gmail.com>
Reviewed-on: http://openocd.zylin.com/1806
Tested-by: jenkins
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32lx_dual_bank.cfg: fix typo in file path 32/1832/2
Andrey Yurovsky [Tue, 10 Dec 2013 19:59:33 +0000 (11:59 -0800)]
stm32lx_dual_bank.cfg: fix typo in file path

s/stm32l1x/stm32lx

...this makes tm32lx_dual_bank.cfg work again.

Change-Id: I04dc617523caa6b46c675fe9b700d1bbe88170e6
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1832
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash: revert incorrect stm32f1 default_padded_value 33/1833/2
Spencer Oliver [Fri, 13 Dec 2013 21:23:25 +0000 (21:23 +0000)]
flash: revert incorrect stm32f1 default_padded_value

Commit 2493671e2d9c352ea70edc8665b4c8f172ef1141 added a default flash
padded value to the wrong file, should have been stm32lx.c not stm32f1x.c.

Change-Id: Idab634a03ccb28609cc977a92ac2b138d1e8d859
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1833
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoNULL check before dereferencing 09/1809/2
Luca BRUNO [Thu, 22 Aug 2013 14:22:31 +0000 (16:22 +0200)]
NULL check before dereferencing

Check reg_list[i]->feature for NULL pointers before checking feature->name
in order to avoid NULL access.

Change-Id: If20401a6c5aa5e1e29f0fcf9bb95585b49658832
Signed-off-by: Luca BRUNO <lucab@debian.org>
Reviewed-on: http://openocd.zylin.com/1809
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
Reviewed-by: Jens Bauer <jens@gpio.dk>
10 years ago[PATCH 1/2]support64: Add functions into types and target 00/1700/4
Dongxue Zhang [Fri, 15 Nov 2013 08:55:34 +0000 (16:55 +0800)]
[PATCH 1/2]support64: Add functions into types and target

Add functions into types.h, target.c, target.h to operate 64bits data.
Prepare for 64bits mips target.

Change-Id: I668a8a5ac12ba754ae310fa6e92cfc91af850b1c
Signed-off-by: Dongxue Zhang <elta.era@gmail.com>
Reviewed-on: http://openocd.zylin.com/1700
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoAdd byte-swap helpers 98/1798/3
Andreas Fritiofson [Thu, 21 Nov 2013 22:07:40 +0000 (23:07 +0100)]
Add byte-swap helpers

Change-Id: I970616bb0e2bbc693165a0d311840febbd9134f1
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1798
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
10 years agokinetis : Add flash sector size detection for K21 MCU. 64/1764/4
Per Ekman [Thu, 24 Oct 2013 12:06:16 +0000 (14:06 +0200)]
kinetis : Add flash sector size detection for K21 MCU.

The current way of detecting the sector size of the internal
flash does not work for all Kinetis MCUs. Add support for the
K21 flash by detecting the specific model from the SDID register
and picking the correct sector size based on that.

Change-Id: I41f678353e45a44561af8a3398bdd4479dfeea4f
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1764
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agokinetis : Add flash read support to the kinetis nor flash driver. 63/1763/4
Per Ekman [Thu, 24 Oct 2013 11:55:58 +0000 (13:55 +0200)]
kinetis : Add flash read support to the kinetis nor flash driver.

The default_flash_read() function seems to work ok.

Change-Id: Ia34c4642405f669ff63310fa8c641098b771a401
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1763
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agokinetis : Fix broken check for mass erase. 62/1762/4
Per Ekman [Thu, 24 Oct 2013 09:54:32 +0000 (11:54 +0200)]
kinetis : Fix broken check for mass erase.

If the flash is not ready (MDM_STAT_FREADY is 0) then
dap_syssec_kinetis_mdmap() would act as if the MDM_STAT_SYSSEC bit was
set and erase the flash. Wait until MDM_STAT_FREADY is set before
checking the MDM_STAT_SYSSEC bit.

Change-Id: I5c3352f625599016625ed9be8787033f49bfacea
Signed-off-by: Per Ekman <pekenator@gmail.com>
Reviewed-on: http://openocd.zylin.com/1762
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agohla: Make consistent parameter naming 61/1761/3
Mathias K [Thu, 24 Oct 2013 12:11:33 +0000 (14:11 +0200)]
hla: Make consistent parameter naming

Rename fd to handle.

Change-Id: I98615aed1546976d00b0f20856d4e8e75f83c575
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1761
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: use target_buffer_set_u32_array 83/1783/3
Spencer Oliver [Thu, 24 Oct 2013 22:26:51 +0000 (23:26 +0100)]
target: use target_buffer_set_u32_array

Attempt to use target_buffer_set_u32_array to convert to target endian
arrays rather reimplementing code.

This also removed cfi_fix_code_endian as its functionality is also
repeated.

Change-Id: I7c359dbe46ea791cd5f6fb18d8b0fb6895c599d3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1783
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoulink: Fix libusb include changed since pkg-config merge 95/1795/2
Andreas Fritiofson [Mon, 4 Nov 2013 22:37:52 +0000 (23:37 +0100)]
ulink: Fix libusb include changed since pkg-config merge

Change-Id: I1556aaf117f99de046e3c16d5386faaaefdfefd8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1795
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
10 years agojtag: fix support for really long scans 92/1792/2
Paul Fertser [Sun, 3 Nov 2013 18:05:26 +0000 (22:05 +0400)]
jtag: fix support for really long scans

When programming large FPGAs the generated SVF files might contain really
long SDR scans. They won't fit in the 1MiB jtag scan page at all, so in
this case the allocated page needs to be bigger. The current code was
silently corrupting memory.

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

Change-Id: I39f18d7e0654f2dbdf37df58c837c9ec1fb2aa2a
Reported-by: "Voltner, Jiří" <j.voltner@era.aero>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1792
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32l flash: add another device ID 90/1790/2
Andrey Yurovsky [Fri, 1 Nov 2013 21:29:17 +0000 (14:29 -0700)]
stm32l flash: add another device ID

Add device ID 0x437, a dual-bank part with 512KB total.  This one used
the Medium+/HD flash size register to read the flash size in Kb rather
than the 0/1 code in the Medium+ parts.

Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Change-Id: I870fe3bb1b473939b7211c3b2edb44b4b3643648
Reviewed-on: http://openocd.zylin.com/1790
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoadd TI TMS570 support scripts 88/1788/4
Andrey Yurovsky [Thu, 31 Oct 2013 06:32:40 +0000 (23:32 -0700)]
add TI TMS570 support scripts

Add support for the TMS570 Cortex-R4 MCU from TI and their USB stick
development kit, TMDX570LS31USB.  Tested attaching, reset/halt/run, and
reading and writing memory and registers.

Change-Id: I12d779cef0c2b834f9bcf722307f35677cc4bd8f
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Reviewed-on: http://openocd.zylin.com/1788
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agofm3: fix Fujitsu MB9Ax family support 93/1793/3
Nemui Trinomius [Mon, 4 Nov 2013 06:43:43 +0000 (15:43 +0900)]
fm3: fix Fujitsu MB9Ax family support

Some MB9Ax (especially few internal SRAM model) fails programming
because of wrong SRAM basic-address on running algorithm.
Default SRAM basic-address must be 0x20000000.
This patch is fixing default SRAM basic-address and ramcode offset.
Tested on a MB9BF618T and MB9AF112K.

Change-Id: Ibda9aceb4c317bcae0dcce9f6d0fd1c4b5d81952
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1793
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoCorrect argument numbering in trace command 00/1800/2
Alan Bowman [Tue, 5 Nov 2013 22:25:51 +0000 (22:25 +0000)]
Correct argument numbering in trace command

The trace command was opening a file named with the source frequency.
This change correctly passes the filename that is specified.

Change-Id: Ia2eb8eda0e1e0f4f44b05c3a0ce7bef3bda51446
Signed-off-by: Alan Bowman <alan.michael.bowman@gmail.com>
Reviewed-on: http://openocd.zylin.com/1800
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agolpcspifi: Fix byte order bug 71/1771/3
Andreas Fritiofson [Thu, 31 Oct 2013 22:21:50 +0000 (23:21 +0100)]
lpcspifi: Fix byte order bug

Found by grepping for pointer casts.

Change-Id: I42ef3ebcce9fc6391154888b48601ede8377c34e
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1771
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: fix mem2array/array2mem 79/1679/3
Mathias K [Thu, 24 Oct 2013 06:31:45 +0000 (08:31 +0200)]
target: fix mem2array/array2mem

 if data size is bigger than transfer buffer, all portions are
 transferred from/to the same target address - address advance
 after successful transmission missed.

Change-Id: I79a6c388af197ac062d2807e397a2d7947400520
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/1679
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
10 years agosmp: Fix byte order bug 79/1779/2
Andreas Fritiofson [Mon, 30 Sep 2013 21:33:59 +0000 (23:33 +0200)]
smp: Fix byte order bug

Found by grepping for pointer casts.

Also rewrite to reduce scope and allocate the few bytes needed on stack
instead of on heap.

Change-Id: Ia2a369fb612e807b981ee60ebcfd9c09c2fbdf4c
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1779
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoti_icdi_usb: Remove unnecessary casts and fix byte order bugs 78/1778/2
Andreas Fritiofson [Sat, 28 Sep 2013 22:19:41 +0000 (00:19 +0200)]
ti_icdi_usb: Remove unnecessary casts and fix byte order bugs

Found by grepping for pointer casts.

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

Change-Id: I13796b056f00976979bf0e754de3aa7648f7f321
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1778
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoioutil: Remove unnecessary casts and fix const-discarding 77/1777/2
Andreas Fritiofson [Sat, 28 Sep 2013 21:13:51 +0000 (23:13 +0200)]
ioutil: Remove unnecessary casts and fix const-discarding

Using the right parameter type, there's no need to resort to casting.

Change-Id: I8aec852431ead26e24793fd6fac8781353963bf2
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1777
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Jens Bauer <jens@gpio.dk>
10 years agobinarybuffer: Remove unnecessary cast and fix hidden "bug" 76/1776/2
Andreas Fritiofson [Sat, 28 Sep 2013 21:01:07 +0000 (23:01 +0200)]
binarybuffer: Remove unnecessary cast and fix hidden "bug"

Because of the cast, the const decoration on the parameter provided no
guarantee against modification since it was silently discarded.

Change-Id: Ib83ade955e1a61ee2175c690620437b5e19cbb6a
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1776
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostr9x: Fix byte order bug 75/1775/2
Andreas Fritiofson [Sat, 28 Sep 2013 20:30:05 +0000 (22:30 +0200)]
str9x: Fix byte order bug

Found by grepping for pointer casts.

Change-Id: Ie2d698310b077c3849266e81df8e6a808cbc6896
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1775
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostr7x: Fix byte order bug 74/1774/2
Andreas Fritiofson [Sat, 28 Sep 2013 20:28:57 +0000 (22:28 +0200)]
str7x: Fix byte order bug

Found by grepping for pointer casts.

Change-Id: I56d5680590e37d8c61197488067fbb0776e5e0f0
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1774
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32f1x: Fix byte order bug and remove unnecessary cast 73/1773/2
Andreas Fritiofson [Sat, 28 Sep 2013 20:25:52 +0000 (22:25 +0200)]
stm32f1x: Fix byte order bug and remove unnecessary cast

Found by grepping for pointer casts.

Change-Id: Ibd8f22a9e9ca71459ba0bedc8447a3623d0e4184
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1773
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agopic32mx: Fix byte order bug 72/1772/2
Andreas Fritiofson [Sat, 28 Sep 2013 20:14:49 +0000 (22:14 +0200)]
pic32mx: Fix byte order bug

Found by grepping for pointer casts.

Change-Id: If73184a16904ec2958e7253ba98f44479fdcad3f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1772
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agolpc2900: Fix byte order bugs and remove unnecessary casts 70/1770/2
Andreas Fritiofson [Sat, 28 Sep 2013 20:01:46 +0000 (22:01 +0200)]
lpc2900: Fix byte order bugs and remove unnecessary casts

Found by grepping for pointer casts.

Change-Id: Ib94957a0c53ec7abcbd5787d8c70e20c9eedc4b7
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1770
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoaduc702x: Fix byte order bug 69/1769/2
Andreas Fritiofson [Sat, 28 Sep 2013 19:28:08 +0000 (21:28 +0200)]
aduc702x: Fix byte order bug

Found by grepping for pointer casts.

Change-Id: I00e000515cb2573130b73423eb19ba941f524b05
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1769
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoftdi: Remove unnecessary cast 68/1768/2
Andreas Fritiofson [Sat, 28 Sep 2013 21:33:59 +0000 (23:33 +0200)]
ftdi: Remove unnecessary cast

Also make sure future growth of the tap_get_tms_path() return value will
get noticed.

Change-Id: Id859b463e5fdc819a4bc3b4845bf4363fbe713af
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1768
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoRemove unnecessary casts 67/1767/2
Andreas Fritiofson [Sat, 28 Sep 2013 19:43:37 +0000 (21:43 +0200)]
Remove unnecessary casts

Change-Id: Ia97283707282ccccdc707c969f59337313b4e291
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1767
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonand/mx*: Remove unused host endianness flag 66/1766/2
Andreas Fritiofson [Sat, 28 Sep 2013 19:13:05 +0000 (21:13 +0200)]
nand/mx*: Remove unused host endianness flag

Probably shouldn't depend on that anyway.

Change-Id: Ic27ead4cb82cff1ab187696439da4b93941e09d8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1766
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoRemove unnecessary (void *) 69/1669/3
Andreas Fritiofson [Sat, 28 Sep 2013 15:28:25 +0000 (17:28 +0200)]
Remove unnecessary (void *)

When pointer casts are needed, cast directly to the correct type, instead
of going via void*.

Don't explicitly cast to void* if it would have been done implicitly.

Change-Id: I4093209200051c5eb62847d00a4b9c8567480068
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1669
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoClean up const usage to avoid excessive casting 68/1668/3
Andreas Fritiofson [Mon, 30 Sep 2013 21:16:20 +0000 (23:16 +0200)]
Clean up const usage to avoid excessive casting

Don't use const on pointers that hold heap allocated data, because that
means functions that free them must cast away the const.

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

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

Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1668
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoftdi/tumpa.cfg: enable proper output buffer control, add another USB ID 89/1789/2
Paul Fertser [Thu, 31 Oct 2013 11:16:15 +0000 (15:16 +0400)]
ftdi/tumpa.cfg: enable proper output buffer control, add another USB ID

The schematics used for writing the config file were incorrect, real
hardware needs ACBUS3 _low_ as it's connected directly to the output
buffer's !OE pin.

Also apparently sometimes TUMPA comes with default FTDI IDs.

Real-life tested (including TRST and SRST) with a custom stm32f103
board, thanks to Mike Wang for the adapter sample.

Change-Id: Iab566e6d14f8392030f6ff2c8d976e1b57cf5ce6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1789
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoClean up many C99 integer types format specifiers 74/1674/4
Paul Fertser [Mon, 30 Sep 2013 09:31:57 +0000 (13:31 +0400)]
Clean up many C99 integer types format specifiers

This eliminates most of the warnings reported when building for
arm-none-eabi (newlib).

Hsiangkai, there're many similar warnings left in your nds32 files, I
didn't have the nerve to clean them all, probably you could pick it
up.

Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1674
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocheckpatch: correct false positives reporting instructions 86/1786/2
Paul Fertser [Sat, 26 Oct 2013 07:34:22 +0000 (11:34 +0400)]
checkpatch: correct false positives reporting instructions

Change-Id: Ib45d3db4436a5df5215f2c2d8b8f9a6d48d5f348
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1786
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocheckpatch: treat jenkins as valid email 85/1785/2
Paul Fertser [Sat, 26 Oct 2013 07:24:43 +0000 (11:24 +0400)]
checkpatch: treat jenkins as valid email

This is needed to avoid checkpatch barking on already committed patches.

Change-Id: Ic2b4cfa04c8230d45c68bbf6b370841f682b32d6
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1785
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocortex_m: set fpb_enabled on enabling fpb 34/1634/4
Spencer Oliver [Wed, 25 Sep 2013 13:43:08 +0000 (14:43 +0100)]
cortex_m: set fpb_enabled on enabling fpb

If the fpb_enabled is not set then as part of cortex_m3_set_breakpoint we
enable the fpb, however we do not signal the fpb as being enabled.

This issue only effects the hla target as the current cortex_m code enables
the fpb during cortex_m3_endreset_event.

Change-Id: I44d3fc65916c131b7a226869dd16aed5afb441b4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1634
Tested-by: jenkins
10 years agohla/stlink: Re-order trace parameters to allow trace output file to be optional 60/1660/3
James G. Smith [Thu, 26 Sep 2013 11:08:05 +0000 (12:08 +0100)]
hla/stlink: Re-order trace parameters to allow trace output file to be optional

Re-order the "trace" parameters to allow the raw capture (log) file to
be an optional feature. The clock frequency for calculating the "Async
Clock Prescalar" is always required when enabling trace processing and
is now the first "required" parameter.

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

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

Change-Id: Ibc385dd0a7adaf9bd652bceded27262fef35fd59
Signed-off-by: James G. Smith <jsmith@ecoscentric.com>
Reviewed-on: http://openocd.zylin.com/1660
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agosam4s flash: fix PLLA frequency calculation if diva > 1 65/1765/2
Thomas Schmid [Thu, 24 Oct 2013 15:32:35 +0000 (09:32 -0600)]
sam4s flash: fix PLLA frequency calculation if diva > 1

The code didn't address the case where diva is bigger than 1.

Change-Id: I15d8c47aa7b5cf80df1f29e067f30575f5d60a90
Signed-off-by: Thomas Schmid <thomas.schmid@gmail.com>
Reviewed-on: http://openocd.zylin.com/1765
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotcl: add memory testing functions for board diagnostics 55/1455/4
Paul Fertser [Fri, 21 Jun 2013 21:16:41 +0000 (01:16 +0400)]
tcl: add memory testing functions for board diagnostics

This is a tcl implementation of public domain tests by Michael Barr,
http://www.barrgroup.com/Embedded-Systems/How-To/Memory-Test-Suite-C

The initial porting is done by Shane Volpe and posted to the mailing
list:
http://www.mail-archive.com/openocd-development@lists.berlios.de/msg16676.html

This patch includes some cosmetic amendments plus hardcodes 32bit word
size (as the code depends on memread32/memwrite32 anyway) which fixes
original code's issue of testing only the first quarter of the
specified nBytes.

Change-Id: I5f3a66f1f16fc4082c7a5a6aba338430646ed21c
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1455
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
10 years agoRemove jtag_rclk from target configs 95/1695/2
Paul Fertser [Sun, 13 Oct 2013 15:15:24 +0000 (19:15 +0400)]
Remove jtag_rclk from target configs

Some boards might have RCLK omitted from the JTAG connector and if the
interface claims support for it, OpenOCD will end up trying to use
RCLK while it's actually impossible.

This is a "cd tcl/target; sed -i s/jtag_rclk/adapter_khz/g *" patch.

Change-Id: Iee7337107bc1457966b104389ba9db75a9c860b4
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1695
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
10 years agohla_interface: init trst, srst variables. 98/1698/2
Sergey A. Borshch [Fri, 18 Oct 2013 15:13:03 +0000 (18:13 +0300)]
hla_interface: init trst, srst variables.

  There is an remark in jtag_srst and jtag_trst variables declaration:
  /*
   * JTAG adapters must initialize with TRST and SRST de-asserted
   * (they're negative logic, so that means *high*).  But some
   * hardware doesn't necessarily work that way ... so set things
   * up so that jtag_init() always forces that state.
   */

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

Change-Id: Ia620d8794cca8ba1403f5c5f24767e730033748a
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1698
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
10 years agolpc2000: Fix flash programming fail on LPC4300 internal flash 84/1784/2
Nemui Trinomius [Sat, 26 Oct 2013 03:17:04 +0000 (12:17 +0900)]
lpc2000: Fix flash programming fail on LPC4300 internal flash

LPC43xx with internal flash parts model needs "IAP Init(49)"Command
before erase & write internal flash.Tested on a LPC4337 and LPC4357.

Change-Id: I48620ce12e578c61a3ca1adcd48815c1f71c35bb
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1784
Tested-by: jenkins
Reviewed-by: Jens Bauer <jens@gpio.dk>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarmada370: initial support for Marvell Armada 370 family 90/1690/3
Greg Ungerer [Wed, 9 Oct 2013 13:15:07 +0000 (23:15 +1000)]
armada370: initial support for Marvell Armada 370 family

Initial support for using the jtag interface to the Marvell Armada 370
family of SoCs.

Change-Id: Id823a567e8805ac622c3c330bc111297c1dae37e
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Reviewed-on: http://openocd.zylin.com/1690
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoFix ULINK driver dependencies in configure.ac 99/1699/3
Martin Schmölzer [Mon, 21 Oct 2013 05:23:16 +0000 (07:23 +0200)]
Fix ULINK driver dependencies in configure.ac

Commit dd6274deed65c47ba2ef46e14259167d393399d8 (see
http://openocd.zylin.com/#/c/1475/ for futher information) adds the wrong
libusb dependency for the ULINK driver (libusb-0.1), when in fact the ULINK
driver uses the libusb-1.0 API since commit
f684252b2530d86f3a8330940105b86c770231f1.

Change-Id: I6946f1fdc0e26bfc7bdcff27a721e05a05b464a5
Signed-off-by: Martin Schmölzer <martin.schmoelzer@student.tuwien.ac.at>
Reviewed-on: http://openocd.zylin.com/1699
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash: mxc nfc(v1) : fix incorrect address in spare area for biswap command 92/1692/3
Gaëtan Carlier [Sat, 12 Oct 2013 19:09:21 +0000 (21:09 +0200)]
flash: mxc nfc(v1) : fix incorrect address in spare area for biswap command

For NFC v1 (i.MX27), swapping must be done between offset 464 of Main
buffer and offset 4 of Spare buffer.

Change-Id: I09c2036e88770032da87d5846cd2094847f47b46
Signed-off-by: Gaetan Carlier <gcembed@gmail.com>
Reviewed-on: http://openocd.zylin.com/1692
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocfg: add STM32F429 discovery board config 91/1691/2
Spencer Oliver [Thu, 10 Oct 2013 19:56:26 +0000 (20:56 +0100)]
cfg: add STM32F429 discovery board config

Change-Id: I4ee7a8185a02fac9d1f6079ab34d6a9f7047193a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1691
Tested-by: jenkins
10 years agolpc288x: Can now use target_write_buffer() 87/1687/2
Andreas Fritiofson [Fri, 4 Oct 2013 22:24:28 +0000 (00:24 +0200)]
lpc288x: Can now use target_write_buffer()

Use the preferred code path according to the comment. Target_write_buffer()
now simply uses suitably aligned target_write_memory calls, so from this
pov, they should be equivalent.

Change-Id: I77f51ec3ac9faa822cf428708a1aecb67c77830c
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1687
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: Remove unused declaration 86/1686/2
Andreas Fritiofson [Fri, 4 Oct 2013 22:19:36 +0000 (00:19 +0200)]
nds32: Remove unused declaration

Change-Id: Ie0df720b2adacc8f10474f88f15142fa94c388b8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1686
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years ago hla_target: Update target state when polling 80/1680/3
Sergey A. Borshch [Mon, 7 Oct 2013 08:45:40 +0000 (11:45 +0300)]
hla_target: Update target state when polling

    Polling target does not change stste information
    except if new state is TARGET_HALTED.
    Connecting to the runing target result in target->state
    not updated with retrieved value and remains "UNKNOWN"
    until 'halt' command issued.

Change-Id: I803d6c0207f7f8699e648779d1df342c9ee7315a
Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/1680
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarm7_9: Avoid infinite loops in bulk write dispatching 85/1685/2
Andreas Fritiofson [Fri, 4 Oct 2013 22:19:08 +0000 (00:19 +0200)]
arm7_9: Avoid infinite loops in bulk write dispatching

Add a mandatory field in struct arm7_9_common for regular, non-optimized
memory writes. Together with the existing bulk_memory_write field, this
allows variants to select any combination of implementations for regular
and bulk writes, without risking infinite loops from accidentally using
bulk writes for implementing bulk writes.

ARM 7/9 targets may now select arm7_9_memory_write_opt as their
target.write_memory implementation, which will dispatch to
arm7_9_common.bulk_write_memory if possible, or fallback to
arm7_9_common.write_memory otherwise.

To avoid loops, bulk write implementations mustn't call any other
functions than arm7_9_write_memory_no_opt() to write memory; it will
unconditionally call arm7_9_common.write_memory. If they fail, they should
simply return error to allow the caller to fallback to regular writes.

Tested on a regular ARM7TDMI only.

Change-Id: Iae42a6e093e2df68c4823c927d757ae8f42ef388
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1685
Tested-by: jenkins
Reviewed-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoopenrisc/tap_vjtag: fix IR setting 94/1694/3
Franck Jullien [Sun, 13 Oct 2013 06:23:01 +0000 (08:23 +0200)]
openrisc/tap_vjtag: fix IR setting

Change-Id: I2b1f057dc9777ff263d6cefa4ff5958e85607a22
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1694
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoopenrisc/du_adv: check or1k_adv_jtag_init return value 93/1693/2
Franck Jullien [Sun, 13 Oct 2013 06:29:53 +0000 (08:29 +0200)]
openrisc/du_adv: check or1k_adv_jtag_init return value

Change-Id: I784c16b8137b4269254c86007e6766b1a2297aa2
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1693
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocheckpatch: add logging functions 96/1696/2
Paul Fertser [Mon, 14 Oct 2013 06:03:00 +0000 (10:03 +0400)]
checkpatch: add logging functions

It's commonly considered that user-visible strings should not be split
to different lines in the sources to ease grepping for them. Hence,
checkpatch traditionally makes an exception for logging functions,
lines having them can be of arbitrary length.

OpenOCD uses different (from Linux, the kernel) names, so they need to
be added to avoid false positives.

Change-Id: I1198c1ffc62b5403d97efa41e665c81a5b6bb3a3
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1696
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag_vpi: use DIV_ROUND_UP 83/1683/2
Franck Jullien [Thu, 3 Oct 2013 21:17:58 +0000 (23:17 +0200)]
jtag_vpi: use DIV_ROUND_UP

Change-Id: I31d315a79a1587d7873c5b8713daf8276fa146d0
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1683
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agojtag_vpi: fix path move function 72/1672/3
Franck Jullien [Thu, 3 Oct 2013 21:22:32 +0000 (23:22 +0200)]
jtag_vpi: fix path move function

Change-Id: I82bf6f733e0d9cb5c86553d0827c558fa98aa247
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1672
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agosam4s flash: remove unused bootstrap routine 41/1641/2
Andrey Yurovsky [Sat, 21 Sep 2013 05:21:10 +0000 (22:21 -0700)]
sam4s flash: remove unused bootstrap routine

Remove the static const array containing ARM instructions for a
bootstrap program.  Despite what the comment says, the DAP can write to
the Flash and in fact this program is not referenced anywhere in openocd
so it's a bit confusing having it in there.  There should be no
functionality change from this.

Change-Id: I4ca4206f090a896628ee9b675d1f04450ada1563
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1641
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agobcm2835gpio: use maximum drive strength 33/1633/4
Paul Fertser [Wed, 18 Sep 2013 19:42:50 +0000 (23:42 +0400)]
bcm2835gpio: use maximum drive strength

According to the docs, the default drive strength for the GPIO pads is
8mA but they're capable of 16mA. Configure GPIO 0-27 to use the maximum
(as they might be used on high enough frequency with JTAG).

Change-Id: I621737a1b0a855bb97b56ce2cc46c0e385b74f5d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1633
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocortex_m: target implementation renames cortex_m3 to cortex_m 26/1626/4
Spencer Oliver [Thu, 10 Oct 2013 20:16:42 +0000 (21:16 +0100)]
cortex_m: target implementation renames cortex_m3 to cortex_m

We changed the actual target name quite a while ago.
This changes the actual target function names/defines to also match
this change.

Change-Id: I4f22fb107636db2279865b45350c9c776e608a75
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1626
Tested-by: jenkins
10 years agostr7x: Improve info text 43/1643/3
Andreas Fritiofson [Mon, 7 Oct 2013 21:13:36 +0000 (23:13 +0200)]
str7x: Improve info text

There's no way to print two lines, so let it wrap.

Change-Id: I1f6211358a58877c0b729d9fdefd5d3dea8cba00
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1643
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32f2x: Fix sector numbering for dual bank flash erase 89/1689/2
Andreas Fritiofson [Mon, 7 Oct 2013 18:56:16 +0000 (20:56 +0200)]
stm32f2x: Fix sector numbering for dual bank flash erase

Reference: RM0090 rev 5.

Change-Id: I9f7ae09c0ba91d166aebcdc25300d0ca58a5a56d
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reported-by: Nader Shehayed <nshehayed@gmail.com>
Reviewed-on: http://openocd.zylin.com/1689
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agostm32l: set default padded value 36/1636/2
Spencer Oliver [Thu, 19 Sep 2013 11:08:53 +0000 (12:08 +0100)]
stm32l: set default padded value

The stm32l family has an erased value of 0x00, so overide the defaults used
by OpenOCD.

Change-Id: I314bdef1f8482fbcbd43e0f413247d3a35af869d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1636
Tested-by: jenkins
10 years agoflash: add padded_value cmd 35/1635/2
Spencer Oliver [Thu, 19 Sep 2013 11:07:06 +0000 (12:07 +0100)]
flash: add padded_value cmd

This adds support for setting the default value used when padding image
sections. Previously 0xff was used but some targets have an erased value
of 0x00.

Change-Id: If3df6fea3abf95b09daa3ff7be362acf991070ce
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1635
Tested-by: jenkins
10 years agoflash: fix mini51 cygwin build issues 75/1675/2
John David Anglin [Wed, 2 Oct 2013 20:26:38 +0000 (21:26 +0100)]
flash: fix mini51 cygwin build issues

Under certain versions of cygwin it appears PAGE_SIZE is already defined.
So change name to stop any possible build issues.

Change-Id: I6f0e0c352c06bb6118ac3a5b884ae8e93194b570
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1675
Tested-by: jenkins
10 years agofix lpc2000 flash programming fail. 76/1676/2
Sergey A. Borshch [Thu, 3 Oct 2013 13:05:15 +0000 (16:05 +0300)]
fix lpc2000 flash programming fail.

 some members of lpc2000_info structure sometimes used uninitialized
 (cmd51_can_64b for all LPC except LPC800 as example).
  Init allocated lpc2000_info structure with zeros to avoid this and similar bugs in the future.
  Note: maybe discarding all cmd51_can_XXXb fields and using cmd51_dst_boundary instead will be a better solution.

Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net>
Change-Id: Idf116a5b0bf4ea1c39ea0ce308ec2c13bfbd4d8c
Reviewed-on: http://openocd.zylin.com/1676
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
10 years agostm32f2x: Detect STM32F42x rev Y 88/1688/2
Andreas Fritiofson [Sat, 5 Oct 2013 20:43:34 +0000 (22:43 +0200)]
stm32f2x: Detect STM32F42x rev Y

Change-Id: Iaf94f6dda0686cce56be77431bbb961bfd5e8d14
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1688
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag/tcl: Avoid casting away const 67/1667/2
Andreas Fritiofson [Sat, 28 Sep 2013 14:31:06 +0000 (16:31 +0200)]
jtag/tcl: Avoid casting away const

Here, in_value == out_value, so free the non-const one.

Change-Id: I017ad9e7519711ac0c9da79265be7daaa846f356
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1667
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag/tcl: Remove no-op free 66/1666/2
Andreas Fritiofson [Sat, 28 Sep 2013 14:29:50 +0000 (16:29 +0200)]
jtag/tcl: Remove no-op free

And use calloc instead of malloc+memset.

Change-Id: Icc1ed6e34904972bb5d3728307dcae5c55b32fc3
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1666
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojtag/tcl: Fix double free in jtag newtap argument parsing 65/1665/2
Andreas Fritiofson [Sat, 28 Sep 2013 14:07:14 +0000 (16:07 +0200)]
jtag/tcl: Fix double free in jtag newtap argument parsing

Found when grepping for void* casts. I'm pretty sure there are about
*picking a number out of the blue* 0.31 bugs per pointer cast in OpenOCD.

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

Change-Id: Idc12e8f18036cc908fdb572828fa46563be14242
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1665
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agogdb_server: Further cleanup of target desc functions 45/1645/2
Andreas Fritiofson [Sun, 22 Sep 2013 11:01:00 +0000 (13:01 +0200)]
gdb_server: Further cleanup of target desc functions

Fix use of uninitialized pointer passed to xml_printf, caught by valgrind.

Make sure a failed gdb_generate_target_description frees all allocated
memory and avoids touching its out argument.

Plug memory leak and check allocation in handle_gdb_save_tdesc_command.

Change-Id: I30e20f6760a6215b1b4496304acdf47347eed829
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1645
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Franck Jullien <franck.jullien@gmail.com>
10 years agohla: if the idcode callback returns 0, treat as a wildcard 73/1673/2
Paul Fertser [Sun, 29 Sep 2013 15:12:17 +0000 (19:12 +0400)]
hla: if the idcode callback returns 0, treat as a wildcard

Also document the callback accordingly.

Change-Id: I7e8ef481e8b5391b763b7f7187fac023e9fe04df
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1673
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoboard: add TM4C123G LaunchPad config 47/1647/2
Paul Fertser [Sun, 22 Sep 2013 18:09:26 +0000 (22:09 +0400)]
board: add TM4C123G LaunchPad config

Almost the same as the LM4F120 LaunchPad but the chip is using the new
naming scheme (Tiva C series), supports USB OTG and has some new PWM
hardware blocks.

Change-Id: I6a7b2df76768766471f366cddaf64df3cc63f5f2
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1647
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoflash/nor: Make info function optional 42/1642/3
Andreas Fritiofson [Sat, 21 Sep 2013 16:39:01 +0000 (18:39 +0200)]
flash/nor: Make info function optional

Remove lots of no-op or dummy info function implementations and check if
it's implemented before invoking it.

Change-Id: I2144dad6a84a80359bb13a8a29a4614387e4c135
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1642
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocortex_m: Call mem_ap_read/write directly 59/1659/2
Andreas Fritiofson [Wed, 25 Sep 2013 20:48:26 +0000 (22:48 +0200)]
cortex_m: Call mem_ap_read/write directly

Change-Id: I52e1d8babf7bf9fcde4094046d29b817c15c0562
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1659
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarm_adi_v5: Rewrite MEM-AP transfer implementation 58/1658/2
Andreas Fritiofson [Wed, 25 Sep 2013 21:58:24 +0000 (23:58 +0200)]
arm_adi_v5: Rewrite MEM-AP transfer implementation

Create a single pair of relatively simple functions to handle all variants
of MEM-AP transfers. This replaces the many separate functions that
handled different access sizes and packed or non-packed transfers, which
were all implemented rather differently.

With this single implementation, performance should be more consistent,
regardless of transfer type.

Change-Id: I89960e437fc6ba68a389c074fab8eac91abcf844
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1658
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agocortex_m: mem_ap access functions take number of bytes, not words 57/1657/2
Andreas Fritiofson [Wed, 25 Sep 2013 20:20:55 +0000 (22:20 +0200)]
cortex_m: mem_ap access functions take number of bytes, not words

Accessing one byte of memory using a 16-bit access is not well defined.
The current implementation is forgiving and rounds up, but it should not
be relied upon.

Also, I suspect this code might fail if the byte order differs between
target and host, but I have no way of verifying it so I left it as it is.

Change-Id: I8d6a511151a194ed419f141703201f0632d84fc8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1657
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarm_adi_v5: Fix packed transfers crossing TAR auto-increment block 49/1649/2
Andreas Fritiofson [Sun, 22 Sep 2013 21:14:17 +0000 (23:14 +0200)]
arm_adi_v5: Fix packed transfers crossing TAR auto-increment block

The word count returned from max_tar_block_size() was compared with the
count of half-word/bytes in the u16 and u8 packed access functions,
causing an infinite loop if the access actually crossed the boundary.

Change max_tar_block_size() to return a byte count, and scale at the call
site.

Change-Id: I2fe9b5941eb485f3d8219cfdd29fb71e02006de4
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1649
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoarm_adi_v5: Fix packed and unaligned memory writes 46/1646/2
Andreas Fritiofson [Sun, 22 Sep 2013 16:50:25 +0000 (18:50 +0200)]
arm_adi_v5: Fix packed and unaligned memory writes

For packed and/or unaligned accesses, the write functions reordered the
source buffer in place. Causing in the best case a segfault, in the worst
case silent data corruption.

Rewrite the data fetching to directly match the byte lane mapping
according to IHI0031C, without destroying the buffer.

Also slightly clean up variable usage and harmonize all the write
functions.

Change-Id: I9a01cfc5578653f9ec02043ff6b61a7a20f90d67
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1646
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoAdd new target type: OpenRISC 47/1547/16
Franck Jullien [Thu, 8 Aug 2013 21:45:47 +0000 (23:45 +0200)]
Add new target type: OpenRISC

Add support for OpenRISC target. This implementation
supports the adv_debug_sys debug unit core. The mohor
dbg_if is not supported. Support for mohor TAP core
and Altera Virtual JTAG core are also provided.

Change-Id: I3b1cfab1bbb28e497c4fca6ed1bd3a4362609b72
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1547
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoRequire Autoconf >= 2.64 56/1656/2
Paul Fertser [Mon, 23 Sep 2013 08:57:47 +0000 (12:57 +0400)]
Require Autoconf >= 2.64

m4_argn macro was introduced in v2.63b-34-g46e87de on the 22nd of Apr 2009.

Change-Id: Id01cc9f0ffdb46cf6dfd26c3bf3b5efa0ddd2984
Reported-by: Franck Jullien <franck.jullien@gmail.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1656
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojlink: improve USB read during jlink_tap_execute 47/1447/4
Philip Craig [Mon, 17 Jun 2013 03:56:33 +0000 (13:56 +1000)]
jlink: improve USB read during jlink_tap_execute

Previously, when doing EMU_CMD_HW_JTAG3 commands we would do two reads,
one to read the data, and one to read the result. However, we can just
do a single larger read instead.

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

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

Change-Id: I75e020d3b3732c9a74ee3d31838fdf17a7fac24c
Signed-off-by: Philip Craig <phil@blackmoth.com.au>
Reviewed-on: http://openocd.zylin.com/1447
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)