openocd.git
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>
10 years agotarget: Fix strange ordering in target_read_u8 40/1640/2
Andreas Fritiofson [Fri, 20 Sep 2013 21:06:24 +0000 (23:06 +0200)]
target: Fix strange ordering in target_read_u8

It's been like this since the check was added, in 5aa93a5e.

Change-Id: Iaa0586e0cd1ce57ad92735dcc3e51108a133fe96
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1640
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agojlink: Replace crazy home cooked assertion with a real one 44/1644/2
Andreas Fritiofson [Sat, 21 Sep 2013 19:22:17 +0000 (21:22 +0200)]
jlink: Replace crazy home cooked assertion with a real one

Change-Id: I83d66ddef34965dd94a0ff76aa1367cc9d19f2df
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1644
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agodoc: correctly terminate @xref 37/1637/2
Spencer Oliver [Thu, 19 Sep 2013 14:14:47 +0000 (15:14 +0100)]
doc: correctly terminate @xref

@xref should be terminated by either a ',' or '.'.

Change-Id: I141335cd4e149992fc971c6f2c04f1dbe390c8f4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1637
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
10 years agobus_blaster: do not fail on missing get_latency_timer 27/1627/2
Søren Jørvang [Tue, 17 Sep 2013 13:21:38 +0000 (14:21 +0100)]
bus_blaster: do not fail on missing get_latency_timer

Patch submitted from Trac #64
Seems certain clones do not correctly emulate the ftdi chip, if
the call to read the latency timer fails then do not treat this as a
failure.

Change-Id: Iae671b926d101adf1010639d11ca46c58d0af524
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1627
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
10 years agobuild: fix NetBSD build warning 23/1623/2
Petri Laakso [Sat, 14 Sep 2013 20:55:57 +0000 (21:55 +0100)]
build: fix NetBSD build warning

Seems NetBSD does like the name reboot, so rename to keep happy.

Change-Id: I60ada9d217c4a8386a8d1ff1c88db7335451794e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1623
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
10 years agohla: move memory read/write functionality to driver 32/1632/4
Spencer Oliver [Wed, 18 Sep 2013 19:06:26 +0000 (20:06 +0100)]
hla: move memory read/write functionality to driver

