Commit Graph

4811 Commits

Author SHA1 Message Date
Spencer Oliver 6d8a865eef flash: update stm32 flash driver versions
Seems ST have changed the ref manual (RM0313 rev1) and reverted to using
letters rather than numbers for the stm32f3x family.

Change-Id: I3a87ec9b0b2447d57dfef98603d30e28fe9ac927
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/926
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:41:41 +00:00
Spencer Oliver d2e8ce1478 gdb: fix broken qCRC packet handling
The rtos layer was incorrectly handling a qCRC packet as a qC packet.
Make sure we check for the qCRC packet and return unhandled so the gdb
server gets a chance to handle it.

This packet is used in the gdb compare-sections cmd.

Change-Id: I21f8e5fa7225fccd13d65cf9e40186895065a7e3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/933
Tested-by: jenkins
Reviewed-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:41:14 +00:00
Spencer Oliver 538a86c339 gdb: use strncmp rather than strstr
All the packets received will be at start of the packet buffer, so use
more efficient strncmp.

Change-Id: Ib9c45d8f53425367006b1f880c1bde27f03a6cf9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/932
Tested-by: jenkins
Reviewed-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:40:21 +00:00
Edgar Grimberg 6f65045b37 ioutil: make the file compile on MacOS
The meminfo command cannot exist if the malloc.h header is not
present.
Cannot get the mac address without sys/ioctl.h and SIOCGIFHWADDR
defined

Change-Id: Ifc0fb98c3a60c53ad2e19473e08b34c460529d0b
Signed-off-by: Edgar Grimberg <edgar.grimberg@gmail.com>
Reviewed-on: http://openocd.zylin.com/912
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:38:58 +00:00
Andreas Fritiofson 077d77140c adi_v5_jtag.c: Avoid infinite recursion in jtagdp_transaction_endcheck()
Change-Id: I81163d9c2ff97ed768f8a3ac1505a8d2b5016b91
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/908
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-10-28 01:33:57 +00:00
Matthias Blaicher 442a684303 rtos: fix gdb qC command answer
rtos->current_thread is of type int64_t. All other commands already
respect this.

Change-Id: I9951946ff2a09c53cd78c6ab882c80cdd2ab7ac6
Signed-off-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-on: http://openocd.zylin.com/917
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:32:35 +00:00
Matthias Blaicher 3a6ac23716 rtos: Use ARRAY_SIZE instead of coding it by hand
Use ARRAY_SIZE in helper/types.h to determine the size of the
symbol list.

Change-Id: Icc9838323510f8602efa5d0162a4daed33f863b9
Signed-off-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-on: http://openocd.zylin.com/935
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-28 01:25:39 +00:00
Matthias Blaicher a4dc39beb4 rtos: Fix wrong allocation in linux_get_symbol_list_to_lookup
linux_get_symbol_list_to_lookup allocates to few memory. On 64 bit
systems the error did not show due to char* being twice its size,
leaving accidentally enough space.

This patch makes linux_get_symbol_list_to_lookup behave identical
to all other RTOS.

Change-Id: I290ea241fb20b65585c8be14609a92fdbd2a307d
Signed-off-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-on: http://openocd.zylin.com/934
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-27 17:25:04 +00:00
Spencer Oliver 4a5dc0988a Revert "gdb_server : 'R' command replied by OK"
This reverts commit 1e7e594452.

For some reason the above commit added a reply to the restart command - this is
not required as per the gdb docs.

Newer versions of gdb (7.0 and above) will complain about this reply.

Change-Id: Ieeae3dcf44d798a91dfc6f7348da982c2ce1be31
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/910
Tested-by: jenkins
Reviewed-by: Joel Bodenmann <joel@unormal.org>
2012-10-24 12:01:22 +00:00
Spencer Oliver 7165e05cf6 stlink: fix vector catch not being cleared
Seems after a reset the stlink is not clearing the vector catch (VC_CORERESET)
in the Debug Control Register.

This has the side effect if the user presses an external reset the core will
halt, this patch fixes that.

Change-Id: Ic3b2c3991b79cacbbd901c02b79613c2e204e71f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/905
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-18 14:39:04 +00:00
Spencer Oliver 98a41bca6e gdb: fix extended-remote restart
Seems versions of gdb > 6.8 require an W stop reply after receiving a
kill packet.

