]> git.sur5r.net Git - openocd/log
openocd
10 years agoAdd byte-swap helpers
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>
11 years agokinetis : Add flash sector size detection for K21 MCU.
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>
11 years agokinetis : Add flash read support to the kinetis nor flash driver.
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>
11 years agokinetis : Fix broken check for mass erase.
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>
11 years agohla: Make consistent parameter naming
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>
11 years agotarget: use target_buffer_set_u32_array
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>
11 years agoulink: Fix libusb include changed since pkg-config merge
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
11 years agojtag: fix support for really long scans
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>
11 years agostm32l flash: add another device ID
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>
11 years agoadd TI TMS570 support scripts
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>
11 years agofm3: fix Fujitsu MB9Ax family support
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>
11 years agoCorrect argument numbering in trace command
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>
11 years agolpcspifi: Fix byte order bug
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>
11 years agotarget: fix mem2array/array2mem
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
11 years agosmp: Fix byte order bug
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>
11 years agoti_icdi_usb: Remove unnecessary casts and fix byte order bugs
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>
11 years agoioutil: Remove unnecessary casts and fix const-discarding
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>
11 years agobinarybuffer: Remove unnecessary cast and fix hidden "bug"
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>
11 years agostr9x: Fix byte order bug
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>
11 years agostr7x: Fix byte order bug
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>
11 years agostm32f1x: Fix byte order bug and remove unnecessary cast
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>
11 years agopic32mx: Fix byte order bug
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>
11 years agolpc2900: Fix byte order bugs and remove unnecessary casts
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>
11 years agoaduc702x: Fix byte order bug
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>
11 years agoftdi: Remove unnecessary cast
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>
11 years agoRemove unnecessary casts
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>
11 years agonand/mx*: Remove unused host endianness flag
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>
11 years agoRemove unnecessary (void *)
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>
11 years agoClean up const usage to avoid excessive casting
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>
11 years agoftdi/tumpa.cfg: enable proper output buffer control, add another USB ID
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>
11 years agoClean up many C99 integer types format specifiers
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>
11 years agocheckpatch: correct false positives reporting instructions
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>
11 years agocheckpatch: treat jenkins as valid email
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>
11 years agocortex_m: set fpb_enabled on enabling fpb
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
11 years agohla/stlink: Re-order trace parameters to allow trace output file to be optional
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>
11 years agosam4s flash: fix PLLA frequency calculation if diva > 1
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>
11 years agotcl: add memory testing functions for board diagnostics
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>
11 years agoRemove jtag_rclk from target configs
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>
11 years agohla_interface: init trst, srst variables.
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>
11 years agolpc2000: Fix flash programming fail on LPC4300 internal flash
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>
11 years agoarmada370: initial support for Marvell Armada 370 family
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>
11 years agoFix ULINK driver dependencies in configure.ac
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>
11 years agoflash: mxc nfc(v1) : fix incorrect address in spare area for biswap command
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>
11 years agocfg: add STM32F429 discovery board config
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
11 years agolpc288x: Can now use target_write_buffer()
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>
11 years agonds32: Remove unused declaration
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>
11 years ago hla_target: Update target state when polling
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>
11 years agoarm7_9: Avoid infinite loops in bulk write dispatching
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>
11 years agoopenrisc/tap_vjtag: fix IR setting
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>
11 years agoopenrisc/du_adv: check or1k_adv_jtag_init return value
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>
11 years agocheckpatch: add logging functions
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>
11 years agojtag_vpi: use DIV_ROUND_UP
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>
11 years agojtag_vpi: fix path move function
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>
11 years agosam4s flash: remove unused bootstrap routine
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>
11 years agobcm2835gpio: use maximum drive strength
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>
11 years agocortex_m: target implementation renames cortex_m3 to cortex_m
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
11 years agostr7x: Improve info text
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>
11 years agostm32f2x: Fix sector numbering for dual bank flash erase
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>
11 years agostm32l: set default padded value
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
11 years agoflash: add padded_value cmd
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
11 years agoflash: fix mini51 cygwin build issues
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
11 years agofix lpc2000 flash programming fail.
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>
11 years agostm32f2x: Detect STM32F42x rev Y
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>
11 years agojtag/tcl: Avoid casting away const
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>
11 years agojtag/tcl: Remove no-op free
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>
11 years agojtag/tcl: Fix double free in jtag newtap argument parsing
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>
11 years agogdb_server: Further cleanup of target desc functions
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>
11 years agohla: if the idcode callback returns 0, treat as a wildcard
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>
11 years agoboard: add TM4C123G LaunchPad config
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>
11 years agoflash/nor: Make info function optional
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>
11 years agocortex_m: Call mem_ap_read/write directly
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>
11 years agoarm_adi_v5: Rewrite MEM-AP transfer implementation
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>
11 years agocortex_m: mem_ap access functions take number of bytes, not words
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>
11 years agoarm_adi_v5: Fix packed transfers crossing TAR auto-increment block
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>
11 years agoarm_adi_v5: Fix packed and unaligned memory writes
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>
11 years agoAdd new target type: OpenRISC
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>
11 years agoRequire Autoconf >= 2.64
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>
11 years agojlink: improve USB read during jlink_tap_execute
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>
11 years agotarget: Fix strange ordering in target_read_u8
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>
11 years agojlink: Replace crazy home cooked assertion with a real one
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>
11 years agodoc: correctly terminate @xref
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>
11 years agobus_blaster: do not fail on missing get_latency_timer
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>
11 years agobuild: fix NetBSD build warning
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>
11 years agohla: move memory read/write functionality to driver
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>
11 years agostlink: remove usb timeout magic numbers
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>
11 years agohla: cleanup read/write api
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>
11 years agoREADME.Windows: MinGW-w64 is known to work for building, regular MinGW is quirky
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>
11 years agoarmv7m: add gdb target description support
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>
11 years agogdb: cleanup gdb target description support
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>
11 years agogdb: enable target description support by default
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>
11 years agoarmv7m: remove gdb register hacks
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>
11 years agogdb: add default description reg types
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>
11 years agoRestore mwh/mwb functionality.
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>
11 years agoadiv5: check packed transfers are supported
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>
11 years agoREADME.Windows: pkgconfig-lite should go into MinGW, not MSYS
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>
11 years agoREADME: add missing adapters and flash drivers, mention profiling
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>
11 years agoconfigure: expand library search for libftd2xx
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>
11 years agocontrib: Add example cross-build script
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>
11 years agoconfigure: Add libusb-1.0 header bug workaround
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>
11 years agoconfigure: auto-enable USB adapters based on libusb availability
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>