Due to issues reported when using the jtag mode of the stlink (see Trac #61),
the functionality/checking has been moved to the driver.

This change also fixes unaligned 32bit memory read/write for the stlink.

From testing this change also brings a 3KiB/s speed increase, this is due
to the larger read/write packets.

Change-Id: I8234110e7e49a683f4dadd54c442ecdc3c47b320
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1632
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agostlink: remove usb timeout magic numbers 31/1631/2
Spencer Oliver [Wed, 18 Sep 2013 15:52:48 +0000 (16:52 +0100)]
stlink: remove usb timeout magic numbers

Change-Id: I4ec4cb0bc344c4c1de9113fa12ed84e5e2e87b31
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1631
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agohla: cleanup read/write api 21/1621/3
Spencer Oliver [Wed, 11 Sep 2013 20:31:50 +0000 (21:31 +0100)]
hla: cleanup read/write api

This is the first part in moving the adapter specific api back into the
driver.

The next task is to also move the hla read/write buffer size handling.

Change-Id: I86a19144b50b6de18659bfcd05b3729b2cafc051
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1621
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoREADME.Windows: MinGW-w64 is known to work for building, regular MinGW is quirky 38/1638/3
Paul Fertser [Thu, 19 Sep 2013 15:21:35 +0000 (19:21 +0400)]
README.Windows: MinGW-w64 is known to work for building, regular MinGW is quirky

The regular MinGW doesn't work properly because it doesn't try to
provide C99 compatibility currently.

Change-Id: I27c1b9e1496a8c32032fab08a29cbe1124316edd
Reported-by: Tomáš Voda <Voda.Tomas@seznam.cz>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1638
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoarmv7m: add gdb target description support 20/1620/6
Spencer Oliver [Fri, 13 Sep 2013 08:44:36 +0000 (09:44 +0100)]
armv7m: add gdb target description support

Change-Id: I7c01109c0b85d208fb04a7ae1185fab4b2ab96b8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1620
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agogdb: cleanup gdb target description support 19/1619/6
Spencer Oliver [Thu, 12 Sep 2013 13:49:19 +0000 (14:49 +0100)]
gdb: cleanup gdb target description support

Make sure we free any memory used for gdb_save_tdesc.

Change-Id: Ia226f6134318c8c6b0ac4fa20fe70a570a08d80d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1619
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agogdb: enable target description support by default 18/1618/6
Spencer Oliver [Fri, 13 Sep 2013 08:34:01 +0000 (09:34 +0100)]
gdb: enable target description support by default

This enables gdb target description support by default, it will check that
this is supported by the active target.

Change-Id: Iea5a5b94c5e373af30dacb780020b79536caa1e3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1618
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoarmv7m: remove gdb register hacks 17/1617/3
Spencer Oliver [Wed, 11 Sep 2013 11:33:32 +0000 (12:33 +0100)]
armv7m: remove gdb register hacks

Now that we support the target description format we do not need
these hacks anymore, we can now tell gdb what registers we support.

Change-Id: Ie774231d296420b35efcf708bc4435475c87ff5e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1617
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agogdb: add default description reg types 22/1622/2
Spencer Oliver [Thu, 12 Sep 2013 11:31:49 +0000 (12:31 +0100)]
gdb: add default description reg types

Add support for the default gdb register description type "int" and "float".
When this is given to gdb it will use the bitsize to determine the reg size.

Change-Id: Iaeed594d1feece54044128eae1baff9858bdcae0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1622
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoRestore mwh/mwb functionality. 28/1628/2
Andreas Fritiofson [Tue, 17 Sep 2013 20:09:22 +0000 (22:09 +0200)]
Restore mwh/mwb functionality.

Half-word and byte writes using mwh/mwb has been completely broken since
bf71e34cbf, because it dispatched all writes, regardless of access size,
to target_write_buffer(), which uses as large accesses as possible.

Partially revert the commit by changing back to the correct write method.

Change-Id: I60731fc576bf4a076a7da02bee7879e121c21d17
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1628
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoadiv5: check packed transfers are supported 02/1602/4
Spencer Oliver [Wed, 18 Sep 2013 21:41:54 +0000 (22:41 +0100)]
adiv5: check packed transfers are supported

Currently we try and use MEM-AP packed transfers as much as possible for
8/16bit transfers. However not all targets support packed transfers, so
check before using.

Change-Id: I66256007f25ccd0c583f23db5acf6d1aa8b5e57d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1602
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoREADME.Windows: pkgconfig-lite should go into MinGW, not MSYS 30/1630/2
Paul Fertser [Wed, 18 Sep 2013 09:48:21 +0000 (13:48 +0400)]
README.Windows: pkgconfig-lite should go into MinGW, not MSYS

As autoconf is part of MinGW, it uses its root to find m4 files, pkg-config
should be installed accordingly.

Change-Id: I551797e61a3d044f751768bd7d57d8e26e7202cc
Reported-by: Tomáš Voda <Voda.Tomas@seznam.cz>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1630
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoREADME: add missing adapters and flash drivers, mention profiling 24/1624/2
Paul Fertser [Sun, 15 Sep 2013 14:33:07 +0000 (18:33 +0400)]
README: add missing adapters and flash drivers, mention profiling

This updates README with all the "keywords" added since the initial
upstream submission (and finally fixes the typo in the beginning).

Change-Id: Ia071267246fe6afc19fc0bfcda83c4778e7ff5b1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1624
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agoconfigure: expand library search for libftd2xx 14/1614/2
Stephan Linz [Fri, 6 Sep 2013 13:03:54 +0000 (15:03 +0200)]
configure: expand library search for libftd2xx

Error was:
checking for library containing FT_GetLibraryVersion... no
configure: error: You appear to be missing the FTD2xx driver library.

Reason were two cases:

Case one:
The FTD2xx library uses clock_gettime() and in normal cases
the linker will find the function in the libc library. Most
(older) systems require the program be linked with the librt
library to use these (see man clock_gettime: Link with -lrt).

Case two:
You can rebuild the FTD2xx library (relink from the object
files) against the primary (system wide installed) libusb-1.0.
So you avoid mixed code (GPL with proprietary code) in the
FTD2xx library. In this case, the FTD2xx library provides no
private (linked in) libusb-1.0 functionality and require the
program be linked with the libftd2xx __AND__ the libusb-1.0
to resolve all the libusb-1.0 symbols.

Change-Id: Iaf9a35ab4257e37b98dccd47667378ad2a64b7ed
Signed-off-by: Stephan Linz <linz@li-pro.net>
Reviewed-on: http://openocd.zylin.com/1614
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
10 years agocontrib: Add example cross-build script 31/1531/10
Andreas Fritiofson [Fri, 13 Sep 2013 21:38:30 +0000 (23:38 +0200)]
contrib: Add example cross-build script

Usage:
export LIBUSB1_SRC=/path/to/libusb-1.0
export OPENOCD_CONFIG="--enable-..."
cd /work/dir
/path/to/openocd/contrib/cross-build.sh <host-triplet>

For static linking, a workaround is to
export LIBUSB1_CONFIG="--enable-static --disable-shared"

All the paths must not contain any spaces.

Feel free to comment or update this patchset with improvements.

Change-Id: Ib3b4970117f13a6140a1eddc493d324a52364519
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1531
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoconfigure: Add libusb-1.0 header bug workaround 34/1534/4
Andreas Fritiofson [Thu, 1 Aug 2013 17:07:09 +0000 (19:07 +0200)]
configure: Add libusb-1.0 header bug workaround

Force the libusb-1.0 include dir to be treated as a system include path
which suppresses the cast-align warnings otherwise failing the build on
some platforms.

Change-Id: I738cfd793052b8772731d2feeef968ee893bd4bd
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1534
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoconfigure: auto-enable USB adapters based on libusb availability 75/1475/7
Paul Fertser [Wed, 11 Sep 2013 21:25:19 +0000 (23:25 +0200)]
configure: auto-enable USB adapters based on libusb availability

This unifies the way the USB adapters are handled, and enables them
automatically whenever possible (until explicitly disabled). If an
adapter is explicitly enabled but can't be built, abort the
configure.

Also add infrastructure for generic handling of adapter drivers in
configure and print a summary of the configuration results after
finishing.

The m4 quoting is as conservative as I could get it, and seems
appropriate.

Change-Id: I1655691e5ea0d8eb9e3f67830b96992ffe33640a
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1475
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agolibusb: require pkg-config support 67/1467/8
Paul Fertser [Wed, 11 Sep 2013 21:07:59 +0000 (23:07 +0200)]
libusb: require pkg-config support

An alternative approach to show how much cleaner the pure pkg-config
way is.

This changes the discovery procedures for libusb-1.0 and libusb-0.1,
making them depend on pkg-config being properly installed and
configured, including the necessary build host configuration for the
cross-builds (see
http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/cross-compiling.html)

It should make it possible to compile OpenOCD without changes and
extra effort on GNU/Linux, FreeBSD users would need to supply a .pc
file for their libusb implementation or add LIBUSB1_LIBS and
LIBUSB1_CFLAGS to the configure environment.

Change-Id: I826e378dd1e0d101a549a573b2c63212a7e00b64
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1467
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoREADME* refactoring 03/1503/8
Paul Fertser [Wed, 11 Sep 2013 21:05:16 +0000 (23:05 +0200)]
README* refactoring

This is an attempt to bring the README files in line with the current
status of the OpenOCD development.

- remove some obsolete information and duplicated instructions
- reword some statements
- restructure in a way more appealing to a regular user
- add a supported hardware list to allow a potential user to determine
  if his/her usecase is covered by a freetext keyword search through
  the document
- Add OSX notes (courtesy GrizzlyAdams and inca)

Since most ftdi-based adapters are now covered by the ftdi driver, I
think it's ok to remove some of the libftdi/ftd2xx instructions, the
few users who still need them should refer to upstream docs instead.

I'm not sure if README.Windows should come with the DOS line endings,
but i'd expect many windows users to use their silly notepad to view
it, and notepad ignores LF apparently. (Decided to use LF anyway.)

I understand discussing and reviewing such a massive README change is
a somewhat demanding task but I feel it's a necessity to move forward
maintaining proper documentation.

Change-Id: Idfde3014c72dd5c32ad292ee1ab205322e51a138
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1503
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
10 years agoflash: add Nuvoton NUC910 series support 10/1510/4
Nemui Trinomius [Tue, 16 Jul 2013 15:08:31 +0000 (16:08 +0100)]
flash: add Nuvoton NUC910 series support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: Ic3273e64fd99bffab16764b06227e09a05d07c8f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1510
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
10 years agonds32: remove .soft_reset_halt dependency 12/1612/4
Hsiangkai Wang [Wed, 4 Sep 2013 05:21:59 +0000 (13:21 +0800)]
nds32: remove .soft_reset_halt dependency

.soft_reset_halt is not necessary for nds32 target.
Remove the dependency.

Change-Id: Ic3b126d6c7eb995583a661b762627e736222fcaa
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1612
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoaice: add target name to nds command messages 83/1583/9
Hsiangkai Wang [Thu, 11 Jul 2013 02:30:41 +0000 (10:30 +0800)]
aice: add target name to nds command messages

Change-Id: Ie6c786c6880fb554af54ed27f1c159326f60a701
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1583
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: support multi-target debugging 81/1581/9
Hsiangkai Wang [Tue, 2 Jul 2013 09:29:46 +0000 (17:29 +0800)]
nds32: support multi-target debugging

Change-Id: If767f646b234dbcdb01946e5d13a3a6a29df2d78
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1581
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: Use DMA to access memory as no DCache 80/1580/7
Hsiangkai Wang [Thu, 11 Jul 2013 02:08:15 +0000 (10:08 +0800)]
nds32: Use DMA to access memory as no DCache

As GDB uses file-I/O protocol to access memory, use DMA to access
if no DCache.  This commit improves the performance of Andes
Virtual Hosting.

Change-Id: I36bb2154b9f497fc4237625836cf8c7115330a60
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1580
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: modify nds commands implementation 79/1579/7
Hsiangkai Wang [Fri, 31 May 2013 03:45:17 +0000 (11:45 +0800)]
nds32: modify nds commands implementation

Modify handle_nds32_memory_access_command: do not use DCache
setting to block user's setting.

Change-Id: I2d33f893773e2a2e3e2f26edde5938ef5902609d
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1579
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: support FreeRTOS 77/1577/7
Hsiangkai Wang [Mon, 10 Jun 2013 03:37:24 +0000 (11:37 +0800)]
nds32: support FreeRTOS

Change-Id: I117b5541fb19388c0f5c2344ee42d9151c9a222e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1577
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: report any one of hit read watchpoints 76/1576/7
Hsiangkai Wang [Tue, 18 Jun 2013 08:37:21 +0000 (16:37 +0800)]
nds32: report any one of hit read watchpoints

If multiple read watchpoints are hit at the same time, report
any one of these hit watchpoints.

Change-Id: I8d4439aa80e4b62bb7d48bbdc0450920e2008a2e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1576
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: change default value 75/1575/7
Hsiangkai Wang [Mon, 10 Jun 2013 03:38:21 +0000 (11:38 +0800)]
nds32: change default value

Change-Id: I0505bdc0e75543a3b205981339c5b9fa78a080ca
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1575
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: always polling after gdb attached 74/1574/7
Hsiangkai Wang [Mon, 27 May 2013 05:18:08 +0000 (13:18 +0800)]
nds32: always polling after gdb attached

Do not turn on/off polling as leave/enter debug mode.
Enable polling after gdb attached, and disable polling
after gdb detached.

Change-Id: Id64459b86f44937af7ea5ccfe2cd13e31732eecf
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1574
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: support Andes profiling function 85/1585/5
Hsiangkai Wang [Tue, 27 Aug 2013 08:10:16 +0000 (16:10 +0800)]
nds32: support Andes profiling function

Change-Id: Ibc45ec5777d6841956c02de6b4ae8e74c2a6de37
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1585
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: enhance target profiling 72/1572/7
Hsiangkai Wang [Wed, 14 Aug 2013 06:46:58 +0000 (14:46 +0800)]
target: enhance target profiling

1. gprof uses 2-bytes as minimum bucket size.
2. As user wants to use gprof --sum to summarize multiple
   profiling data files, the range MUST be the same.
   Add new arguments to specify profiling range.

Change-Id: Ie7e6afa6a4d82250e2d194a0eed2b428c1479ea1
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1572
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: add profiling interface 71/1571/7
Hsiangkai Wang [Wed, 26 Jun 2013 09:09:40 +0000 (17:09 +0800)]
target: add profiling interface

Profiling could be target-specific.  Add .profiling interface
to target_type.

Change-Id: Ic0eea9db742971db1350a474fbbb5ed24565922b
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1571
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: increase the maximum number of buckets 08/1608/3
Hsiangkai Wang [Fri, 30 Aug 2013 05:45:42 +0000 (13:45 +0800)]
target: increase the maximum number of buckets

I do not know what is the reasonable number of buckets.
If there are enough buckets, the result will be accurate.

I propose increase the maximum number of buckets to 128K.
If the size of program text section is less than 256KB, every
two bytes will be occupied by one buckets.
(The minimum size of one buckets is 2 bytes in gprof implementation.)

Change-Id: If9147743cefdc36f40f21e6dc73b9b28f28c9e1e
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1608
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: Correct profiling calculation 07/1607/3
Hsiangkai Wang [Fri, 30 Aug 2013 05:35:08 +0000 (13:35 +0800)]
target: Correct profiling calculation

1. high_pc should be (maximum sample + 1) (Refer to gprof source code)
2. bucket index should be

     sample offset
    --------------- x (number of bucket)
 sample range

For example, if minimum sample is 0 and maximum sample is 5
and the number of bucket is 3.

a = sampled_address - 0
b = 3
c = 6
(a, b, c refer to source code variables)

sampled_address = 0, => a = 0, => bucket_index = 0
sampled_address = 1, => a = 1, => bucket_index = 0
sampled_address = 2, => a = 2, => bucket_index = 1
sampled_address = 3, => a = 3, => bucket_index = 1
sampled_address = 4, => a = 4, => bucket_index = 2
sampled_address = 5, => a = 5, => bucket_index = 2

Change-Id: Ia9fa0e4d9c7183e3e9d7ceaf73e63729f07aa2ce
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1607
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agotarget: Make profiling function more readable 06/1606/3
Hsiangkai Wang [Fri, 30 Aug 2013 05:18:54 +0000 (13:18 +0800)]
target: Make profiling function more readable

Change variable name 'length' to 'numBuckets'.  It is more readable.

Change-Id: I913cba0746f887adf6da401a46cd5e9ea88d2c6d
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1606
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agonds32: refine nds32_v2 implement 69/1569/6
Hsiangkai Wang [Wed, 17 Jul 2013 02:57:07 +0000 (10:57 +0800)]
nds32: refine nds32_v2 implement

Change-Id: I6e26ffbdcd426a15b34bff022964946f613f318c
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1569
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoaice: support batch commands 84/1584/4
Hsiangkai Wang [Tue, 27 Aug 2013 08:02:56 +0000 (16:02 +0800)]
aice: support batch commands

Change-Id: I6846362d98374c93f45f339fb1279fc71721e696
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1584
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoaice: Always setup SDP basic mode 67/1567/4
Hsiangkai Wang [Thu, 13 Jun 2013 03:45:10 +0000 (11:45 +0800)]
aice: Always setup SDP basic mode

Change-Id: I1c0c11c2b9097b25324da0591edf036af207dbe9
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1567
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agoaice: use keep_alive() to avoid timeout warning messages 66/1566/3
Hsiangkai Wang [Fri, 31 May 2013 03:47:22 +0000 (11:47 +0800)]
aice: use keep_alive() to avoid timeout warning messages

As polling $dbger, call keep_alive() to avoid timeout messages.

Change-Id: Ia03d90535c2bd6049763209194c21f70fd8b7e8b
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1566
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agogdb_server: Do not set gdb_con->sync to true for new connections 87/1587/3
Anton Kolesov [Tue, 27 Aug 2013 09:38:50 +0000 (13:38 +0400)]
gdb_server: Do not set gdb_con->sync to true for new connections

In GDB connected to OpenOCD there is a command "monitor gdb_sync" which makes
next stepi command to be ignored while GDB still will get an updated target
state. This command sets gdb_connection->sync field to true to notify that stepi
should be ignored. This field is set to true for all new connection and is set
to false after first "continue" command. However if first resume command is
stepi/nexti then it will be ignored and result will confuse GDB client, it will
report that target received signal SIGINT. This patch sets this field to false
for new connections, thus stepi/nexti will work properly when it is a first
resume command.

Change-Id: I7c9ebd69c3dc35f3e316041aa99f4e9d3425c0b6
Signed-off-by: Anton Kolesov <akolesov@synopsys.com>
Reviewed-on: http://openocd.zylin.com/1587
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agosvf: off-by-one error; do not access after the allocated memory 15/1615/2
Paul Fertser [Tue, 10 Sep 2013 11:14:56 +0000 (15:14 +0400)]
svf: off-by-one error; do not access after the allocated memory

Keep the promise and ensure there're at least 3 bytes available after
the current position.

This eliminates the errors reported by Valgrind.

Change-Id: I1d0640e904c750eed808b2b4caf419b4d7619845
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1615
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
10 years agotarget: Rewrite read/write buffer default implementations 21/1221/4
Andreas Fritiofson [Wed, 13 Mar 2013 22:41:04 +0000 (23:41 +0100)]
target: Rewrite read/write buffer default implementations

Rewrite the target_*_buffer_default to generate as large accesses as
possible while maintaining natural alignment.

These versions are easy to extend to generate 8-byte accesses to support
64-bit targets, although it requires some conformity from all target
implementations (i.e. they need to refuse unsupported access sizes with
some defined error code, so we can try again with a smaller one).

Change-Id: I00ddcbb1d2fd33f9f8b99cb448cc93505a2421fc
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1221
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years ago[RFC] target: Move bulk_write_memory to arm7_9 20/1220/3
Andreas Fritiofson [Mon, 11 Mar 2013 21:21:13 +0000 (22:21 +0100)]
[RFC] target: Move bulk_write_memory to arm7_9

The only remaining user is arm7_9 so remove it from the target API and add
it to struct arm7_9_common to support all its variants with minimal
changes. Many of the variants are likely not correct in the cache/mmu
handling when the bulk write is triggered. This patch does nothing to
change that, except for arm946e, where it was easier to do what might be
the right thing.

Change-Id: Ie73ac07507ff0936fefdb90760046cc8810ed182
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/1220
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agosysfsgpio: fix a typo in the informational output 16/1616/2
Paul Fertser [Tue, 10 Sep 2013 11:27:11 +0000 (15:27 +0400)]
sysfsgpio: fix a typo in the informational output

Change-Id: I0c9bc281e4e913f9eacba3b8b60585217a1caf2e
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/1616
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
10 years agofm3: add Fujitsu MB9Ax family support 06/1506/2
Nemui Trinomius [Tue, 16 Jul 2013 13:44:20 +0000 (14:44 +0100)]
fm3: add Fujitsu MB9Ax family support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I52048f6e8e66b38087fa249eb66ceab6801d07d5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1506
Tested-by: jenkins
10 years agobuild: remove clang warning about global var 'match' 13/1613/2
Spencer Oliver [Thu, 5 Sep 2013 15:36:00 +0000 (16:36 +0100)]
build: remove clang warning about global var 'match'

remove clang warning - "Argument to free() is the address of a global
variable, which is not memory allocated by malloc()".

Change-Id: I015273eafc9644207684b363434c6ae8149bfcde
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1613
Tested-by: jenkins
10 years agoatmega: add new target support 07/1507/2
Nemui Trinomius [Tue, 16 Jul 2013 13:58:45 +0000 (14:58 +0100)]
atmega: add new target support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I6d6af10fb07ea43cc1196a90d8738957f8266938
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1507
Tested-by: jenkins
10 years agoflash: add NXP LPC800 support 09/1509/2
Nemui Trinomius [Tue, 16 Jul 2013 14:54:17 +0000 (15:54 +0100)]
flash: add NXP LPC800 support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391

Change-Id: I142fa6f29e66fd334baca14217aca97e1fc6c7d9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1509
Tested-by: jenkins
10 years agoarmv7m: use consistent arm.cpsr member 39/1539/2
Spencer Oliver [Mon, 5 Aug 2013 16:46:09 +0000 (17:46 +0100)]
armv7m: use consistent arm.cpsr member

We already set cpsr in armv7m_build_reg_cache, so lets use it for all other
accesses to this field.

Change-Id: I19b3b21ecf1571bbea12e1be664845e6544f6fa1
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1539
Tested-by: jenkins
10 years agotarget: remove unimplemented target_request_data implementations 37/1537/2
Spencer Oliver [Fri, 2 Aug 2013 12:01:03 +0000 (13:01 +0100)]
target: remove unimplemented target_request_data implementations

Change-Id: Ia9afa83752d17f0f56bdf3bd81f5c69d108aa5e9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1537
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotarget: check target supports target_request_data 36/1536/2
Spencer Oliver [Fri, 2 Aug 2013 11:57:30 +0000 (12:57 +0100)]
target: check target supports target_request_data

Make sure the target support target requests before we enable any receivers.

Change-Id: I8ce42922eaff76fb5e7a114da716f2a6585a6ab5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1536
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
10 years agotarget: remove unimplemented soft_reset_halt implementations 35/1535/2
Spencer Oliver [Fri, 2 Aug 2013 11:14:37 +0000 (12:14 +0100)]
target: remove unimplemented soft_reset_halt implementations

Let the default handler issue an unsupported warning rather than using
empty handler routines that may/may not issue a unsupported warning.

Change-Id: Iafe3e45146981a4cfae39771c3ab7370ac86da48
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1535
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Hsiangkai Wang <hsiangkai@gmail.com>
10 years agortos: Do not dereference null pointers 55/1555/3
Spencer Oliver [Mon, 19 Aug 2013 13:42:53 +0000 (14:42 +0100)]
rtos: Do not dereference null pointers

detected by clang.

Change-Id: Id395f9d33bc2903b29a158fc3540ae51857e6aa0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1555
Tested-by: jenkins
10 years agomini51: support for Nuvoton NuMicro Mini51 series flash memory 46/1546/4
Cosmin Gorgovan [Fri, 9 Aug 2013 16:52:46 +0000 (17:52 +0100)]
mini51: support for Nuvoton NuMicro Mini51 series flash memory

Adds a flash driver for Nuvoton MINI51, MINI52 and MINI54 microcontrollers.

At the moment, it only supports the erase and write operations.

These microcontrollers have a 4 / 8 / 16 KB APROM for application code and a
2 KB LDROM for bootloaders. When the MCU has booted off the APROM, the LDROM
isn't mapped in memory but can be programmed, and the other way around.
This means that the ARM core is typically rebooted for programming. After a
successful write or erase operation, it is rebooted again, using the initial
boot source.

This driver only supports programming the APROM.

This driver is a pure JTAG implementation, it doesn't use any SRAM.

I've tested it on a MINI54ZAN microcontroller using an ST-LINK/V2. With the
microcontroller running at the default clock frequency of 22.1184 MHz, speed
seems to be around 1.1 KB/s.

Change-Id: I180889c55af9fb5614cd99a953b755baba14288a
Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org>
Reviewed-on: http://openocd.zylin.com/1546
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
10 years agokinetis: add kl flash support 08/1508/3
Spencer Oliver [Thu, 5 Sep 2013 14:49:56 +0000 (15:49 +0100)]
kinetis: add kl flash support

Not tested, adapted from http://tech.groups.yahoo.com/group/versaloon/message/391
depends on http://openocd.zylin.com/1602

Change-Id: Ib846be48500a28d515c6dbd3ca2a5c1719cd74d4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/1508
Tested-by: jenkins
Reviewed-by: Chris Fryer <chrisf1874@gmail.com>
Reviewed-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp>
10 years agojtag: drivers: Add JTAP VPI client driver 09/1609/4
Franck Jullien [Fri, 6 Sep 2013 16:42:39 +0000 (18:42 +0200)]
jtag: drivers: Add JTAP VPI client driver

This patch adds a driver for the jtag_vpi server [1]. This server is
now part of the ORPSoC version 3 (OpenRISC Reference Platform SoC).
The jtag_vpi server provides an interface between OpenOCD and a simulated
core.

[1] http://github.com/fjullien/jtag_vpi

Change-Id: I717b72cace4845f66c878581345074f99002e21a
Signed-off-by: Franck Jullien <franck.jullien@gmail.com>
Reviewed-on: http://openocd.zylin.com/1609
Tested-by: jenkins
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)