Without this we receive the following error from gdb:
gdb/thread.c:72: internal-error: inferior_thread: Assertion `tp' failed.

Change-Id: I86765a321f0429c9b517fe13ded0ee2dbd4b2f87
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/911
Tested-by: jenkins
Reviewed-by: Joel Bodenmann <joel@unormal.org>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-17 18:21:53 +00:00
Spencer Oliver 443197aff0 flash: fix at91sam3/4 driver typos
Change-Id: I06efdfcc48279b06035e9e173945304310054864
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/896
Tested-by: jenkins
Reviewed-by: Olivier Schonken <olivier.schonken@gmail.com>
2012-10-17 09:25:11 +00:00
Freddie Chopin 15615dcff2 Fix serious bug in LPC2xxx/LPC17xx flash algorithm.
Flash algorithm for LPC17xx/LPC2xxx was trying to "reuse" previously
allocated working area on next flashing which is not possible -
working areas are freed automatically on reset. This caused all but
first flashing attempts to fail. As there is no point in storing pointer
to working area, it was converted to local variable.

Change-Id: I939946325ff9eecc4861c0f51ab0f73871a3d7b9
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/860
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-17 09:23:39 +00:00
Freddie Chopin 19b351d8c8 Cleanup lpc2000.c
Do some cleanup in lpc2000.c - concatenate short lines into single
longer lines, move variable declarations to "just before" they are
used, etc.

Change-Id: Ia7b9f0307dd4857ee8e15c8a6d4d7b5c4392fd80
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/861
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-17 09:21:49 +00:00
Matthias Blaicher 14e12c3969 rtos: Add ChibiOS/RT support
This patch adds ChibiOS/RT support. This patch requires at least
ChibiOS/RT development version starting from SVN revision 4734.

Note, that the Thread structures depend not only on the target
but also on the ChibiOS configuration at build time.
To correct this ChibiOS includes a new "memory signature" which
specifies the offsets.

Special thanks go to Peter Stuge and Spencer Oliver for their
continous input and feedback to this patch.

Change-Id: I842bf7ba6c2309a4efe93d29ea6cd0784a8b22a3
Signed-off-by: Matthias Blaicher <matthias@blaicher.com>
Reviewed-on: http://openocd.zylin.com/901
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-16 06:32:03 +00:00
Spencer Oliver d8e4a7370f cfi: remove typos and code cleanup
No change to code, just fix some formatting issues.

Change-Id: I177430a99bfecbf90a1ddf623321c29d4db516b0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/906
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-12 21:41:53 +00:00
Spencer Oliver 2bda1ee49d flash: update stellaris flash data to latest dev package 9453
Change-Id: I16107a093d4ed7342583f5c32ad16aa98f81d122
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/856
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-12 21:41:39 +00:00
Matthias Blaicher 9ff4071568 rtos: Don't crash on qSymbol GDB packet when no RTOS is configured
Commit 43902905bb fixed a bug but also
introduced a regression. The RTOS GDB packet handler is always called,
not only when an RTOS is actually configured, so it is important to
check if an RTOS has been configured or not before actually processing
the qSymbol packet.

Change-Id: I1aed54f6c2817e1ebf99ddcda051df4554ea5a3a
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/907
Tested-by: jenkins
2012-10-09 10:23:51 +00:00
Paul Fertser a136b08fc3 rtos: support FreeRTOS over stlink
Since stlink is a special case it presents the same CPU core under a
different name, so copy the configuration to account for that.

Change-Id: I9febf79b388301bde6211d185b5b8161cdadb9ff
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/652
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 20:36:18 +00:00
Peter Horn 006a108494 rlink: Fix DTC command timeout
With the current timeout setting i = 10 in drtc_run_timeout()
I get "Error: too many retries waiting for DTC status" when
loading a program into the FLASH of an STM32F1.

By experimentation a value of i = 22 was found to be the minimum
on my system. Therefore the value has been increased to i = 50.



Change-Id: Ib67fc648ccaad305871b81c2c39e49de53c330a0
Signed-off-by: Peter Horn <peter.horn@bluewin.ch>
Reviewed-on: http://openocd.zylin.com/863
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 20:32:20 +00:00
Andreas Fritiofson 3f8ca97daf dsp5680xx_flash: Remove unused flash bank structure
Change-Id: I947b6730b3741a71303e440daefa4fcf583cb9cf
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/867
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 10:31:26 +00:00
Andreas Fritiofson 9e001244da stm32f1x: Increase options erase timeout
The erase time for the option byte page is not directly specified but is
assumed to be the same as the other pages (or mass erase) which is 20 to
40 ms. The current timeout value is 10 which means 10 ms plus the time to
poll the status flag that many times.

With faster interfaces or drivers (such as when using the ftdi driver
instead of the ft2232 driver) the adapter delay is not enough in some
cases, unless the jtag freq is reduced as a workaround. The result is a
"timed out waiting for flash" error when trying to write the options.

Increase the timeout to a minimum of 100 ms, which is in line with the
other erase timeouts. Also make defines of both the erase and the program
timeouts.

Change-Id: Ia86e71505033c52b60ef30092000689fbb547a18
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/902
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 10:29:39 +00:00
Andreas Fritiofson 8415353f2b flash/nor/stellaris: Remove unnecessary write_algorithm check
The pointer must be non-null here since we returned if allocation failed.

Change-Id: I9b75099ed3b3870c815d1df5760ed1f3fe1d20d6
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/866
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 10:25:50 +00:00
Andreas Fritiofson 4da4e1cfb7 flash/nor: make all working area pointers local
Working area pointers shouldn't be re-used, so there's no point in storing
them in the flash bank struct. Make all such pointers local.

Change-Id: Iab65b4e8b475fed7fc72fb8928f54590fa69d260
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/865
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-08 10:25:15 +00:00
Spencer Oliver cbfc443c7b Revert "target: remove unused working area 'user' field"
This reverts commit 63a23e6fc8

Change-Id: I62778fb3b1dabc6470d582bea9ca64d593999233
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Change-Id: Iaf5a2cf5bdc4a62ba68ad9403e1c1229112970de
Reviewed-on: http://openocd.zylin.com/899
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-07 13:26:58 +00:00
Peter Stuge 43902905bb rtos: Rewrite rtos_qsymbol() and fix auto-detect false positive
Matthias Blaicher submitted a patch at http://openocd.zylin.com/#/c/891/
to fix the false positive; when no RTOS was detected OpenOCD used the
last RTOS in the list.

While reviewing the code affected by Matthias' patch a rewrite seemed
appropriate, to make the code readable.

Matthias has abandoned his change and this change also fixes the false
positive.

Change-Id: Ic3327ccd036da52ba0a7e21ef93018205e74149c
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/895
Reviewed-by: Matthias Blaicher <matthias@blaicher.com>
Tested-by: jenkins
2012-10-05 21:03:35 +00:00
Peter Stuge 44e6d7720b rtos: Rewrite rtos_try_next() for readability
The new code is almost functionally equivalent to the old.

The function now returns 0 instead of -1 if target->rtos has not yet
been allocated. All call sites only test for success, and in practise
that is also the only thing that matters; if the function successfully
iterated to the next RTOS or not.

Other than that the only difference is that the code is now readable.

Many thanks to Matthias Blaicher for the fix to the iteration error!

Change-Id: I3342826f653b5e46c99ad1f58eec26ff10795c33
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/894
Reviewed-by: Matthias Blaicher <matthias@blaicher.com>
Tested-by: jenkins
2012-10-05 21:03:04 +00:00
Peter Stuge 16cd4e6fce rtos: Rewrite rtos_create() for readability
The new code is almost functionally equivalent to the old; besides
error handling the only difference is that the code is now readable.

Many thanks to Matthias Blaicher for pointing out an iteration error
in the rtos_try_next() change, which also affected this change.

Change-Id: If38b87439e9de2303b220b3a7e3200ceaa8391da
Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/893
Tested-by: jenkins
Reviewed-by: Matthias Blaicher <matthias@blaicher.com>
2012-10-05 20:19:01 +00:00
Olivier Schonken 5952843fc5 Modified Sector Erase for AT91SAM4S
In FLASHD_ErasePages AT91C_EFC_FCMD_EPA is used to erase sectors.
According to the datasheet FARG[15:2] defines the page from which
the erase will start.This page must be modulo 4, 8, 16 or 32
according to the number of pages to erase. FARG[1:0] defines the
number of pages to be erased. Previously (firstpage << 2) was used
to conform to this, seems it should not be shifted... Changed it
to (firstPage) | erasePages.

Change-Id: I791cc7fc4faf056623ad5a6c7e860315306098a1
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/830
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-04 15:53:19 +00:00
Spencer Oliver bd5f5c6a66 build: fix broken ftd2xx bus blaster
If configure is executed without --enable-ft2232_ftd2xx then the bus blaster
or presto will fail to build with unresolved external ftd2xx_status_string.

Make sure we run the ftd2xx build test if --enable-usb_blaster_ftd2xx is enabled.

Change-Id: I09d270d6fcd083d77f6785b8969d9acb3dfef11d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/892
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-04 13:42:56 +00:00
Spencer Oliver eaed9db414 gdbserver: code cleanup
Change-Id: Iab2966be8dd145f33f41902e2d55afe03d0f5856
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/857
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:39:45 +00:00
Spencer Oliver 8a271d9dd1 build: remove unnecessary jim.h include
as well as not being required, as it is already included by jim-nvp.h.
It also makes the doxygen output a bit clearer to read.

Change-Id: Ia2bed7142b4a56b48b1ecf0734e63f860dcd1014
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/859
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:36:39 +00:00
Spencer Oliver c06af3af91 sysfsgpio: remove ignoring return value build warning
fixes following gcc warning:
error: ignoring return value of write, declared with attribute warn_unused_result

Change-Id: I96ea6649078449208a77690caea2cb237c388e6e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/854
Tested-by: jenkins
Reviewed-by: Marc Reilly <marc@cpdesign.com.au>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:33:42 +00:00
Spencer Oliver 0b98ca3610 flash: add stm32f3 rev 2 flash support
Change-Id: Ibab5112f5f70a609136d01ebc50530a334640d03
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/809
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:27:30 +00:00
Spencer Oliver baf1797406 ftdi: incorrectly using output register for direction
fix a simple copy/paste bug.

Change-Id: I5caaa4d16d30f26a453bd6a00c95261fd6e716c5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/849
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-10-02 11:23:48 +00:00
Spencer Oliver a5768e9722 ftdi: correct ftdi_initialize error text
Change-Id: If230c0b5b3a18fd273106b743404079d0cbc9ddc
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/840
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:23:08 +00:00
Spencer Oliver e4df550ad9 ftdi: fix adapter_init rclk fallback
adapter_init expects jtag_get_speed (via ftdi_khz) to return a valid
fallback speed if the adapter does not support rclk. The call was failing
and so was the rest of the adapter init.

The makes the new ftdi driver emulate the old ftdi driver.

Change-Id: Ic7fac7d201241eb181e98f1ba7111f159731f6e0
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/839
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-10-02 11:22:27 +00:00
Peter Horn 1ab99c3fe5 Fix: Error while reading from USB endpoint
This patch fixes the bug reported here:

http://sourceforge.net/mailarchive/message.php?msg_id=28350157


When using Rlink under Linux, openocd exits with:

"Error: Read of endpoint 2 returned -75, expected 17"

The return value of -75 translates into EOVERFLOW. The cause is a wrong output buffer size argument passed to dtc_run_download().

Change-Id: I5d056705181ab6a6d4355524df06a0ea9c605961
Signed-off-by: Peter Horn <peter.horn@bluewin.ch>
Reviewed-on: http://openocd.zylin.com/862
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-09-29 17:08:52 +00:00
Spencer Oliver 0b118583f7 jtag: remove libftdi enum-compare warning
See Trac #52 for details.

Change-Id: Idb509ead2b51bfcceeb00d0224a4d1c395b28a04
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/801
Tested-by: jenkins
Reviewed-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-27 14:11:24 +00:00
Evan Hunter 4dd8f8aa40 Add extra Coresight component ROM identifiers for the Cortex-M4
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Change-Id: Iaf2d69cf10c341d3a516986677f69a4389b29b1a
Reviewed-on: http://openocd.zylin.com/841
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-09-27 14:07:19 +00:00
George Harris 516719b6b8 Added SPIFI flash driver, algorithms, and docs
Added a flash driver designed to allow program/erase of
memory-mapped SPI flash chips for LPC43xx/LPC18xx family
micros. This driver includes three algorithms - erase,
write, and SPIFI peripheral initialization (to allow
memory-mapped access after a reset). The driver has been
added to the flash driver table (drivers.c), and the
OpenOCD documentation has been updated to include the flash
driver configuration command.

Change-Id: I79f4ff8f1f07de4e5f2fe4f8c23aeb903f868514
Signed-off-by: George Harris <george@luminairecoffee.com>
Reviewed-on: http://openocd.zylin.com/783
Tested-by: jenkins
Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-26 16:17:42 +00:00
George Harris 15e19011ea SPI nor drivers refactor
Moved common SPI flash driver code (device table,
common commands) into flash/nor/spi.c and spi.h.
Updated flash/nor/stmsmi.c to reflect this refactor.

Change-Id: I141644b0af71d3835f29f06dd15b505a00e5b6ec
Signed-off-by: George Harris <george@luminairecoffee.com>
Reviewed-on: http://openocd.zylin.com/782
Tested-by: jenkins
Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-26 16:17:21 +00:00
Marc Reilly fe52282c37 drivers: new jtag bitbang driver using sysfs gpio
This driver implements a bitbang jtag interface using gpio lines exported via
sysfs.

The aim of this driver implementation is to use system GPIOs but to avoid the
need for an additional kernel driver.

A config suitable for RaspberryPi is included.

Change-Id: Ib2acf720247a219768d1cbfeebd88057ed2d7b8b
Signed-off-by: Marc Reilly <marc@cpdesign.com.au>
Reviewed-on: http://openocd.zylin.com/762
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-26 16:16:17 +00:00
Spencer Oliver 552e027f68 stlink: issue error for stm32 option writing
The stlink interface currently does not support 16bit read/writes.
Until a fix is included we issue a error that this is unsupported.

Change-Id: I4552cf2bd3b29e90ecc905325b743c08e2b92d67
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/808
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-07 06:17:07 +00:00
Chuen Chou e26ddb627b flash: fix sam3 page read/write address computation error
In at91sam3.c for Atmel SAM3 flash support, there are arithmetic errors in the functions sam3_page_read() and sam3_page_write().
Address locations are computed incorrectly due to an extra addition operation. This leads to memory locations being skipped during
flash writes and reads.

Smaller programs are written successfully into flash, with memory gaps, while larger programs of legitimate size fail because the
skipped memory is not utilized and therefore unavailable.

The changes address this condition, and have been tested with an Atmel SAM3X-EK evaluation board.

Change-Id: I9ea3b9ed0130b71cbc32b2294e31a6a2bc71b47a
Signed-off-by: Chuen Chou <zhouquan27@gmail.com>
Reviewed-on: http://openocd.zylin.com/806
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-07 06:16:57 +00:00
Spencer Oliver 39f3501afb cortex_m: suggest using hardware srst if VECTRESET used
If the target does not support SYSRESETREQ we fall back to using VECTRESET.
This however does not reset the peripherals and we issue a warning to the user
to suggest using a reset-init script.

Also suggest that using hardware srst will give them the same functionality
as using SYSRESETREQ.

Change-Id: Ie1781c4b849fed66c52222e6539735537c879fb3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/802
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-06 19:19:03 +00:00
Salvador Arroyo 4288886c83 Pic32mx: make row programming work with any offset
In function pic32mx_write_block() if the parameter
offset is not a multiple of row size the row offset
(offset % row_size) will be ignored by the flash
controller, shifting the code to the beginning of
the row.
Word programming gets it right.

Change-Id: I134913e3d533688f791bbcb0c6e8983524197f3c
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/796
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:43:08 +00:00
Spencer Oliver 210ff60284 server: warn if user changes server port after init
So the user can view the current port number these cmds were changed to COMMAND_ANY.
However this means that the user can also attempt to change the port number after init,
even though this is not supported. Issue a warning that this is not supported.

Change-Id: I3d20dcd81277e7d994240a8e314f27672ff760c4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/788
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:42:52 +00:00
Spencer Oliver 9a8aa4ec63 stlink: fix typo
Change-Id: I5fe7b695b00faef966e7621614bbd60b6e694a4f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/800
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:41:48 +00:00
Spencer Oliver 897817b331 stlink: improve swd hardware reset
Treat SWD wait result as success, otherwise hardware reset will sometimes fail.

Change-Id: I0dbdbe9e75924fe0dde547a72883c60c3db7b15e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/799
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:41:10 +00:00
Andreas Fritiofson 6055d952c3 ftdi: fix overflow if last field of a scan is empty
The last bit of a scan is clocked during TAP movement so it's necessary
for the last field to have at least one bit. Strip trailing empty fields
and make sure the TAP is not affected if there's nothing to scan. Clients
probably shouldn't add empty fields so add a debug message to be able to
track and fix them.

Change-Id: I27552568bc11146570b9b99ed8a1ae81b5fb2c50
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/794
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:31:59 +00:00
Andreas Fritiofson d9a02fda07 mpsse: check available buffer space even for discarded data scans
When there's no data to scan in or out, we still use the clock data out
command and fill the buffer with zeroes, so make sure the buffer is
checked for available space.

Change-Id: Ia6005c40c81f7fdb89379f1b5023fe383184d210
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/793
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:31:39 +00:00
Spencer Oliver d7f5a00cdc adapter: remove superfluous line breaks
Change-Id: I8e68b9d6f571ef7715a2f4cad0aa78fe4e3b48e8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/798
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:29:06 +00:00
Spencer Oliver 0288ea0920 adapter: add 'adapter speed:' prefix to output
Currently only the adapter speed is printed, which can be rather misleading
when DEBUG_INFO is disabled, all the user sees is
6000 kHz
instead lets print
adapter speed: 6000 kHz

Change-Id: I8f02a63f47344457e3c3d0a6774157fa18206440
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/797
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:28:39 +00:00
Freddie Chopin 07158a7f8a Add another scripts search path for Windows builds
Add single "scripts" folder to search path for Windows OpenOCD builds
that don't use cygwin
bin/openocd.exe
scripts/interface/dummy.cfg
scripts/target/at91eb40a.cfg

Do some refactoring of current code (thx to Andreas).

Change-Id: Idbb08d1368b06f25da44f4f9ab1511db992b1724
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/785
Tested-by: jenkins
2012-08-29 06:26:21 +00:00
Andreas Fritiofson 73d87c6210 kinetis: bugfix in kinetis_write() fallback path
Offset calculation into buffer was wrong and code would read outside buffer
if count was not a multiple of four.

Change-Id: Ied625b10221423d5a5f25d27ce1edd8c2c3eca8a
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/749
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:26:02 +00:00
Christopher Kilgour 4c3972c1df kinetis: ensure flash writes are not truncated
The number if longwords or "sections" (Freescale term) written for a Kinetis
flash write (4, 8, or 16 bytes depending on the part density/granularity) are
now rounded up to ensure there are no truncations when the desired write is
not a multiple of the minimum write size.

Change-Id: I8db40a8769d8ac5393a46cbf4e5ff0df82faf916
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/738
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:25:41 +00:00
Spencer Oliver 09f9596ae0 jtag: fix clang ulink memory leaks
Memory leaks discovered by clang 3.1

Change-Id: I8a784ba9726deac508424eddb27e9c8409e2773f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/795
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:25:19 +00:00
Salvador Arroyo a25e61ecd3 Patch: Make pic32mx unlock work at higher scan frequencies
For example in a pic32mx220, pic32mx unlock don't work
if adapter_khz is set to 5000 or more.

A short delay after asserting reset fix the problem.

Change-Id: I62e493edfcea585c36c8de77a969cebac7227b96
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/790
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:25:01 +00:00
Spencer Oliver 4be685c616 stlink: stlink_interface_init_target use hex prefix
Change-Id: I782da74687bcf111c1f04c53b2c1120d6a034441
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/791
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:24:14 +00:00
Andreas Fritiofson 0989cd4d5d arm7_9: Fix broken halfword/byte memory reads
Always scan out all bits, but make sure only the allowed number of bytes
end up in the caller-provided buffer. Discard the rest by adding another
scan field when size < 4.

Rewrite the endianness callback to avoid reading outside allocated memory.
Make it directly usable as a callback without the need for a wrapper. Move
the shared callback to a more suitable home in arm7_9_common.

This fixes the regressions introduced in commits
991ed5a2b6
cb90d32e38
and
c3074f377c

Change-Id: Ia8bde8c5a9844e89a1d6c0bc8534cd26f02f8d11
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/789
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:23:47 +00:00
Salvador Arroyo 47728f9215 Severe bug in Pracc code
The function  wait_for_pracc_rw() fails if Pracc bit is 0.
The variable ejtag_ctrl is loaded with the content of the
control register in the first scan.
In the second scan Pracc bit is scanned out as 0, letting
the proccesor go. The result is unpredictable.

All the strange data corruption when scanning at certain
frequencies, or the strange delays needed when entering
or leaving fasdata area are retated to this bug.

Now the code works at any scan frequency, tested up to 15000Khz
and indepently of processor speed, tested at 31.25Khz and 4/8Mhz.

Change-Id: Iedfd81d06d6af4bc738a521f720e42323025b268
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/769
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:53:25 +00:00
Spencer Oliver 63a23e6fc8 target: remove unused working area 'user' field
working_area::user has never been used so lets remove it.

Change-Id: I1200311b34248549c1fe30c9f675e6129b7bebee
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/781
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:52:52 +00:00
Andreas Fritiofson 349b459e98 cfi: fix type-punning warnings in cfi_spansion_write_block
Retest the condition when needed, instead of abusing the common_magic
field as a flag. There are only two options here. Either it's an armv7m or
it's another arm. is_arm(...) will return true even for armv7m, so it's
imperative to check in the right order.

Change-Id: Ic227f19f7babf1b0b0fe075f9a3abc4eabc7d5f1
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/779
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:52:27 +00:00
Martin Nowak f97a159411 build: fix clang warnings
Change-Id: I3c6a63a18034535f0a8c2c62ba8a708f09d7839b
Signed-off-by: Martin Nowak <dawg@dawgfoto.de>
Reviewed-on: http://openocd.zylin.com/765
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:51:00 +00:00
Spencer Oliver 78f4f95648 target: catch dap_lookup read error
Issue found by clang-3.1

Change-Id: I2e922ec83117e75db5bec1e82edaa75a9e6e7464
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/778
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:50:43 +00:00
Spencer Oliver 640141eea3 flash: remove lpc2000 clang warnings
By Initialising the param_table we remove the clang warning's.
We are also make sure we are not passing any rogue values to lpc2000_iap_call.

Change-Id: Idb3b0077d1dae5f03dedab1d46d01140fe9ffb10
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/777
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:50:25 +00:00
Spencer Oliver 2d57e80801 tcl: fix potential memory leaks
Reorder to allocate all memory after COMMAND_PARSE_NUMBER call.
This removes a clang warning about un-released memory

Change-Id: I8dbeb664a6467077157015bd879bc0aefc5e8614
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/776
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:50:18 +00:00
Spencer Oliver 60a932b368 build: fix memory leaks
Fix the memory leaks found by clang-3.1

Change-Id: Iaae68627ef599c324c9c9ee5737c22e92512862d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/775
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:49:56 +00:00
Spencer Oliver fb525cdd76 flash: fix FC_FLEX_RAM class code path
If the flash class was defined as FC_FLEX_RAM then this would always drop
through to the default handler.

This bug was found by clang, so untested.

Change-Id: I2d9fe6415dd216728a145519400f7b9ef1bd3c3a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/773
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
2012-08-24 16:49:43 +00:00
Spencer Oliver 0e4dee1164 helper: command.c cleanup
Change-Id: I66643960e38625e843b5f54d1c072e4eee78284d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/772
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:49:30 +00:00
Spencer Oliver a7f320e919 target: add valid smp target check
Check that the target is valid before calling any target functions.

Change-Id: I538fccc79d5ec89976e14beab02cb20490b299bb
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/766
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-02 14:30:09 +00:00
Freddie Chopin 0527d336a5 Add missing files (header and .txt) for release.
make distcheck is used to make packages with OpenOCD release, this
command uses information from Makefile.am files to know which files
should be included in the package and which can be left only in
repository. This patch makes a few headers from recent JTAG drivers
and one txt file with info about target tcl config files included in
released packages.

Change-Id: I91202290633a30f53624a8c7d9a0ebf72c40772b
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/767
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-08-02 13:16:06 +00:00
Alexander Osipenko 168fcf58c5 arm946e: add icache/dcache manipulation commands.
Provide cache operations coherent with internal target state.
Functions similar to xscale target.

Change-Id: Ic6b9a894154f6e4f5672b5d7f5035c9774ee9499
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/695
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-01 21:20:32 +00:00
Alexander Osipenko f1e9cef410 arm946e: cp15 command returns value to the script
Not just print it.

This enables scripts to analyze valuable config options of
arm946e-s cores, do internal BIST memory tests and more.

Be careful to flush caches before disabling it.
Do not forget that BIST test overwrites  memory.

 - cp15 rewritten from COMMAND_HANDLER to jim_handler.

Change-Id: I734da0be6db0a3127c2daa94ed75efef94da8ceb
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/694
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-01 21:19:53 +00:00
Alexander Osipenko 63687807cc arm946e: cleanup C0.C cache type reg access
Cache type register C0.C is read-only, and display
hard core configuration information.
This information is unlikely be changed in runtime.

 - removed C0.C access when result is not used in
   arm946e_invalidate_dcache()
 - access C0.C only once per target, store result
   in cp15_cache_info field of target structure
 - fix cache index count calculation

Change-Id: I12bc4c967fdf07f54d755f2f2f42406c0ababc1a
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/693
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-01 21:18:37 +00:00
Alexander Osipenko 9c9c06b8ae arm946e: don't use global variables for context
Global variables 'dc' 'ic' had been used in the code
to keep target's state of D-cache and I-cache
on debug entry.

This may lead to incorrect operation in configurations
with multiple cores and unequal cache states.

Fix: move cache state to the appropriate bits of the
'cp15_control_reg' field (already present but unused).
Vaule of cp15 control register stored here on
arm946e_post_debug_entry(), and analyzed later
in arm946e_write_memory().

Change-Id: I71ef82be00c21d6fffb3726cec4974d1ece70dfe
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/692
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-01 21:16:37 +00:00
Andreas Fritiofson c89eb70a20 flash: stm32f1x: Pad odd byte writes early to avoid 16-bit writes
For odd byte counts, stm32x_write() pads the last byte and writes it using
a discrete 16-bit access. The stlink debugger can't issue 16-bit writes so
it fails for odd byte writes.

This patch changes stm32x_write() to pad odd byte writes into a new buffer
and use the normal code path with a single block write. The fallback path,
when working area cannot be allocated, has to use 16-bit writes though
which means that sufficient working area is required for stlink and odd
byte writes.

Change-Id: I4c5dc456300b6e1056f76b0095be8aceee3e954f
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/756
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-01 21:12:07 +00:00
Spencer Oliver 40801d21ff telnet: cleanup comments
seems comments were mangled during the last cleanup.

Change-Id: If759f62032705c7baffd3973e9717eb7e8a5d17c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/752
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:52:44 +00:00
Salvador Arroyo 5e1f5f4731 Bugfixes in mips32_pracc.c
When testing a pic32mx220f032b with different values
for adapter_khz and cpu clocks i was getting a lot of
corrupted data from the chip. From time to time
openocd fails with segmentation faults or is aborted
due to memory corruption.

Change-Id: I134743f75c477b3d55dc74ae4474598e153b4a4a
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/690
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:41:00 +00:00
Salvador 09cd5661e6 Speed up mips_m4k_write_memory()
Do not call mips32_cp0_read() if not needed.
This will speed up execution of mips_m4k_write_memory()
by near 2x, with parameter count = 1.

Change-Id: I7829a7802b6475bc6d4ac3f0632d8d239d1072da
Signed-off-by: Salvador <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/624
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:39:03 +00:00
Andreas Fritiofson 9a8edbfa8b flash: reduce code duplication in stm32 flash probe
Remove a lot of the repetitive code in stm32f1x flash probe by converting
the large if-selector to a switch, moving the common checks outside it and
concentrating the failure handling to a single point.

Do the same with stm32f2x and stm32lx for consistency.

Change-Id: Ic0ecfb1533c49f5d2108cda5fd20c8372d7c71ef
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/746
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:33:58 +00:00
Spencer Oliver 38e44d1361 flash: fix stm32 flash driver typo's
Change-Id: I37f3fee063d7f8729e057dcfe8904651790439e6
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/745
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:28:33 +00:00
Spencer Oliver 055abd0b9c flash: handle zero when reading stm32 flash size reg
Some variants read 0 for the flash size register, rather than
failing lets assume we have max flash fitted.

Change-Id: Ie1fb4e73606f49268a6fd5921c3aef75bc4790d3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/744
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:27:39 +00:00
Spencer Oliver 531fbf0ef2 flash: stm32l handle flash size read failure
Rather than failing if the flash size reg cannot be read lets assume
we have the max flash size fitted.

It is quite common on early ST silicon to not correct support this register.

Change-Id: Ife058d60ae0027faad2c929ebd5b7fe2ef27234d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/743
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:26:23 +00:00
Spencer Oliver fe583e78c2 flash: add stm32l Revision X support
Revision X is not mentioned in the latest RM0038 rev5, however it has been
confirmed correct by ST using ST-LINK Utilty.

Change-Id: I65210e512ea25818a1d0d3b223502ebd7535b29d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/742
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-30 06:25:04 +00:00
Freddie Chopin 951d185049 Add support for FT232H chips
FT232H chips are new highspeed devices from FTDI. Basically these are a half of FT2232H (or a quarter of FT4232H), so only one channel which can be used as OpenOCD
interface. The chips are supported by libftdi 0.20 or later and by ftd2xx 2.08.12 or later.

Change-Id: Ic9a2c279167c3419a24f0d6befacbb83c4ffeb25
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/736
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es>
2012-07-30 06:15:10 +00:00
Andreas Fritiofson 0900d5a3cd flash: don't write to FLASH_CR in stm32x_write_block
It's unnecessary and prevents reusing this function to fix
option byte writes.

Also try to disable flash writing after an error.

Change-Id: Ib5a7b768a1523e6b8da1555126fef4c1e60ab083
Signed-off-by: Szymon Modzelewski <szmodzelewski@gmail.com>
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/479
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-07-30 06:14:16 +00:00
Alan Bowman 8cf671ea7b Test the incoming debug_level, rather than the current.
The existing code tests the current debug_level for validity, allowing
the user to set it too high and never change it after that.  The new
behaviour is to test the debug_level that the user has requested.

Change-Id: I85726a2e606c8d137e9b1cfe76fee865084844b1
Signed-off-by: Alan Bowman <alan.michael.bowman@gmail.com>
Reviewed-on: http://openocd.zylin.com/764
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-07-27 09:50:34 +00:00
Alex Austin 10fd274cfe Revert "When calling openocd from a shell like this:"
This reverts commit e8641695c6

Original premise was wrong. Proper command is "shutdown", not "exit".

Change-Id: I07f5fe0dda9c24abe53628da986bfda0e406bb4a
Signed-off-by: Alex Austin <alex.austin@spectrumdsi.com>
Reviewed-on: http://openocd.zylin.com/757
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-07-22 19:18:22 +00:00
Salvador Arroyo aaf5991d79 MPSSE: Add FT232H to supported chips
Change-Id: I1ce1db7eb87a7cdeafc1f8b8b34594f6fa3bf1f8
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/677
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-07-17 04:59:56 +00:00
Andreas Fritiofson f5e97b5e1b Add FTDI JTAG driver using MPSSE layer
Based on ft2232.c but uses the MPSSE layer for low-level access, greatly
simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout
specific code. Layout specifications are instead handled in Tcl.

Use a signal abstraction to enable Tcl configuration files to define
outputs for one or several FTDI GPIO. These outputs can then be
controlled using the ftdi_set_signal command. Special signal names are
reserved for nTRST, nSRST and LED (for blink) so that they, if defined,
will be used for their customary purpose.

Depending on the type of buffer attached to the FTDI GPIO, the outputs
have to be controlled differently. In order to support tristateable
signals such as nSRST, both a data GPIO and an output-enable GPIO can be
specified for each signal. The following output buffer configurations are
supported:

* Push-pull with one FTDI output as (non-)inverted data line
* Open drain with one FTDI output as (non-)inverted output-enable
* Tristate with one FTDI output as (non-)inverted data line and another
  FTDI output as (non-)inverted output-enable
* Unbuffered, using the FTDI GPIO as a tristate output directly by
  switching data and direction as necessary

The data and output-enables are specified as 16-bit bitmasks,
corresponding to the concatenation of the high and low FTDI GPIO
registers. To specify an unbuffered output, use the same bitmask
for both data and output-enable.

The adapter configuration file must also specify default values for the
FTDI data and direction GPIO registers, and the channel being used (if
different from 0).

Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/452
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-07-17 04:44:41 +00:00
Andreas Fritiofson b598efb613 Add MPSSE communications layer for FTDI chips
This is a higher-level libftdi replacement for use when implementing
protocol drivers for FT2232, FT2232H or FT4232H. It takes care of device
open/close and, unlike libftdi, also MPSSE command abstraction, command
queueing, buffer handling and return data parsing.

The FTDI device is accessed through libusb-1.0 in asynchronous mode.

Change-Id: I051adb574dcc39f8ca9cd7f6dbe6ae4aeea5f4c8
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/451
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-07-17 01:34:01 +00:00
Spencer Oliver 2aab7d3ce2 target: Cortex-M use consistent arm dap access
Purely cosmetic but use the same style as Cortex-A target, this makes
searching refs easier.

Change-Id: I732ad9701f561e2312c5d191f5aaffd3a2f2393d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/731
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-07-11 19:28:48 +00:00
Spencer Oliver 24c0f9470a stlink: fix arm semihosting support
Add missing arm cmd handlers that enable semi hosting support to work as
expected.

Change-Id: I063d82c48b82b4f6aed4efc4b08ea752d78e9047
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/734
Tested-by: jenkins
Reviewed-by: Alan Bowman <alan.michael.bowman@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-07-11 10:34:59 +00:00
Spencer Oliver 1df6e59178 flash: add stm32f3x support
add support for the new stm32f3x family from stmicro:
http://www.st.com/stm32f3

Change-Id: Icd1db95bb2767d9c0ecef24deefa92b4fdaa4f14
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/735
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-07-11 10:32:39 +00:00
Stefan Mahr 07251ab8d8 jtag: fix opendous reset command
This cast to uint16_t is not (host) endianess save.
Depending on compiler usb_out_buffer[1] may be undefined.

Change-Id: If686e5d5da39541329c340bbdef472ee7ab0281c
Signed-off-by: Stefan Mahr <stefan.mahr@sphairon.com>
Reviewed-on: http://openocd.zylin.com/732
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:18:00 +00:00
Spencer Oliver 5b170456f7 target: detect correct Cortex-M tar auto increment size
The ADIv5 spec guarentees that tar_autoincr_block will be 10bits.
Make this the default for Cortex-M family until we detect a Cortex-M3/M4,
we then change autoincrement to 12bits.

Change-Id: Ie8c89134aa036879bdd8a3c312cee9715dbc6913
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/730
Tested-by: jenkins
Reviewed-by: simon qian <simonqian.openocd@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:17:42 +00:00
Spencer Oliver 2c14497d0a jtag: remove redundant id check
commit 5b0a131594 removed the need to check
for 0xffffffff.

Change-Id: Ib4d99bf1797ccd868ec15631dbc16079571a8dd6
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/728
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:17:08 +00:00
Stian Skjelsad e8641695c6 When calling openocd from a shell like this:
openocd -f board/sheevaplug.cfg -c init -c exit

the calling shell will believe that openocd exited with an error due to exitval will be non-zero

This is not tested against incomming telnet

Change-Id: I63d15715a7b46f39a7de261a45039f8c3cad7a98
Signed-off-by: Stian Skjelstad <stian@nixia.no>
Reviewed-on: http://openocd.zylin.com/470
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:16:04 +00:00
Vandra Akos 9ce207a52a target.c, jim_target_md using command_print_sameline
jim_target_md is supposed to print out results with command_print in
hexdump format. It was using command_print which appends a newline character
aftre every invocation. Using command_print_sameline instead

Change-Id: Iaff03021acc38d54b5a082cb58b82aa4449c0715
Signed-off-by: Vandra Akos <axos88@gmail.com>
Reviewed-on: http://openocd.zylin.com/669
Tested-by: jenkins
Reviewed-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:08:01 +00:00
Vandra Akos 30aacc0564 target/target.c, jim_target_md refractored
- Added a few lines of comment before the function explaining the usage and the
output generated by the command
 - Added a few lines of comment in the body explaining what is happening to improve
code readability
 - Renamed a few variables to improve readability:
    * a -> addr
    * b -> dwidth
    * c -> count
 - Added a new variable, named byte to contain the number of bytes to read, instead
of overwriting the count parameter, to avoid confusion between the two values.

Change-Id: I5828ec0f5aadaa39becec7b84f198756bb2c3d41
Signed-off-by: Vandra Akos <axos88@gmail.com>
Reviewed-on: http://openocd.zylin.com/665
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-07-11 08:07:22 +00:00
Andreas Fritiofson 6d639b09f0 Add a bit-level transfer queue
Interface drivers regularly need to keep track of where each part of a long
read buffer should be copied, once that data arrives. Both source and
destination are often at an arbitrary bit offset.

This queued bit-level copy can help with that, by allowing the driver to
perform postponed reads from the receive buffer already when building the
transmit buffer, and have those reads executed at a later time when data is
available.

For simplicity, it uses the linked list implementation list.h imported from
the Linux kernel.

Change-Id: I06862a0a6f057cbbcacfb021f17a795195faded2
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/450
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-07-06 14:58:25 +00:00
Mike Crowe edf0c3376d topic: flash: description/id added for ATSAM3SD8C
New flash description for ATSAM3SD8C used on SAM3S-EK2 development boards.  Name used
is "at91sam3sd8c" and chipid is 0x29ab0a60.  Mirrors description of other similar parts.

Change-Id: I7fc4b82e7969451645ab067223663f08b76d866b
Signed-off-by: Mike Crowe <mpcrowe@gmail.com>
Reviewed-on: http://openocd.zylin.com/684
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 18:53:02 +00:00
Alexander Osipenko 321948b41f J-Link: Initialize .transports to suppress warning.
jtag_interface.transports field was left uninitialized, which triggers warning message
on program startup.

Although hardware natively supports SWD interface, no software support
currently present, so the value choosen to be <jtag_only>.

Change-Id: I2da41790b1850950af416cec4362d5b7bf927b2b
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/670
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 13:56:12 +00:00
Olivier Schonken 24a1e7b0fc Changed SAM4S Erase for effective Sector erase
In the previous iteration, the page counter for erases would not be updated with
the erase size.  This patch keeps the page counter synced with the sector counter.

Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Change-Id: I95e56a3257b2ad8301c9f28167b842fa6466334f
Reviewed-on: http://openocd.zylin.com/686
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 13:51:59 +00:00
Mathias K 5b0a131594 Fix idcode end of chain flag.
For multi core cpus with cores without an idcode this doesn't work
because the extra bit for every core and a n-bit shift in the data
stream.

Change-Id: Iba0ad9422ea55c01492b27b936d028719be31180
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/618
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 12:01:28 +00:00
Christopher Kilgour aeb3c4f37e kinetis: update support for all program flash granularities
Updates the Kinetis NOR flash support to handle all known block and sector
sizes.  Previously only 2kiB sectors were hard-coded, now all four known
combinations non-volatile sector sizes are supported.

The premise of separating Kinetis Program Flash (PFLASH) from FlexNVM is
also introduced.  This means each "block" of flash (in Freescale terms) is
treated as a bank in OpenOCD.  Correspondingly, the existing board
configuration for the TWR-K60M512 eval system is updated to recognize two
banks instead of one.

A board config for the TWR-K60F120M is also added.

Bank and sector erase and programming has been checked with both of the
mentioned eval boards.

Change-Id: Iae2d10ebf8f548d0a3698df5430bbbe1ccadc58a
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/663
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Jan Dakinevich <jan.dakinevich@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 11:53:37 +00:00
Alexander Osipenko 4b6af97978 J-Link: Forcibly select JTAG transport
Some versions of Segger's software do not select JTAG interface by default.
Do it in the intial setup.

Firmware version check code still present, with updated set of unsupported.

Note from Segger:
Alright, we were not aware of that OpenOCD does not select the interface
before it starts communicating with the target.  A debugger should always
select the appropriate target interface before it starts communicating with the target,
since otherwise it could also happen that a previous session with another debugger
had selected SWD and the interface was not switched again by OpenOCD.

Change-Id: I5b4eab7e0e3625ec32be75a36d89e16d17e899bf
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/667
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 10:11:03 +00:00
Alexander Osipenko 17ea1b31a1 JLink: added jlink_usb_io() function
jlink_usb_io() function added for basic communication,
since jlink_usb_message() is more specific to JTAG transactions.

To verify the patch issue "jlink config" command.

Change-Id: Id7d10bd5e8985d4c77f2e0ca47fb6033db2877bf
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/679
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 10:10:06 +00:00
Alexander Osipenko b79f9ad172 J-Link Unsupported firmware version check
OpenOCD does not work with the latest firmware versions
of Segger J-Link.

Latest working version: V4.42c
Unsupported versions: 4.44 to 4.46f, 4.20 to 4.30

Older versions of firmware can be found here:
  http://www.segger.com/j-link-older-versions.html

The firmware versions does not correspond directly with
"Software and documentation pack for Windows", it may be
distinguished by the "compile" date in the information string.

Print an warning message if unsupported firmware version detected.

Change-Id: Id7d1f965b8ce2fdbcd0026a85ddd093e2fa48720
Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/666
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-06-26 10:07:55 +00:00
Mirela Tauciuc 7800045671 AT91SAM7 Flash: fixed redundant assignation warning
Change-Id: Iffacdce9ce90c4ea7e0c8647860a0056b952f387
Signed-off-by: Mirela Tauciuc <mirela.tauciuc@gmail.com>
Reviewed-on: http://openocd.zylin.com/691
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-06-26 07:53:22 +00:00
Spencer Oliver 9b3224e887 build: remove src file execute permission
Change-Id: I42a250cdfcd03424a63cd1a255f9cf4a3c6e3ccd
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/671
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-28 11:59:37 +00:00
Vandra Akos 445a54a669 Jim_GetResult was called twice
Removed the superflous call to Jim_GetResult,
as we are reading in the result to a variable
anyways in the next instruction.

Change-Id: Idc96400737dc15e28304e97bcea79fa6c7a88ae1
Signed-off-by: Vandra Akos <axos88@gmail.com>
Reviewed-on: http://openocd.zylin.com/661
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-05-25 12:11:57 +00:00
Spencer Oliver c3074f377c target: fix segfault in arm7_9 8/16bit read
Seems I5347352e7595686634bd0de13fcf6de6e55027b0 introduced an issue when
reading 8/16 bit data - the in buffer was always set to 32bits.

Change-Id: Ife2bb6a20fcb3ec0e486655512164f25ae9196b4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/660
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
2012-05-25 12:09:11 +00:00
Spencer Oliver 3d2dd4a3a3 jtag: fix incorrect LOG_DEBUG abs_chain_position
Call jtag_tap_add before LOG_DEBUG otherwise abs_chain_position does
not get correctly set.

Change-Id: I47bd00cc83259c8bfd5551e08c3bb2ebeb5993f5
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/658
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-25 12:08:42 +00:00
Bill Traynor f901445524 jtag: fix osbdm.c typo
Fixing up tiny spelling error of "receive" vs. "recieve".

Change-Id: Ib143d7fdb24ac1f2b7bd4ae90cadaf2e12760ff7
Signed-off-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-on: http://openocd.zylin.com/659
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-05-23 00:15:35 +00:00
Spencer Oliver ffabd98d4a jtag: fix opendous typo
Change-Id: Ia88c32f2394bde2048bdd73625e7664c93a9a87d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/656
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-05-22 22:53:30 +00:00
Spencer Oliver 6b6e28ff02 jtag: remove opendous clang warnings
Change-Id: I0285c99507931e7d13aad36f4fc559c29a52faca
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/655
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-05-22 22:53:07 +00:00
Spencer Oliver b908538998 stlink: check read_reg result
Change-Id: I284824aa6f5eae8f6e910a482e9f7435e649fc0d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/657
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
2012-05-22 12:05:19 +00:00
Spencer Oliver 5cc004180b target: target.h typo and comment cleanup
Change-Id: Ib751803754672bf556f4f65bd3f5621f6bbb7f0c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/654
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 20:33:15 +00:00
Spencer Oliver 1dd462a6d6 target: enable TARGET_EVENT_EXAMINE_* events
Change-Id: I33efc0994b7bfe0faa2f4e8457fcc3c8e43d3571
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/635
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:20:07 +00:00
Spencer Oliver 25b855d2d2 target: enable TARGET_EVENT_RESUME_* events
Change-Id: I7d8378f9f34c6674db8c8b29d1a961389578e921
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/640
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:52 +00:00
Spencer Oliver bb3793c9a4 target: remove legacy target events
These events have been deprecated for a number of years, update any
remaining scripts to the new events.

Change-Id: Ic31ff388545ac8b3a500045699ca92c541b13f12
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/634
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:28 +00:00
Spencer Oliver 482660031a target: remove duplicate target events
Change-Id: Iba9ae441f3e6d48a7dfafe59ed093fef56a34723
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/633
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
2012-05-21 16:19:02 +00:00
Spencer Oliver e1c40cb1c1 target: disable armv6m unaligned memory access
Change-Id: I42704cf80939ab9c9d4f402d2cd51c196e2fadb3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/645
Tested-by: jenkins
2012-05-21 16:17:10 +00:00
Spencer Oliver 7bfcc10839 build: add helper/types.h to config.h
this header is used in numerous files and adding to config.h
simplifies its use globally.

Change-Id: Id724a9950b90504721233022c7fb5768e9bc5548
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/649
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-21 16:15:26 +00:00
Christopher Kilgour 87a9ee3625 flash/nor/driver.h: typo fix
Change-Id: Ie260f3c38b648e66958c014658bb6860171a7cc9
Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/653
Tested-by: jenkins
Reviewed-by: Bill Traynor <wmat@alphatroop.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-05-21 08:49:15 +00:00
Spencer Oliver f019c4f7d6 stlink: add myself to copyright header
Change-Id: I39e23b38ee630b80bccb5ff6b5819efa0fcb120a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/651
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-19 20:31:12 +00:00
Spencer Oliver 7572059832 stlink: remove superfluous stlink_usb.h
Change-Id: I34bc59b35fafd3fa659549e350b91310c5b33dd4
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/650
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-19 20:31:04 +00:00
Spencer Oliver 8cb0dae823 remote_bitbang: fix native windows build
Change-Id: Ied29ade0346c4595ffc1dafa788e2d5a595e0de3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/648
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-19 20:27:56 +00:00
Alexander Osipenko 47a276cfae remote_bitbang: missed closing brace in macro REMOTE_BITBANG_RAISE_ERROR
Change-Id: I591308bd98810ef6361106c207c55b83c3a83890
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/647
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-19 20:27:16 +00:00
Spencer Oliver 0eaa8e7db0 jtag: add opendous and estick support
Change-Id: I49c25d226f05fdcaca6cbfc35c2ab47e8464abec
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/611
Tested-by: jenkins
2012-05-14 09:41:49 +00:00
Spencer Oliver ec5e4bae25 stlink: add armv7m stlink handling
This enables us to better handle some of the low level functions that the
stlink does not support. It also enables us to share a few more of the
standard cortex_m3 functions if necessary.

Change-Id: I7a2c57450122012ec189245d8879d8967913e00e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/637
Tested-by: jenkins
2012-05-14 09:38:59 +00:00
Spencer Oliver f9ea791e9b flash: blank check use default_flash_blank_check
Use default_flash_blank_check, this will use the much faster
blank_check_memory handler if supported - 15x quicker on stm32f4.

Otherwise it will fall back to using the slower default_flash_mem_blank_check.

Change-Id: Ia231b3e95468c9e92594dbdbe1fa2d69e1506fc3
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/632
Tested-by: jenkins
2012-05-14 09:38:26 +00:00
Spencer Oliver e858451505 flash: fix protect check for pic32mx1x/2x family
Change-Id: Ib2692d8b79e52cd40f429008047494aa7f552984
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/612
Tested-by: jenkins
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-14 09:37:50 +00:00
Spencer Oliver c102e448c3 stlink: fix stlink api2 single step
This makes the newer v2 api behave as per the v1 api, eg. single stepping
masks all interrupts.

A better long term solution is to use same behaviour as a cortex-m3
target, see CORTEX_M3_ISRMASK_AUTO.

Change-Id: Iaf9f9adf225cf274faaac938050bb996582aa98f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/621
Tested-by: jenkins
2012-05-14 09:34:15 +00:00
Spencer Oliver 61672009c4 stlink: add stlink_api cmd
This enables the manual selection of the stlink api version.

Change-Id: I0ec8c5b0a101b6456f426d2fec65971da56db4e7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/617
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-14 09:34:00 +00:00
Spencer Oliver 18df479f0a stlink: stlink/v1 use v2 api if supported
The api v2 is supported on the stlink/v1 if it has a least v11 firmware.

Change-Id: Idfdb5a7f5a5881326017451ae9b6004eeaa46a96
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/616
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2012-05-14 09:33:49 +00:00
Spencer Oliver 57260831dd mips: support connecting under reset
Some targets support connecting while the target's srst is asserted.
Tested on pic32 family.

Change-Id: I0d20c40af6d031d1306043893e95e61f484c0a87
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/608
Tested-by: jenkins
2012-05-14 09:32:57 +00:00
Spencer Oliver d469c686d9 stlink: support connecting under reset
Some targets support connecting while the target's srst is asserted.
Tested on stm32 family.

Change-Id: I1197dd721a1e1cbf95ee77dfd8e1082b165b22a9
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/607
Tested-by: jenkins
2012-05-14 09:31:45 +00:00
Spencer Oliver 6637cf9229 cortex-m3: support connecting under reset
Some targets support connecting while the target's srst is asserted.
Tested on stm32 family.

Change-Id: I9df43623025e37832155aeee7aa099b844b85f16
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/606
Tested-by: jenkins
2012-05-14 09:31:17 +00:00
Aurelien Jacobs 9d31589d19 cfi: fix write_bank segfault with spansion flash on armv7m
cfi_spansion_write_block() passes an arm_algorithm struct to
target_run_algorithm() which in turn calls armv7m_start_algorithm()
which expect an armv7m_algorithm struct.
As armv7m_algorithm is bigger than arm_algorithm, when
armv7m_start_algorithm() writes in the struct, it overrun the buffer,
writting junk on the stack, which latter on generates a segfault.

This patch ensure we use a properly sized armv7m_algorithm struct
when the target is an armv7m.

Change-Id: I4ab67c15ae4bb72454414a81b92a4231dcdb2239
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-on: http://openocd.zylin.com/623
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-05-14 09:30:18 +00:00
Spencer Oliver e95f8d93f2 cfi: fix cfi arch check regression
seems 9933fa334d introduce a regression
if the target was anything other than armv4_5 or armv7m.

Just check that we have an arm target.

Change-Id: I67c05138e5be2952ee92e9bfa15e1d050844462a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/615
Tested-by: jenkins
Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
2012-05-14 09:29:43 +00:00
Spencer Oliver ca53849045 cfi: check supported arch
check that the cfi driver supports the current target arch.

Change-Id: I8a95908684de67bf1657d1956f2573662a641cc1
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/614
Tested-by: jenkins
Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
2012-05-14 09:29:16 +00:00
Spencer Oliver d2d4f776d8 build: use generic name for arm_algorithm vars
This makes the code a bit easier to read as arm_algorithm can
refer to other arch's, not just armv4_5.

Change-Id: I78c99d40f34cda04e06f2daee75b48ff40a1d23d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/613
Tested-by: jenkins
Reviewed-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-14 09:29:02 +00:00
Spencer Oliver e1e1d4742c build: add missing erase_check loader src
Change-Id: I1534c1ea1606fda9eb6ffa6a11a708f8c8a3d46a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/605
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-14 09:28:03 +00:00
Spencer Oliver 1b0c22dd56 armv7m: update crc/erase_check loaders for cortex-m0
Use loaders that have been built for cortex-m0, making them usable for both
cortex-m0 and cortex-m3 families.

Change-Id: Ifd82be87eaec2cb96464290c80800cec3630d619
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/604
Tested-by: jenkins
2012-05-14 09:27:20 +00:00
Spencer Oliver 47cf0aabc8 flash: use correct stm32f0 flash size register
The stm32f0 parts use a different address then the rest of the family.
Add a function that returns the correct FLASH_SIZE reg depending on variant.

Change-Id: Idb41580f7162f395b347cec034d6b745847326b7
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/601
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-08 14:06:43 +00:00
Spencer Oliver 908ee4dc96 build: remove clang unused variable assignment warnings
Change-Id: Ibe5254704d6cd879a318a82c4f50d9da3c14276c
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/600
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-04 08:15:40 +00:00
Spencer Oliver 85735925c7 build: remove clang unused variable increments warnings
Change-Id: Ib755474aa46f7233495fae1947bc27cd0b2d6b4f
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/599
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-05-04 08:15:30 +00:00
Spencer Oliver cc4a934d37 stlink: support srst reset
This adds the ability to support srst reset for the stlink/v2.
stlink/v1 will fallback to using SYSRESETREQ which is a full reset - including peripherals.

To enable the use of the srst add the following to your cfg:
reset_config srst_only

Change-Id: I570de607c5f370fd6a4abf47360686c9be07bcdd
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/581
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:05:09 +00:00
Spencer Oliver 2d8c7c510b stlink: export write_debug_reg
Change-Id: I3944911d4a71dba4af48470ceb3e4850784a0e7d
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/580
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:04:54 +00:00
Spencer Oliver 5d1cabb142 stlink: add hardware srst functions to stlink/v2
Change-Id: Ib82b6a1116b9f396f1933cc5526733334254fd62
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/579
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
2012-04-30 13:04:38 +00:00
Spencer Oliver 9cc733ae31 flash: update stm32f0x version info
Change-Id: Iab0962021e6243d1df3e7c647654a51b4bf50d72
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/578
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:04:22 +00:00
Spencer Oliver 0ce2e9a259 stlink: default to latest api available
Change-Id: Ic04128f4020055587bb87250f41e5c804d9c2b01
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/577
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:04:07 +00:00
Spencer Oliver 6f3a9bdf67 stlink: add improved STLINK_JTAG_API_V2 support
The STLINK/V2 supports two api's.
This completes the support so STLINK_JTAG_API_V2 is usable.

Support for hardware srst still needs adding.

Change-Id: Ic4d0499be2a225d18abf96fd6f5ce5e295fb1f37
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/561
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:03:47 +00:00
Spencer Oliver 8117ad8ce9 stlink: support stlink api result
The stlink api does support results for some functions - add support.

Change-Id: I39cb495408c46af8bc343b198a1e0bd4c7aee6d8
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/560
Tested-by: jenkins
Reviewed-by: Mathias Küster <kesmtp@freenet.de>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-04-30 13:02:49 +00:00
Olivier Schonken fdbf70601d SAM3X - Added support for at91sam3x8h-ES, fixed CIDR for ES2 and production
The first available devkits for the at91sam3x8h had the ES device populated.
The ES device had an error in the CIDR, specifically in the last byte of
which the upper 3 bits identifies the chip family - cortex-m3, arm7tdmi etc.

The problem was fixed on the ES2 devices - Thanks to Pat Hickey for giving me
the heads-up.

Change-Id: I13dd7fbe0cffaf76f948188c9459dc3cf4435570
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/575
Tested-by: jenkins
Reviewed-by: Jim Norris <u17263@att.net>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-26 10:58:42 +00:00
Olivier Schonken d1cd97777b topic: Added support for the SAM4S variants
Atmel introduced 6 new Cortex-M4 processors on 2011-10-26
SAM4S16C - 1024KB flash LQFP100/BGA100
SAM4S16B - 1024KB flash LQFP64/QFN64
SAM4S16A - 1024KB flash LQFP48/QFN48
SAM4S8C - 512KB flash LQFP100/BGA100
SAM4S8B - 512KB flash LQFP64/QFN64
SAM4S8A - 512KB flash LQFP48/QFN48

The SAM4S processors still suffer from the "6 waitstates needed
to program device" errata.

Other relevant changes are:
1. Address of flash memory starts at 0x400000.
2. EWP (Erase page and write page) only works for the first two 8KB "sectors"
3. Because of the EWP not working for all the sectors, normal page writes have
to be used.  The default_flash_blank_check is used to check if lockregions
should be erased.
4. The EA (Erase All) command takes 7.3s to complete. (Previous timeout was
500 ms)
5. There are 128 lockable regions of 8KB each.

Implemented default blank checking, and page erase for load_image scenarios.
This is to compensate for the EWP flash commands only working on the
first 2 8KB sectors.

Change-Id: I7c5a52b177f7849a107611fd0f635fc416cfb724
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/528
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-26 10:58:14 +00:00
Linus Tolke f28a5d9217 topic: Fixed a clang Dead assignment warning.
The value returned from target_write_buffer is still ignored.

Change-Id: Icb49d4d1313a5e4f7df68d3f122a5f81cfa0604a
Signed-off-by: Linus Tolke <linus@tigris.org>
Reviewed-on: http://openocd.zylin.com/596
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-04-24 20:31:19 +00:00
Bill Traynor 6a1236a7ac zy1000: fixed link to Zylin ZY1000 JTAG Probe
This patch fixes the link to the Zylin ZY1000 JTAG Probe webpage.
The ZY1000 product line was acquired by Ultimate Solutions, Inc. in May 2011.

Change-Id: If68cd45a0c47aa20b2e4bb62939b2c505c8c8c2e
Signed-off-by: Bill Traynor <wmat@alphatroop.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/571
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-18 22:07:15 +00:00
Spencer Oliver 3c270bb0a9 stlink: correctly format printed hex addresses
Change-Id: I4a139989927249bb5e9dcc4804965c85c37cc09b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/559
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-04-13 08:53:10 +00:00
Mathias K d90eb2b93d STM32L: Write partial-page flash data after full-page data
The target address for the partial data needs to be bumped past the
full page data. Otherwise, the partial data overwrites the start of
the flash block.

Change-Id: I1246b2fa8acbdb8193edcf7029309f11d1c6069c
Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/555
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-04-13 08:51:36 +00:00
Stephane Bonnet 57dce9560a ft2232: Support for Digilent HS1 USB adapter
* Added support to the FT2232 driver for the FT2232H-based
  Digilent HS1 adapter.

Change-Id: Iab6cc15f299badaf115615b5d4d785ecb2273c27
Signed-off-by: Stephane Bonnet <bonnetst@hds.utc.fr>
Reviewed-on: http://openocd.zylin.com/558
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-10 20:19:47 +00:00
Simon Qian 7743e0fb43 topic: add reset functions for SWD
Add swd_init_reset and swd_add_reset.
Add adapter_assert_reset and adapter_deassert_reset, and call them instead
of JTAG reset functions.

Change-Id: Ib2551c6fbb45513e0ae0dc331cfe3ee3f922298a
Signed-off-by: Simon Qian <simonqian.openocd@gmail.com>
Reviewed-on: http://openocd.zylin.com/526
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-10 12:14:00 +00:00
Spencer Oliver a2935397b4 doxygen: remove warnings
Change-Id: I020845a8df7b67f3b6c1a233b3ee07a5d14fa685
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/556
Tested-by: jenkins
2012-04-10 12:12:39 +00:00
Salvador e2535e7901 Finish off functions mips32_pracc_read_mem16() and mips32_pracc_read_mem8()
This functions are unfinished and work only with  parameter count up to 1024.

Commands mdh and mdb from pic32mx context show values not related to memory
content if parameter count is bigger than 1024. Firt 1024 are ok.

Change-Id: Ie3f4d4a0f9d1d1a69bd3a18de2f72dd9249514cb
Signed-off-by: Salvador <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/550
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Tested-by: jenkins
2012-04-10 12:10:57 +00:00
Salvador 18e6e02cdc Minor bug fixes in Mips32 code
Now the the "Fast" version for memory blank check in pic32mx.c can be called:
default_flash_blank_check()  instead of the "fallback"  default_flash_mem_blank_check().

The command "verify_image", without working area, now don't show:
 checksum mismatch - attempting binary compare
when there are no real errors in flash.

Change-Id: I256e8ae949289634e1de5c1c2861e4c4c4b7fdce
Signed-off-by: Salvador <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/549
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-04-10 12:09:55 +00:00
Wim Lewis d40cb56d49 Add value "openbsd" for ocd_HOSTOS.
Change-Id: I9b0dd87d85c0792730f507176001d39c44da7117
Signed-off-by: Wim Lewis <wiml@hhhh.org>
Reviewed-on: http://openocd.zylin.com/547
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-03-31 04:02:24 +00:00
Spencer Oliver 738e259d59 armv7m: fix broken stlink build
The stlink partially supports the cortex-m4 fp regs and requires these
defines to build.

Change-Id: Id3aa802ecc7006cb6d9f84b79ab3c21af24c1001
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/545
Tested-by: jenkins
2012-03-30 20:13:00 +00:00
Mathias K 90ea965fca stm32: Update register read/write to the register definition.
This patch fix the register index on read/write register.

Change-Id: I7b52a927a48259d6f497ac0f474aff7ff1529e9a
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/525
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-30 16:10:02 +00:00
Mathias K 861df4574d armv7m: detect floating point feature
This patch add fp feature detection on cortex-m4.

Change-Id: I99e9d1bf5534630a22b8ad9c878165683db2d0ba
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/524
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-30 16:08:32 +00:00
Salvador Arroyo c68a267ee1 topic: Flash support for Pic32mx1xx/2xx
Change-Id: I496cb745fb1eb5c9159471838013b8d19418f5c0
Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/500
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-30 15:54:22 +00:00
Spencer Oliver 4aa63d59bd transport: remove interface multiple transport warning
Currently if we have multiple transport's defined we receive an warning similar to:
must select a transport.
allow transport 'jtag'
allow transport 'swd

This removes that warning and only prints this info if transport_init fails.

Change-Id: I87126390f234bc2f705e1f150a0dcc110dcab151
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/532
Tested-by: jenkins
2012-03-30 15:51:37 +00:00
Salvador 1274df07f1 Bug in src/target/mips32_pracc.c
The bug shows up with the command "mdw addres count" and only if count>1024 (count>0x400).
The first 1024 values shows as expected, but the rest of the values  are wrong.
Name of variable  bytesread" is changed to "wordsread" to reflect what really does.

Change-Id: Iad79393e72da2637551c5ae6e829e3873605c520
Signed-off-by: Salvador <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/527
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-30 15:50:55 +00:00
Mathias K f1c0133321 Add warn message if no flash bank found for the current image address.
Add a warn message to inform the user that something is wrong
with the flash settings or command parameters.

Change-Id: Ia55868b2abf2a17845e51620b0f29b2809d841c2
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/280
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19 19:50:18 +00:00
Mathias K b0cab3d809 gdb_server: Simple close the connection and not exit openocd.
This patch let openocd running and only close the gdb connection
on error.

Change-Id: Ifb88e16834b51207cc4c82210eab904ed8d30b71
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/523
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19 17:11:48 +00:00
Mathias K 0ba480d924 gdb_server: Fix wrong index/length compare.
This patch fix the compare for the list size and the register index.

Change-Id: I36d5e078f57d2a9f7823cfdf0d537762e00f6929
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/516
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19 17:09:13 +00:00
Paul Fertser e26d076190 rtos: add sanity checking for FreeRTOS's quantity of priorities
On operating systems with opportunistic malloc() (e.g. default setting in
GNU/Linux) malloc can sometimes allocate a huge memory region but later the
process will get killed on the first attempt to use this memory, so
checking for malloc's return value is not enough to prevent a crash.

This patch is compile-tested only.

Change-Id: I5e21663115c8e9a0ca9f3d71f7ba4bd09e5c3bb1
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/521
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19 17:07:44 +00:00
Paul Fertser fe11baeebb rtos: fix segfault in FreeRTOS handling
When gdb loads an elf file of a newer or older version of the firmware
being debugged, or when the firmware is not running yet, there's a high
probability of FreeRTOS variables to be read incorrectly, thus leading to
an attempt to allocate an enourmous amount of memory. Without this check
OpenOCD simply crashes and that's mad confusing.

Change-Id: I404a072e886d2d47d9d942cfaea8417eb8bd4a5d
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/520
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-19 17:07:26 +00:00
Alexandre Pereira da Silva 7151398cff stlink: fix alignment build warning
The {read,write}_mem32 interface functions was asking a 32 bits buffer
but they don't need 32 bits alignment.
This will change the interface to a 8 bits buffer to remove the
alignment mismatch warning. This was causing build errors on platforms
with strict aliasing rules.

Change-Id: I338be8df5686f07a64ddb4f17c1bb494af583999
Signed-off-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com>
Reviewed-on: http://openocd.zylin.com/483
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 22:23:43 +00:00
Mathias K 4a29a4a86d gdb_server: sanity check the gdb register size
This patch checks the received register length with the local
configured register length and disconnect on a length missmatch.

Change-Id: I6b112c6b55a9ffb4526f582a384ffa91dc8b792f
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/517
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:57:21 +00:00
Mathias K 5d02d2de43 armv7m: Add a dummy register at the end of the register list.
Signed-off-by: Mathias K <kesmtp@freenet.de>
Change-Id: I0bfad091bd8adabd949fc0a74ef3a08a514eb307
Reviewed-on: http://openocd.zylin.com/519
Reviewed-by: Peter Stuge <peter@stuge.se>
Tested-by: jenkins
2012-03-14 20:55:22 +00:00
Mathias K dbb8de15e3 stm32: Add floating point register read/write.
This patch add floating point register read/write
functionality through the SCS debug interface.

Change-Id: Id20e109dd7cccba00671d55ca8aabeb4936cceb9
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/512
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:55:08 +00:00
Mathias K e2073cc18a stm32: determine all cpu types and use common examine
This patch determine all cpu types and not only
the cortex M3 and the stm32 target use the common
target examine function from the cortex_m sources.

Change-Id: If689dd994b3855284b927fc4b206f420cf32b6c7
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/511
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:35:59 +00:00
Mathias K 6f5b9e9304 flash: Fix flash write algorithm on pflash only devices.
This patch fix the slow flash write issue on pflash only devices.
The Family Reference Manual says:

For devices with FlexNVM: FlexRAM
For devices with program flash only: Programming acceleration RAM

So the acceleration RAM is available for the flash section command on
this device.

Change-Id: If6541a23a4457c5ed8858848a145f35cac63138b
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/509
Tested-by: jenkins
Reviewed-by: Tomas Frydrych <tf+openocd@r-finger.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:33:23 +00:00
Mathias K cfdfe5119d Automatically prepend v1 mass storage protocol.
This patch prepend the v1 mass storage protocol to the command
buffer and simplify the usb read/write handling.


Change-Id: I709602600e93cd1eb5848fa9f4d15659ba85eb35
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/506
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:33:03 +00:00
Drasko DRASKOVIC 8e198e9471 mips: Forced to running state to enable (subsequent) target halt.
Change-Id: I9aff8fb3ac703b50194088dd4e68cec8f9bb2ada
Signed-off-by: Drasko DRASKOVIC <drasko.draskovic@gmail.com>
Reviewed-on: http://openocd.zylin.com/513
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-14 20:31:04 +00:00
Øyvind Harboe 39650e2273 ecosboard: delete bit-rotted eCos code
Change-Id: Iff7943eb9da3f41dcc45492acd0f36cf63b3497f
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/503
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Tested-by: jenkins
2012-03-13 19:11:11 +00:00
Jan Dakinevich 34d1f82c75 jtag: basic support for P&E Micro OSBDM (aka OSJTAG) adapter
This driver provides support for the P&E Micro OSBDM adapter (sometimes
named as OSJTAG), mounted on the Freescale TWRK60N512 bord. Thus, it
provides a quick start when working with this board. The driver doesn't
use BDM commands, but work with OSBDM adapter using only JTAG commands.

Change-Id: Ibc3779538e666e07651d3136431e5d44344f3b07
Signed-off-by: Jan Dakinevich <jan.dakinevich@gmail.com>
Reviewed-on: http://openocd.zylin.com/492
Tested-by: jenkins
Reviewed-by: Tomas Frydrych <tf+openocd@r-finger.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-13 17:04:07 +00:00
Olivier Schonken 736e8bb773 topic: Added support for the SAM3X/A variants
Atmel introduced 7 new Cortex-M3 processors on 2012-02-28
SAM3X4C - 256KB flash
SAM3X4E - 256KB flash
SAM3X8C - 512KB flash
SAM3X8E - 512KB flash
SAM3X8H (Only on dev-kit - not in production...) - 512KB flash
SAM3A4C - 256KB flash
SAM3A8C - 256KB flash

The SAM3X/A processors still suffer from the "6 waitstates needed
to program device" errata.

The CIDR address for the SAM3X/A processors are different from the
other SAM3 processors.  Unfortunately, the chip identification register
is not at a constant address across all of the SAM3 series'. As a
consequence, a simple heuristic is used to find where it's
at... If the contents at the first address is zero, then we know
that the second address is where the chip id register is.
We can deduce this because for those SAM's that have the chip id @ 0x400e0940,
the first address, 0x400e0740, is located in the memory map of the Power
Management Controller (PMC). Furthermore, the address is not used by the PMC.
So when read, the memory controller returns zero.

Another interesting change is the flash bank address for flash bank 1.
It is not fixed at 0x00100000 like the Sam3U.  Bank 1 of the at91sam3a/x
series starts at 0x00080000 + half the total flash size.  Thus for the 256KB
devices Bank 1 is located at 0x000A0000, and for the 512KB devices Bank 1 is
located at 0x000C0000.

The configuration files for the SAM3X/A processors will follow

Change-Id: I6c3a707c00e05d993a2ad1d5a423f23b37ffd553
Signed-off-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-on: http://openocd.zylin.com/505
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-13 17:02:56 +00:00
Spencer Oliver 7d1f9bafc7 target: remove unused declaration
arm7_9_prepare_reset_halt is long since gone and the functionality
is implemented in the target's assert_reset handler.

Change-Id: Ib03c730cb39d68e5e3bb42f92af13daf8074e4e2
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/515
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-03-13 16:32:09 +00:00
Øyvind Harboe ed12a6521f flash: retire unused eCos flash driver
even the AT91EB40a's flash is covered by CFI and nobody ever submitted
any other drivers based on eCos code. It's just possible that this
idea was missing documentation and "marketing", but it's in git if
somebody wants to resurrect it.

Change-Id: I66449aa6e0997301f9d67f28098789bfc891d6e9
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/502
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-03-11 21:14:21 +00:00
Øyvind Harboe 0999bdb830 target_request: fix warning, do not set local variable to value it already has
Change-Id: If29b0efdc326ee1ce4c07ec9d8777744d674f367
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/490
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-03-11 21:12:10 +00:00
Szymon Modzelewski 27b3d9c434 flash: stm32f1x: add a couple missing stm32x_get_flash_reg
Change-Id: I163de2c1bd962e7ea9ca6c741c1c62224c210677
Signed-off-by: Szymon Modzelewski <szmodzelewski@gmail.com>
Reviewed-on: http://openocd.zylin.com/486
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-06 13:33:54 +00:00
Fredrik Hederstierna 5c5af2467b flash: Additional check for NULL in str9xpec enable_turbo
Change-Id: Ifde8783b27c64e4a4bbea180cfa2c86f6a9fe49a
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/496
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-03-06 13:32:48 +00:00
Spencer Oliver dfe8f3a441 stlink: fix incorrect pc console output
target_call_event_callbacks needs to be called after debug entry otherwise
we will get a console pc mismatch.

Change-Id: I278137736d5e85ca9662c306f6ac81336d8eb6cf
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/499
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2012-03-06 13:32:22 +00:00
Attila Kinali 4b4ce4f27e SAM3: Remove unused reference to SUPC registers
The SUPC (Supply Controller) registers are on different base addresses on different
SAM3 chips:
SAM3U: 0x400e1210
SAM3N: 0x400e1410
SAM3S: 0x400e1410

This creates a problem with the sam3_reg_list array which is const, but would need
to be changed at runtime to account for this variability. As this register is not
used anywhere, it's simplest to just remove it.

Change-Id: I987eb371648d826aa6d5e9de18d38c7bb66d6fca
Signed-off-by: Attila Kinali <attila@kinali.ch>
Reviewed-on: http://openocd.zylin.com/495
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-06 13:31:13 +00:00
Attila Kinali 9e137265de SAM3: Add missing architecture names for SAM3S and SAM3N
Change-Id: Ie2177487d4315219eb364db360cb7f88d2720783
Signed-off-by: Attila Kinali <attila@kinali.ch>
Reviewed-on: http://openocd.zylin.com/494
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-03-06 13:30:48 +00:00