cortexm: use Cortex-M rather than cortex-m3 for dwt registers

Change-Id: I28e3a8c65ccc4a4e3ec94e41c846e6a263c165e8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1865
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
target: fix typos

Change-Id: Icdb517224e8bcf41a16498088e09955048077d35
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1864
Tested-by: jenkins
Reviewed-by: Bill Traynor <btraynor@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
cfg: add Freescale FRDM-KL46Z Board

Change-Id: Ib585728f13a380eeeb2ada095f3e1a1c2aaf44cb
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1866
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
jtag/drivers: add USB-Blaster II

This patchs adds a new access driver for the existing
USB-Blaster interface driver.

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

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

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

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

Change-Id: I562a720a68cb4dcabeab791947d5d38776cb70fa
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1791
Tested-by: jenkins
Reviewed-by: Robert Jarzmik <robert.jarzmik@free.fr>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Retire jtag_add_dr_out

The out only version of jtag_add_dr_scan smells like a bogus optimization
that complicates the minidriver API for questionable gain.

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

Change-Id: I13b643687ee8ed6bc9b6336e7096c34f40ea96af
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1801
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
gdb_server: check for invalid read memory requests

This prevents invalid free(NULL) (that crashes OpenOCD on desktop
distros).

With radare2 it's now a bit more useful, memory access works if I seek
to the correct address, can't test further as it apparently lacks thumb2
support.

Change-Id: I6ec32d09fd52dab53ba765d7f7519baa1f55d973
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1853
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Add CMSIS-DAP information to the READMEs.

Change-Id: I8c87d559adf07b0f0702fe9d388f26bf046bcb8b
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1880
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
doc: Add Gerrit to the Developer resources section

Change-Id: Icbf2050967cea06b05a09574a6a91ce1407a489f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1885
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
flash: samd: declare const data

Make the chip information lookup tables const (thanks to Spencer Oliver for
pointing this out).  Also fix spacing on one macro.  No functional changes.

Change-Id: I053c4951c2626b8aa4541a79673b500394ef08e8
Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-on: http://openocd.zylin.com/1874
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
CMSIS-DAP: auto-detect CMSIS-DAP USB VID:PID

The current OpenOCD implementation requires CMSIS-DAP adapter USB
VID:PID values to either be hard-coded in the source or manually
supplied by the user's configuration files.  The CMSIS-DAP
specification stipulates that all compliant adapters should have
"CMSIS-DAP" in the product string.  This should obviate the need
for hard-coding.

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

Change-Id: Ifb2dc217248359f448e0a42bd1527dd744c434b0
Signed-off-by: Peter Lawrence <majbthrd@gmail.com>
Reviewed-on: http://openocd.zylin.com/1888
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Add GDB remote target description support for ARM4

This commit adds support for passing the ARM4 target description to GDB
when enabling gdb_target_description, in order to expose all banked
registers.

Change-Id: Id618bc6226f00fe83397ea28888a84b64b09cafd
Signed-off-by: Luca BRUNO <lucab@debian.org>
Reviewed-on: http://openocd.zylin.com/1810
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
arm920t: fix write memory operations with caches enabled

Commit ff5ec942d80a34e20b5a3ca3328f7e6a55fb309b made this target
always use generic arm7_9 memory write routines for software
breakpoints which resulted in inability to debug and single-step
sources in Gdb when icache is active as generic routine doesn't
invalidate it. This should fix it (and is real-life tested against
Samsung S3C2442). I expect other arm7-9 targets to be affected as
well.

Change-Id: Id7980e370ae4db47ac6b1490321d81ffe85711c0
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1817
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
top .gitignore: ignore .dirstamp files

Just after succesfull build you can see some untracked files
in the 'git status' output:

	src/jtag/drivers/versaloon/.dirstamp
	src/jtag/drivers/versaloon/usbtoxxx/.dirstamp

This commit fixes the problem.

Change-Id: I1674eb4423e97c5f0a47f216981eaffdc351f784
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Reviewed-on: http://openocd.zylin.com/1898
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
cfg: LPC17xx default to using SYSRESETREQ to reset target

Originally the LPC17xx user guide (UM10360 Rev 2) stated that SYSRESETREQ
was not supported, so this was the default cortex_m reset mode.

Rev 3 of the same user guide states that it is now supported.
This has been verified on a LPC1768 mbed platform, previously I have not
tested this functionality.

Change-Id: I4858248903981a1c93ce75016e67c9e02702fcc5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1892
Tested-by: jenkins
Reviewed-by: Jörg Fischer <turboj@gmx.de>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
doc: update CMSIS-DAP info to match default driver behaviour

By default the driver will now auto detect attached adapters, it does not
use an internal list any more. Update docs to match this.

Change-Id: I62a9d243cd236a8cf54cbd9d088c4837a8df31bf
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1902
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
kinetis : improve kinetis flash driver.

Kinetis K-series have different guranuarity for each frequency model.
This patch adding more minute guranuarity detection.
And adopted mass erase command not only L-series but also K-series.
Tested on MK20DX32VLF5,MK10DX32VLF5,and MKL25Z128VLK4.

Change-Id: Iffef850d4b388463756a13faf02c3890bfc19acf
Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
Reviewed-on: http://openocd.zylin.com/1894
Tested-by: jenkins
Reviewed-by: Per Ekman <pekenator@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Mateusz Kaduk <mateusz.kaduk@gmail.com>
interface/ftdi: add TUMPA Lite config

TUMPA Lite is a cheap FT232H-based breakout board, without any
buffering. It also lacks series resistors so for some targets
(especially when not using ridiculously short wires) one needs to add
about 47 Ohms in series on every high-speed line.

The SRST line is connected directly to the FT232H too.

Real-life tested (including SRST and TRST).

Change-Id: I5ed4f88d8d20384e9c52efe2ff0c290e2650d43e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1918
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
doc: add missing reg command argument 'force'

The argument 'force' enables a user to bypass the internal cache and read
a target register directly. However it is missing from the user guide.

Change-Id: I26f689eec20b38a0dc5294626b25df566b554446
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1897
Tested-by: jenkins
rtos: fix uninitialised variable warning

Breaks build with clang 3.3. This "addr" variable is actually always
ignored by next_symbol() when cur_symbol is an empty string but clang
can't (and probably shouldn't) prove that automatically.

Change-Id: Id030f1aa34b9d40b5fa20a422031511520e52669
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1876
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
server/gdb_server: fix uninitialised variable warning

Caught (breaks build) with clang 3.3.

Change-Id: I5978fe34e82122f62e3d587bcdc45ad12f5e55ca
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1877
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>