Compare commits

...

41 Commits

Author SHA1 Message Date
Freddie Chopin
370d02b857 The openocd-0.6.0 release.
Change-Id: I72eeabfc704d2a979ac0b4492771690631d2300f
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-07 10:24:36 +02: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
8a197f0bbc configure: use consistent help text
Change-Id: I5e1d7c88e9310e6415f3663d7a657f516bd24660
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/803
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-06 19:19:22 +00:00
Spencer Oliver
37f8f0bf9a docs: add user mailing list and irc info
Change-Id: I7000b5ab2967f8dc4cea8983978fce824ea1f98e
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/807
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-09-06 19:19:09 +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
Freddie Chopin
9fbfb6103a Restore -dev tag.
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 09:58:04 +02:00
Freddie Chopin
6d9803ef1d The openocd-0.6.0-rc2 release candidate.
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 08:59:33 +02: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
9a9f745eba Update NEWS
Added some missing items to NEWS file prior to final 0.6.0 release.

Change-Id: I69255c85fa8f4b6f06eae7c56f78072e3ec2d6f8
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/784
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-08-29 06:27:40 +00:00
Freddie Chopin
38e547b9c7 Add JTAG-lock-pick Tiny 2 config files
DISTORTEC's JTAG-lock-pick Tiny 2 is a new interface using FT232HL chip
and layout similar to KT-LINK.

Change-Id: I2831b169cd448ca70397f2dd86c5b749dda3dabf
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/787
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-08-29 06:26: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
2ce4e31bbc cfg: update for target's that support cortex_m AIRCR SYSRESETREQ
If the target supports SYSRESETREQ make sure we use that as the default
if srst is not fitted/configured.

Change-Id: I24c907493134506320e69c1218702930629c1cdc
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/792
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-29 06:24:36 +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
Aurelien Jacobs
939f923927 ftdi: Olimex ARM-USB-TINY validated
Flashing a CFI flash and debugging with gdb work fine.

Change-Id: Ib2578ee6f41c1003968198439033d00d805122f7
Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
Reviewed-on: http://openocd.zylin.com/770
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:49:01 +00:00
Andreas Fritiofson
c58c24c42f configure.ac: Fix misspelled variable
Nothing checks it against 0, so it hasn't caused any problems.

Change-Id: I5e349299c37fb72bab811d78992f6de3731a986a
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/774
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-24 16:48:44 +00:00
Spencer Oliver
aec561c7c6 cfg: remove duplicate Olimex ARM-USB-OCD config
This file is already included as olimex-arm-usb-ocd.cfg.

Change-Id: I0e66977c58e74ac93a0dc3a0c88a5e5af4992f8b
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/780
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-08-14 17:49:50 +00:00
Andrew Karpow
66b9bff3b3 cfg: added new openocd-usb highspeed adapter
The embedded projects shop released a new highspeed version of
the openocd-usb adapter. These configuration files adds support
for it.

Change-Id: I9b23d7889f998712b9041af101e3f0b9aba85b28
Signed-off-by: Andrew Karpow <notandyk@gmail.com>
Reviewed-on: http://openocd.zylin.com/771
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2012-08-09 22:30:48 +00:00
Freddie Chopin
8b344453ed Restore "-dev" tag.
Change-Id: Ibb7669ea73872d75a5c2f32f2264e57b1d0f20c7
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
2012-08-02 18:01:20 +02:00
53 changed files with 496 additions and 233 deletions

3
NEWS
View File

@@ -9,6 +9,8 @@ JTAG Layer:
New Tincantools Flyswatter2 support.
Improved ULINK driver.
Improved RLINK driver.
Support for adapters based on FT232H chips.
New experimental driver for FTDI based adapters, using libusb-1.0 in asynchronous mode.
Boundary Scan:
@@ -17,6 +19,7 @@ Target Layer:
New Cortex-M4 support.
Improved Working area algorithm.
New RTOS support. Currently linux, FreeRTOS, ThreadX and eCos.
Connecting under reset to Cortex-Mx and MIPS chips.
Flash Layer:
New SST39WF1601 support.

View File

@@ -1,5 +1,5 @@
AC_PREREQ(2.60)
AC_INIT([openocd], [0.6.0-rc1],
AC_INIT([openocd], [0.6.0],
[OpenOCD Mailing List <openocd-devel@lists.sourceforge.net>])
AC_CONFIG_SRCDIR([src/openocd.c])
@@ -224,7 +224,7 @@ __EOF__
# In case (1) and (2) we need to know where the package was unpacked.
AC_ARG_WITH(ftd2xx-win32-zipdir,
AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked <default=search>]),
AS_HELP_STRING([--with-ftd2xx-win32-zipdir],[Where (CYGWIN/MINGW) the zip file from ftdichip.com was unpacked (default=search)]),
[
# option present
if test -d $with_ftd2xx_win32_zipdir
@@ -237,7 +237,7 @@ AC_ARG_WITH(ftd2xx-win32-zipdir,
], [true])
AC_ARG_WITH(ftd2xx-linux-tardir,
AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked <default=search>]),
AS_HELP_STRING([--with-ftd2xx-linux-tardir], [Where (Linux/Unix) the tar file from ftdichip.com was unpacked (default=search)]),
[
# Option present
if test $is_win32 = yes ; then
@@ -254,7 +254,7 @@ AC_ARG_WITH(ftd2xx-linux-tardir,
AC_ARG_WITH(ftd2xx-lib,
AS_HELP_STRING([--with-ftd2xx-lib],
[Use static or shared ftd2xx libs on default static]),
[Use static or shared ftd2xx libs (default=static)]),
[
case "$withval" in
static)
@@ -816,7 +816,7 @@ if test $build_remote_bitbang = yes; then
build_bitbang=yes
AC_DEFINE([BUILD_REMOTE_BITBANG], [1], [1 if you want the Remote Bitbang JTAG driver.])
else
AC_DEFINE([BUILD_REMOTE_BITBNAG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
AC_DEFINE([BUILD_REMOTE_BITBANG], [0], [0 if you don't want the Remote Bitbang JTAG driver.])
fi
#-- Deal with MingW/Cygwin FTD2XX issues

View File

@@ -174,7 +174,7 @@ The OpenOCD web site provides the latest public news from the community:
The user's guide you are now reading may not be the latest one
available. A version for more recent code may be available.
Its HTML form is published irregularly at:
Its HTML form is published regularly at:
@uref{http://openocd.sourceforge.net/doc/html/index.html}
@@ -192,6 +192,17 @@ instead of this forum.
@uref{http://forum.sparkfun.com/viewforum.php?f=18}
@section OpenOCD User's Mailing List
The OpenOCD User Mailing List provides the primary means of
communication between users:
@uref{https://lists.sourceforge.net/mailman/listinfo/openocd-user}
@section OpenOCD IRC
Support can also be found on irc:
@uref{irc://irc.freenode.net/openocd}
@node Developers
@chapter OpenOCD Developer Resources

View File

@@ -510,7 +510,7 @@ static int mg_mflash_read_sects(void *buff, uint32_t sect_num, uint32_t sect_cnt
}
static int mg_mflash_do_write_sects(void *buff, uint32_t sect_num, uint32_t sect_cnt,
mg_io_type_cmd cmd)
uint8_t cmd)
{
uint32_t i, address;
int ret;
@@ -770,6 +770,7 @@ COMMAND_HANDLER(mg_write_cmd)
int retval = fileio_size(&fileio, &filesize);
if (retval != ERROR_OK) {
fileio_close(&fileio);
free(buffer);
return retval;
}

View File

@@ -524,8 +524,9 @@ static int lpc3180_write_page(struct nand_device *nand,
target_write_u32(target, 0x200b8010, 0x0);
if (!lpc3180_controller_ready(nand, 1000)) {
LOG_ERROR(
"timeout while waiting for completion of auto encode cycle");
LOG_ERROR("timeout while waiting for completion of auto encode cycle");
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
}
}
@@ -536,11 +537,15 @@ static int lpc3180_write_page(struct nand_device *nand,
retval = nand_read_status(nand, &status);
if (retval != ERROR_OK) {
LOG_ERROR("couldn't read status");
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
}
if (status & NAND_STATUS_FAIL) {
LOG_ERROR("write operation didn't pass, status: 0x%2.2x", status);
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
}
@@ -888,8 +893,9 @@ static int lpc3180_read_page(struct nand_device *nand,
target_write_u32(target, 0x200b8014, 0xaa55aa55);
if (!lpc3180_controller_ready(nand, 1000)) {
LOG_ERROR(
"timeout while waiting for completion of auto decode cycle");
LOG_ERROR("timeout while waiting for completion of auto decode cycle");
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
}
@@ -899,6 +905,8 @@ static int lpc3180_read_page(struct nand_device *nand,
if (mlc_isr & 0x40) {
LOG_ERROR("uncorrectable error detected: 0x%2.2x",
(unsigned)mlc_isr);
free(page_buffer);
free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED;
}

View File

@@ -3018,7 +3018,7 @@ static int sam3_page_read(struct sam3_bank_private *pPrivate, unsigned pagenum,
int r;
adr = pagenum * pPrivate->page_size;
adr += adr + pPrivate->base_address;
adr += pPrivate->base_address;
r = target_read_memory(pPrivate->pChip->target,
adr,
@@ -3126,7 +3126,7 @@ static int sam3_page_write(struct sam3_bank_private *pPrivate, unsigned pagenum,
int r;
adr = pagenum * pPrivate->page_size;
adr += (adr + pPrivate->base_address);
adr += pPrivate->base_address;
/* Get flash mode register value */
r = target_read_u32(pPrivate->pChip->target, pPrivate->controller_address, &fmr);

View File

@@ -897,8 +897,10 @@ static int at91sam7_erase(struct flash_bank *bank, int first, int last)
for (pos = 0; pos < nbytes; pos++)
buffer[pos] = 0xFF;
if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK)
if (at91sam7_write(bank, buffer, bank->sectors[first].offset, nbytes) != ERROR_OK) {
free(buffer);
return ERROR_FLASH_OPERATION_FAILED;
}
free(buffer);
}

View File

@@ -1634,7 +1634,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
struct cfi_spansion_pri_ext *pri_ext = cfi_info->pri_ext;
struct target *target = bank->target;
struct reg_param reg_params[10];
struct arm_algorithm *arm_algo;
void *arm_algo;
struct arm_algorithm armv4_5_algo;
struct armv7m_algorithm armv7m_algo;
struct working_area *source;
@@ -1818,7 +1818,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
if (is_armv7m(target_to_armv7m(target))) { /* Cortex-M3 target */
armv7m_algo.common_magic = ARMV7M_COMMON_MAGIC;
armv7m_algo.core_mode = ARMV7M_MODE_HANDLER;
arm_algo = (struct arm_algorithm *)&armv7m_algo;
arm_algo = &armv7m_algo;
} else if (is_arm(target_to_arm(target))) {
/* All other ARM CPUs have 32 bit instructions */
armv4_5_algo.common_magic = ARM_COMMON_MAGIC;
@@ -1835,7 +1835,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
switch (bank->bus_width) {
case 1:
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
if (is_armv7m(target_to_armv7m(target))) {
LOG_ERROR("Unknown ARM architecture");
return ERROR_FAIL;
}
@@ -1845,19 +1845,19 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
case 2:
/* Check for DQ5 support */
if (cfi_info->status_poll_mask & (1 << 5)) {
if (arm_algo->common_magic == ARM_COMMON_MAGIC) {/* armv4_5 target */
target_code_src = armv4_5_word_16_code;
target_code_size = sizeof(armv4_5_word_16_code);
} else if (arm_algo->common_magic == ARMV7M_COMMON_MAGIC) { /*
if (is_armv7m(target_to_armv7m(target))) { /*
*cortex-m3
*target
**/
target_code_src = armv7m_word_16_code;
target_code_size = sizeof(armv7m_word_16_code);
} else { /* armv4_5 target */
target_code_src = armv4_5_word_16_code;
target_code_size = sizeof(armv4_5_word_16_code);
}
} else {
/* No DQ5 support. Use DQ7 DATA# polling only. */
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
if (is_armv7m(target_to_armv7m(target))) {
LOG_ERROR("Unknown ARM architecture");
return ERROR_FAIL;
}
@@ -1866,7 +1866,7 @@ static int cfi_spansion_write_block(struct flash_bank *bank, uint8_t *buffer,
}
break;
case 4:
if (arm_algo->common_magic != ARM_COMMON_MAGIC) {
if (is_armv7m(target_to_armv7m(target))) {
LOG_ERROR("Unknown ARM architecture");
return ERROR_FAIL;
}

View File

@@ -351,32 +351,75 @@ static int kinetis_write(struct flash_bank *bank, uint8_t *buffer,
if (fallback == 0) {
unsigned prog_section_bytes = kinfo->sector_size >> 8;
for (i = 0; i < count; i += kinfo->sector_size) {
/*
* The largest possible Kinetis "section" is
* 16 bytes. A full Kinetis sector is always
* 256 "section"s.
*/
uint8_t residual_buffer[16];
uint8_t ftfx_fstat;
uint32_t section_count = 256;
uint32_t residual_wc = 0;
/*
* Assume the word count covers an entire
* sector.
*/
wc = kinfo->sector_size / 4;
/*
* If bytes to be programmed are less than the
* full sector, then determine the number of
* full-words to program, and put together the
* residual buffer so that a full "section"
* may always be programmed.
*/
if ((count - i) < kinfo->sector_size) {
wc = count - i;
wc /= 4;
/* number of bytes to program beyond full section */
unsigned residual_bc = (count-i) % prog_section_bytes;
/* number of complete words to copy directly from buffer */
wc = (count - i) / 4;
/* number of total sections to write, including residual */
section_count = DIV_ROUND_UP((count-i), prog_section_bytes);
/* any residual bytes delivers a whole residual section */
residual_wc = (residual_bc ? prog_section_bytes : 0)/4;
/* clear residual buffer then populate residual bytes */
(void) memset(residual_buffer, 0xff, prog_section_bytes);
(void) memcpy(residual_buffer, &buffer[i+4*wc], residual_bc);
}
LOG_DEBUG("write section @ %08X with length %d",
offset + i, wc * 4);
LOG_DEBUG("write section @ %08X with length %d bytes",
offset + i, (count - i));
/* write data to flexram */
result =
target_write_memory(bank->target, 0x14000000, 4, wc,
buffer + i);
/* write data to flexram as whole-words */
result = target_write_memory(bank->target, 0x14000000, 4, wc,
buffer + i);
if (result != ERROR_OK) {
LOG_ERROR("target_write_memory failed");
return result;
}
/* execute section command */
/* write the residual words to the flexram */
if (residual_wc) {
result = target_write_memory(bank->target,
0x14000000+4*wc,
4, residual_wc,
residual_buffer);
if (result != ERROR_OK) {
LOG_ERROR("target_write_memory failed");
return result;
}
}
/* execute section-write command */
w0 = (0x0b << 24) | (bank->base + offset + i);
w1 = ((wc * 4 / prog_section_bytes) << 16);
w1 = section_count << 16;
result = kinetis_ftfx_command(bank, w0, w1, w2, &ftfx_fstat);
@@ -392,7 +435,13 @@ static int kinetis_write(struct flash_bank *bank, uint8_t *buffer,
LOG_DEBUG("write longword @ %08X", offset + i);
w0 = (0x06 << 24) | (bank->base + offset + i);
w1 = buf_get_u32(buffer + offset + i, 0, 32);
if (count - i < 4) {
uint32_t padding = 0xffffffff;
memcpy(&padding, buffer + i, count - i);
w1 = buf_get_u32(&padding, 0, 32);
} else {
w1 = buf_get_u32(buffer + i, 0, 32);
}
result = kinetis_ftfx_command(bank, w0, w1, w2, &ftfx_fstat);
@@ -587,6 +636,8 @@ static int kinetis_read_part_info(struct flash_bank *bank)
LOG_DEBUG("FlexRAM bank %d already configured okay",
kinfo->bank_ordinal);
}
break;
default:
LOG_WARNING("Unknown or inconsistent flash class");
reassign = 1;

View File

@@ -422,7 +422,7 @@ static int lpc2000_iap_call(struct flash_bank *bank,
static int lpc2000_iap_blank_check(struct flash_bank *bank, int first, int last)
{
uint32_t param_table[5];
uint32_t param_table[5] = {0};
uint32_t result_table[4];
int status_code;
int i;
@@ -512,7 +512,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
static int lpc2000_erase(struct flash_bank *bank, int first, int last)
{
struct lpc2000_flash_bank *lpc2000_info = bank->driver_priv;
uint32_t param_table[5];
uint32_t param_table[5] = {0};
uint32_t result_table[4];
int status_code;
@@ -573,7 +573,7 @@ static int lpc2000_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offs
uint32_t bytes_written = 0;
int first_sector = 0;
int last_sector = 0;
uint32_t param_table[5];
uint32_t param_table[5] = {0};
uint32_t result_table[4];
int status_code;
int i;
@@ -772,7 +772,7 @@ static int get_lpc2000_info(struct flash_bank *bank, char *buf, int buf_size)
COMMAND_HANDLER(lpc2000_handle_part_id_command)
{
uint32_t param_table[5];
uint32_t param_table[5] = {0};
uint32_t result_table[4];
int status_code;

View File

@@ -28,6 +28,7 @@
#include "config.h"
#endif
#include <jtag/jtag.h>
#include "imp.h"
#include <target/algorithm.h>
#include <target/mips32.h>
@@ -419,6 +420,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
struct working_area *source;
uint32_t address = bank->base + offset;
struct reg_param reg_params[3];
uint32_t row_size;
int retval = ERROR_OK;
struct pic32mx_flash_bank *pic32mx_info = bank->driver_priv;
@@ -438,12 +440,14 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
pic32mx_flash_write_code[14] = 0x24840080;
pic32mx_flash_write_code[15] = 0x24A50080;
pic32mx_flash_write_code[17] = 0x24C6FFE0;
row_size = 128;
} else {
/* 512 byte row */
pic32mx_flash_write_code[8] = 0x2CD30080;
pic32mx_flash_write_code[14] = 0x24840200;
pic32mx_flash_write_code[15] = 0x24A50200;
pic32mx_flash_write_code[17] = 0x24C6FF80;
row_size = 512;
}
retval = target_write_buffer(target, pic32mx_info->write_algorithm->address,
@@ -463,7 +467,7 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
LOG_WARNING("no large enough working area available, can't do block memory writes");
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
}
};
}
mips32_info.common_magic = MIPS32_COMMON_MAGIC;
mips32_info.isa_mode = MIPS32_ISA_MIPS32;
@@ -472,19 +476,46 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
init_reg_param(&reg_params[1], "a1", 32, PARAM_OUT);
init_reg_param(&reg_params[2], "a2", 32, PARAM_OUT);
int row_offset = offset % row_size;
uint8_t *new_buffer = NULL;
if (row_offset && (count >= (row_size / 4))) {
new_buffer = malloc(buffer_size);
if (new_buffer == NULL) {
LOG_ERROR("Out of memory");
return ERROR_FAIL;
}
memset(new_buffer, 0xff, row_offset);
address -= row_offset;
} else
row_offset = 0;
while (count > 0) {
uint32_t status;
uint32_t thisrun_count = (count > (buffer_size / 4)) ?
(buffer_size / 4) : count;
uint32_t thisrun_count;
retval = target_write_buffer(target, source->address,
thisrun_count * 4, buffer);
if (retval != ERROR_OK)
break;
if (row_offset) {
thisrun_count = (count > ((buffer_size - row_offset) / 4)) ?
((buffer_size - row_offset) / 4) : count;
memcpy(new_buffer + row_offset, buffer, thisrun_count * 4);
retval = target_write_buffer(target, source->address,
row_offset + thisrun_count * 4, new_buffer);
if (retval != ERROR_OK)
break;
} else {
thisrun_count = (count > (buffer_size / 4)) ?
(buffer_size / 4) : count;
retval = target_write_buffer(target, source->address,
thisrun_count * 4, buffer);
if (retval != ERROR_OK)
break;
}
buf_set_u32(reg_params[0].value, 0, 32, Virt2Phys(source->address));
buf_set_u32(reg_params[1].value, 0, 32, Virt2Phys(address));
buf_set_u32(reg_params[2].value, 0, 32, thisrun_count);
buf_set_u32(reg_params[2].value, 0, 32, thisrun_count + row_offset / 4);
retval = target_run_algorithm(target, 0, NULL, 3, reg_params,
pic32mx_info->write_algorithm->address,
@@ -512,6 +543,10 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
buffer += thisrun_count * 4;
address += thisrun_count * 4;
count -= thisrun_count;
if (row_offset) {
address += row_offset;
row_offset = 0;
}
}
target_free_working_area(target, source);
@@ -521,6 +556,8 @@ static int pic32mx_write_block(struct flash_bank *bank, uint8_t *buffer,
destroy_reg_param(&reg_params[1]);
destroy_reg_param(&reg_params[2]);
if (new_buffer != NULL)
free(new_buffer);
return retval;
}
@@ -828,6 +865,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
/* unlock/erase device */
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ASERT_RST);
jtag_add_sleep(200);
mips_ejtag_drscan_8_out(ejtag_info, MCHP_ERASE);

View File

@@ -249,6 +249,14 @@ static int stm32x_erase_options(struct flash_bank *bank)
stm32x_info = bank->driver_priv;
/* stlink is currently does not support 16bit
* read/writes. so we cannot write option bytes */
struct armv7m_common *armv7m = target_to_armv7m(target);
if (armv7m && armv7m->stlink) {
LOG_ERROR("Option bytes currently unsupported for stlink");
return ERROR_FAIL;
}
/* read current options */
stm32x_read_options(bank);

View File

@@ -427,16 +427,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
int retval = ERROR_OK;
static size_t const chunksize = 1024;
uint8_t *chunk = malloc(chunksize);
if (chunk == NULL)
return ERROR_FAIL;
uint8_t *readback = malloc(chunksize);
if (readback == NULL) {
free(chunk);
return ERROR_FAIL;
}
uint8_t *chunk = NULL, *readback = NULL;
if (CMD_ARGC != 3) {
retval = ERROR_COMMAND_SYNTAX_ERROR;
@@ -447,6 +438,16 @@ COMMAND_HANDLER(handle_flash_fill_command)
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], pattern);
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
chunk = malloc(chunksize);
if (chunk == NULL)
return ERROR_FAIL;
readback = malloc(chunksize);
if (readback == NULL) {
free(chunk);
return ERROR_FAIL;
}
if (count == 0)
goto done;

View File

@@ -31,7 +31,7 @@
#include "config.h"
#endif
/* see Embedder-HOWTO.txt in Jim Tcl project hosted on BerliOS*/
/* see Embedded-HOWTO.txt in Jim Tcl project hosted on BerliOS*/
#define JIM_EMBEDDED
/* @todo the inclusion of target.h here is a layering violation */
@@ -152,6 +152,7 @@ static void script_command_args_free(const char **words, unsigned nwords)
free((void *)words[i]);
free(words);
}
static const char **script_command_args_alloc(
unsigned argc, Jim_Obj * const *argv, unsigned *nwords)
{
@@ -244,6 +245,7 @@ static struct command *command_find(struct command *head, const char *name)
}
return NULL;
}
struct command *command_find_in_context(struct command_context *cmd_ctx,
const char *name)
{
@@ -570,6 +572,7 @@ static char *__command_name(struct command *c, char delim, unsigned extra)
}
return name;
}
char *command_name(struct command *c, char delim)
{
return __command_name(c, delim, 0);
@@ -777,7 +780,7 @@ static int jim_capture(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
/* disable polling during capture. This avoids capturing output
* from polling.
*
* This is necessary in order to avoid accidentially getting a non-empty
* This is necessary in order to avoid accidentally getting a non-empty
* string for tcl fn's.
*/
bool save_poll = jtag_poll_get_enabled();
@@ -847,6 +850,7 @@ static void command_help_show_wrap(const char *str, unsigned n, unsigned n2)
n = n2;
}
}
static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
bool show_help, const char *match)
{
@@ -911,6 +915,7 @@ static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
return CALL_COMMAND_HANDLER(command_help_show_list,
c->children, n, show_help, match);
}
COMMAND_HANDLER(handle_help_command)
{
bool full = strcmp(CMD_NAME, "help") == 0;
@@ -927,19 +932,16 @@ COMMAND_HANDLER(handle_help_command)
if (NULL != match) {
char *prev = match;
match = alloc_printf("%s %s", match,
CMD_ARGV[i]);
match = alloc_printf("%s %s", match, CMD_ARGV[i]);
free(prev);
if (NULL == match) {
LOG_ERROR("unable to build "
"search string");
LOG_ERROR("unable to build search string");
return -ENOMEM;
}
} else {
match = alloc_printf("%s", CMD_ARGV[i]);
if (NULL == match) {
LOG_ERROR("unable to build "
"search string");
LOG_ERROR("unable to build search string");
return -ENOMEM;
}
}

View File

@@ -55,43 +55,52 @@ int configuration_output_handler(struct command_context *context, const char *li
static void add_default_dirs(void)
{
#ifdef _WIN32
char strExePath[MAX_PATH];
char *path;
GetModuleFileName(NULL, strExePath, MAX_PATH);
/* Strip executable file name, leaving path */
*strrchr(strExePath, '\\') = '\0';
/* Convert path separators to UNIX style, should work on Windows also. */
for (char *p = strExePath; *p; p++) {
if (*p == '\\')
*p = '/';
}
/* Add the parent of the directory where openocd.exe resides to the
* config script search path.
* Directory layout:
* bin\openocd.exe
* lib\openocd
*
* bin/openocd.exe
* interface/dummy.cfg
* target/at91eb40a.cfg
*/
{
char strExePath[MAX_PATH];
GetModuleFileName(NULL, strExePath, MAX_PATH);
/* Either this code will *always* work or it will SEGFAULT giving
* excellent information on the culprit.
*/
*strrchr(strExePath, '\\') = 0;
strcat(strExePath, "\\..");
add_script_search_dir(strExePath);
path = alloc_printf("%s%s", strExePath, "/..");
if (path) {
add_script_search_dir(path);
free(path);
}
/*
* Add support for the default (as of 20091118) layout when
* using autotools and cygwin/MinGW to build native binary.
* Path separator is converted to UNIX style so that MinGW is
* pleased.
/* Add support for the directory layout resulting from a 'make install'.
*
* bin/openocd.exe
* share/openocd/scripts/interface/dummy.cfg
* share/openocd/scripts/target/at91eb40a.cfg
*/
{
char strExePath[MAX_PATH];
char *p;
GetModuleFileName(NULL, strExePath, MAX_PATH);
*strrchr(strExePath, '\\') = 0;
strcat(strExePath, "/../share/"PACKAGE "/scripts");
for (p = strExePath; *p; p++) {
if (*p == '\\')
*p = '/';
}
add_script_search_dir(strExePath);
path = alloc_printf("%s%s", strExePath, "/../share/" PACKAGE "/scripts");
if (path) {
add_script_search_dir(path);
free(path);
}
/* 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
*/
path = alloc_printf("%s%s", strExePath, "/../scripts");
if (path) {
add_script_search_dir(path);
free(path);
}
#else
/*

View File

@@ -311,7 +311,6 @@ next:
} else
new_cfg = jtag_get_reset_config();
/*
* Display the (now-)current reset mode
*/
@@ -409,8 +408,6 @@ COMMAND_HANDLER(handle_adapter_nsrst_assert_width_command)
return ERROR_OK;
}
COMMAND_HANDLER(handle_adapter_khz_command)
{
if (CMD_ARGC > 1)
@@ -432,9 +429,9 @@ COMMAND_HANDLER(handle_adapter_khz_command)
return retval;
if (cur_speed)
command_print(CMD_CTX, "%d kHz", cur_speed);
command_print(CMD_CTX, "adapter speed: %d kHz", cur_speed);
else
command_print(CMD_CTX, "RCLK - adaptive");
command_print(CMD_CTX, "adapter speed: RCLK - adaptive");
return retval;
}

View File

@@ -389,6 +389,18 @@ static int ftdi_execute_scan(struct jtag_command *cmd)
DEBUG_JTAG_IO("%s type:%d", cmd->cmd.scan->ir_scan ? "IRSCAN" : "DRSCAN",
jtag_scan_type(cmd->cmd.scan));
/* Make sure there are no trailing fields with num_bits == 0, or the logic below will fail. */
while (cmd->cmd.scan->num_fields > 0
&& cmd->cmd.scan->fields[cmd->cmd.scan->num_fields - 1].num_bits == 0) {
cmd->cmd.scan->num_fields--;
LOG_DEBUG("discarding trailing empty field");
}
if (cmd->cmd.scan->num_fields == 0) {
LOG_DEBUG("empty scan, doing nothing");
return retval;
}
if (cmd->cmd.scan->ir_scan) {
if (tap_get_state() != TAP_IRSHIFT)
move_to_state(TAP_IRSHIFT);
@@ -413,7 +425,7 @@ static int ftdi_execute_scan(struct jtag_command *cmd)
if (i == cmd->cmd.scan->num_fields - 1 && tap_get_state() != tap_get_end_state()) {
/* Last field, and we're leaving IRSHIFT/DRSHIFT. Clock last bit during tap
*movement */
* movement. This last field can't have length zero, it was checked above. */
mpsse_clock_data(mpsse_ctx,
field->out_value,
0,

View File

@@ -443,8 +443,8 @@ int mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_off
while (length > 0) {
/* Guarantee buffer space enough for a minimum size transfer */
if (buffer_write_space(ctx) + (length < 8) < (out ? 4 : 3)
|| (in && buffer_read_space(ctx) < 1))
if (buffer_write_space(ctx) + (length < 8) < (out || (!out && !in) ? 4 : 3)
|| (in && buffer_read_space(ctx) < 1))
retval = mpsse_flush(ctx);
if (length < 8) {
@@ -465,8 +465,8 @@ int mpsse_clock_data(struct mpsse_ctx *ctx, const uint8_t *out, unsigned out_off
if (this_bytes > 65536)
this_bytes = 65536;
/* Buffer space limit. We already made sure there's space for the minimum
*transfer. */
if (out && this_bytes + 3 > buffer_write_space(ctx))
* transfer. */
if ((out || (!out && !in)) && this_bytes + 3 > buffer_write_space(ctx))
this_bytes = buffer_write_space(ctx) - 3;
if (in && this_bytes > buffer_read_space(ctx))
this_bytes = buffer_read_space(ctx);

View File

@@ -94,7 +94,10 @@ struct stlink_usb_handle_s {
};
#define STLINK_DEBUG_ERR_OK 0x80
#define STLINK_DEBUG_ERR_FAULT 0x81
#define STLINK_DEBUG_ERR_FAULT 0x81
#define STLINK_SWD_AP_WAIT 0x10
#define STLINK_SWD_DP_WAIT 0x14
#define STLINK_CORE_RUNNING 0x80
#define STLINK_CORE_HALTED 0x81
#define STLINK_CORE_STAT_UNKNOWN -1
@@ -784,6 +787,10 @@ static int stlink_usb_reset(void *handle)
LOG_DEBUG("RESET: 0x%08X", h->databuf[0]);
/* the following is not a error under swd (using hardware srst), so return success */
if (h->databuf[0] == STLINK_SWD_AP_WAIT || h->databuf[0] == STLINK_SWD_DP_WAIT)
return ERROR_OK;
return h->databuf[0] == STLINK_DEBUG_ERR_OK ? ERROR_OK : ERROR_FAIL;
}

View File

@@ -532,6 +532,7 @@ int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
case PAYLOAD_DIRECTION_OUT:
if (ulink_cmd->payload_out != NULL) {
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
free(payload);
return ERROR_FAIL;
} else {
ulink_cmd->payload_out = payload;
@@ -541,6 +542,7 @@ int ulink_allocate_payload(struct ulink_cmd *ulink_cmd, int size,
case PAYLOAD_DIRECTION_IN:
if (ulink_cmd->payload_in_start != NULL) {
LOG_ERROR("BUG: Duplicate payload allocation for OpenULINK command");
free(payload);
return ERROR_FAIL;
} else {
ulink_cmd->payload_in_start = payload;
@@ -896,6 +898,7 @@ int ulink_append_scan_cmd(struct ulink *device, enum scan_type scan_type,
if (scan_size_bits > (58 * 8)) {
LOG_ERROR("BUG: Tried to create CMD_SCAN_IO OpenULINK command with too"
" large payload");
free(cmd);
return ERROR_FAIL;
}
@@ -934,8 +937,10 @@ int ulink_append_scan_cmd(struct ulink *device, enum scan_type scan_type,
break;
}
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
/* Build payload_out that is common to all scan types */
cmd->payload_out[0] = scan_size_bytes & 0xFF;
@@ -993,8 +998,10 @@ int ulink_append_clock_tms_cmd(struct ulink *device, uint8_t count,
/* CMD_CLOCK_TMS has two OUT payload bytes and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = count;
cmd->payload_out[1] = sequence;
@@ -1027,8 +1034,10 @@ int ulink_append_clock_tck_cmd(struct ulink *device, uint16_t count)
/* CMD_CLOCK_TCK has two OUT payload bytes and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = count & 0xff;
cmd->payload_out[1] = (count >> 8) & 0xff;
@@ -1057,8 +1066,10 @@ int ulink_append_get_signals_cmd(struct ulink *device)
/* CMD_GET_SIGNALS has two IN payload bytes */
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_IN);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
return ulink_append_queue(device, cmd);
}
@@ -1094,8 +1105,10 @@ int ulink_append_set_signals_cmd(struct ulink *device, uint8_t low,
/* CMD_SET_SIGNALS has two OUT payload bytes and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = low;
cmd->payload_out[1] = high;
@@ -1124,8 +1137,10 @@ int ulink_append_sleep_cmd(struct ulink *device, uint32_t us)
/* CMD_SLEEP_US has two OUT payload bytes and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 2, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = us & 0x00ff;
cmd->payload_out[1] = (us >> 8) & 0x00ff;
@@ -1159,8 +1174,10 @@ int ulink_append_configure_tck_cmd(struct ulink *device, int delay_scan_in,
/* CMD_CONFIGURE_TCK_FREQ has five OUT payload bytes and zero
* IN payload bytes */
ret = ulink_allocate_payload(cmd, 5, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
if (delay_scan_in < 0)
cmd->payload_out[0] = 0;
@@ -1217,8 +1234,10 @@ int ulink_append_led_cmd(struct ulink *device, uint8_t led_state)
/* CMD_SET_LEDS has one OUT payload byte and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 1, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = led_state;
@@ -1245,8 +1264,10 @@ int ulink_append_test_cmd(struct ulink *device)
/* CMD_TEST has one OUT payload byte and zero IN payload bytes */
ret = ulink_allocate_payload(cmd, 1, PAYLOAD_DIRECTION_OUT);
if (ret != ERROR_OK)
if (ret != ERROR_OK) {
free(cmd);
return ret;
}
cmd->payload_out[0] = 0xAA;
@@ -2136,6 +2157,8 @@ static int ulink_init(void)
ret = ulink_usb_open(&ulink_handle);
if (ret != ERROR_OK) {
LOG_ERROR("Could not open ULINK device");
free(ulink_handle);
ulink_handle = NULL;
return ret;
}
@@ -2157,6 +2180,8 @@ static int ulink_init(void)
ULINK_FIRMWARE_FILE, ULINK_RENUMERATION_DELAY);
if (ret != ERROR_OK) {
LOG_ERROR("Could not download firmware and re-numerate ULINK");
free(ulink_handle);
ulink_handle = NULL;
return ret;
}
} else
@@ -2186,6 +2211,8 @@ static int ulink_init(void)
/* Bulk IN transfer failed -> unrecoverable error condition */
LOG_ERROR("Cannot communicate with ULINK device. Disconnect ULINK from "
"the USB port and re-connect, then re-run OpenOCD");
free(ulink_handle);
ulink_handle = NULL;
return ERROR_FAIL;
}
#ifdef _DEBUG_USB_COMMS_

View File

@@ -75,9 +75,8 @@ int stlink_interface_init_target(struct target *t)
}
if (found == 0) {
LOG_ERROR
("stlink_interface_init_target: target not found: idcode: %x ",
t->tap->idcode);
LOG_ERROR("stlink_interface_init_target: target not found: idcode: 0x%08x",
t->tap->idcode);
return ERROR_FAIL;
}

View File

@@ -259,6 +259,7 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
(uint8_t *)&list_thread_count);
if (retval != ERROR_OK) {
LOG_OUTPUT("Error reading number of threads in FreeRTOS thread list\r\n");
free(list_of_lists);
return retval;
}
@@ -273,8 +274,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
param->pointer_width,
(uint8_t *)&list_elem_ptr);
if (retval != ERROR_OK) {
LOG_OUTPUT(
"Error reading first thread item location in FreeRTOS thread list\r\n");
LOG_OUTPUT("Error reading first thread item location in FreeRTOS thread list\r\n");
free(list_of_lists);
return retval;
}
@@ -288,8 +289,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
param->pointer_width,
(uint8_t *)&(rtos->thread_details[tasks_found].threadid));
if (retval != ERROR_OK) {
LOG_OUTPUT(
"Error reading thread list item object in FreeRTOS thread list\r\n");
LOG_OUTPUT("Error reading thread list item object in FreeRTOS thread list\r\n");
free(list_of_lists);
return retval;
}
@@ -304,8 +305,8 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
FREERTOS_THREAD_NAME_STR_SIZE,
(uint8_t *)&tmp_str);
if (retval != ERROR_OK) {
LOG_OUTPUT(
"Error reading first thread item location in FreeRTOS thread list\r\n");
LOG_OUTPUT("Error reading first thread item location in FreeRTOS thread list\r\n");
free(list_of_lists);
return retval;
}
tmp_str[FREERTOS_THREAD_NAME_STR_SIZE-1] = '\x00';
@@ -338,12 +339,13 @@ static int FreeRTOS_update_threads(struct rtos *rtos)
param->pointer_width,
(uint8_t *)&list_elem_ptr);
if (retval != ERROR_OK) {
LOG_OUTPUT(
"Error reading next thread item location in FreeRTOS thread list\r\n");
LOG_OUTPUT("Error reading next thread item location in FreeRTOS thread list\r\n");
free(list_of_lists);
return retval;
}
}
}
free(list_of_lists);
rtos->thread_count = tasks_found;
return 0;

View File

@@ -420,6 +420,8 @@ int fill_task(struct target *target, struct threads *t)
} else
LOG_ERROR("fill task: unable to read memory");
free(buffer);
return retval;
}
@@ -494,8 +496,10 @@ int get_current(struct target *target, int create)
int retval;
if (target_get_gdb_reg_list(head->target, &reg_list,
&reg_list_size) != ERROR_OK)
&reg_list_size) != ERROR_OK) {
free(buffer);
return ERROR_TARGET_FAILURE;
}
if (!reg_list[13]->valid)
reg_list[13]->type->get(reg_list[13]);
@@ -550,6 +554,8 @@ int get_current(struct target *target, int create)
head = head->next;
}
free(buffer);
return ERROR_OK;
}
@@ -615,6 +621,7 @@ retry:
(uint8_t *) registers);
if (retval != ERROR_OK) {
free(buffer);
LOG_ERROR("cpu_context: unable to read memory\n");
return context;
}
@@ -643,6 +650,8 @@ retry:
if (*thread_info_addr_old == 0xdeadbeef)
*thread_info_addr_old = thread_info_addr_update;
free(buffer);
return context;
}
@@ -655,11 +664,13 @@ uint32_t next_task(struct target *target, struct threads *t)
if (retval == ERROR_OK) {
uint32_t val = get_buffer(target, buffer);
val = val - NEXT;
return val;
free(buffer);
return val;
} else
LOG_ERROR("next task: unable to read memory");
free(buffer);
return 0;
}
@@ -778,6 +789,7 @@ int linux_get_tasks(struct target *target, int context)
retval = get_name(target, t);
if (loop > MAX_THREADS) {
free(t);
LOG_INFO("more than %d threads !!", MAX_THREADS);
return ERROR_FAIL;
}
@@ -829,6 +841,7 @@ int linux_get_tasks(struct target *target, int context)
(timeval_ms() - start) / linux_os->threadid_count);
LOG_INFO("threadid count %d", linux_os->threadid_count);
free(t);
return ERROR_OK;
}
@@ -973,7 +986,7 @@ error_handling:
#ifndef PID_CHECK
error_handling:
free(t);
LOG_ERROR("unable toread pid");
LOG_ERROR("unable to read pid");
return;
#endif
@@ -1454,7 +1467,7 @@ static int linux_thread_packet(struct connection *connection, char *packet,
}
}
/* if a packet handler returned an error, exit input loop */
/* if a packet handler returned an error, exit input loop */
if (retval != ERROR_OK)
return retval;
}

View File

@@ -169,6 +169,8 @@ int rtos_qsymbol(struct connection *connection, char *packet, int packet_size)
if (target->rtos->symbols[symbol_num].symbol_name == NULL) {
LOG_OUTPUT("ERROR: unknown symbol\r\n");
gdb_put_packet(connection, "OK", 2);
free(hex_name_str);
free(name_str);
return ERROR_OK;
}

View File

@@ -1138,6 +1138,7 @@ static int gdb_set_register_packet(struct connection *connection,
if ((unsigned int)chars != strlen(separator + 1)) {
LOG_ERROR("gdb sent a packet with wrong register size");
free(bin_buf);
return ERROR_SERVER_REMOTE_CLOSED;
}

View File

@@ -635,6 +635,10 @@ SERVER_PIPE_COMMAND()
break;
case 1:
{
if (CMD_CTX->mode == COMMAND_EXEC) {
LOG_WARNING("unable to change server port after init");
return ERROR_COMMAND_ARGUMENT_INVALID;
}
const char *t = strdup(CMD_ARGV[0]);
free((void *)*out);
*out = t;

View File

@@ -237,8 +237,6 @@ int arm_blank_check_memory(struct target *target,
void arm_set_cpsr(struct arm *arm, uint32_t cpsr);
struct reg *arm_reg_current(struct arm *arm, unsigned regnum);
void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip);
extern struct reg arm_gdb_dummy_fp_reg;
extern struct reg arm_gdb_dummy_fps_reg;

View File

@@ -2659,6 +2659,46 @@ int arm7_9_check_reset(struct target *target)
return ERROR_OK;
}
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in,
jtag_callback_data_t i_size, jtag_callback_data_t i_be,
jtag_callback_data_t i_flip)
{
uint8_t *in = (uint8_t *)pu8_in;
int size = (int)i_size;
int be = (int)i_be;
int flip = (int)i_flip;
uint32_t readback;
switch (size) {
case 4:
readback = le_to_h_u32(in);
if (flip)
readback = flip_u32(readback, 32);
if (be)
h_u32_to_be(in, readback);
else
h_u32_to_le(in, readback);
break;
case 2:
readback = le_to_h_u16(in);
if (flip)
readback = flip_u32(readback, 16);
if (be)
h_u16_to_be(in, readback & 0xffff);
else
h_u16_to_le(in, readback & 0xffff);
break;
case 1:
readback = *in;
if (flip)
readback = flip_u32(readback, 8);
*in = readback & 0xff;
break;
}
return ERROR_OK;
}
COMMAND_HANDLER(handle_arm7_9_dbgrq_command)
{
struct target *target = get_current_target(CMD_CTX);

View File

@@ -172,4 +172,8 @@ int arm7_9_init_arch_info(struct target *target, struct arm7_9_common *arm7_9);
int arm7_9_examine(struct target *target);
int arm7_9_check_reset(struct target *target);
int arm7_9_endianness_callback(jtag_callback_data_t pu8_in,
jtag_callback_data_t i_size, jtag_callback_data_t i_be,
jtag_callback_data_t i_flip);
#endif /* ARM7_9_COMMON_H */

View File

@@ -168,40 +168,6 @@ static int arm7tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
return ERROR_OK;
}
void arm_endianness(uint8_t *tmp, void *in, int size, int be, int flip)
{
uint32_t readback = le_to_h_u32(tmp);
if (flip)
readback = flip_u32(readback, 32);
switch (size) {
case 4:
if (be)
h_u32_to_be(((uint8_t *)in), readback);
else
h_u32_to_le(((uint8_t *)in), readback);
break;
case 2:
if (be)
h_u16_to_be(((uint8_t *)in), readback & 0xffff);
else
h_u16_to_le(((uint8_t *)in), readback & 0xffff);
break;
case 1:
*((uint8_t *)in) = readback & 0xff;
break;
}
}
static int arm7endianness(jtag_callback_data_t arg,
jtag_callback_data_t size, jtag_callback_data_t be,
jtag_callback_data_t captured)
{
uint8_t *in = (uint8_t *)arg;
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 1);
return ERROR_OK;
}
/* clock the target, and read the databus
* the *in pointer points to a buffer where elements of 'size' bytes
* are stored in big (be == 1) or little (be == 0) endianness
@@ -210,7 +176,7 @@ static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
void *in, int size, int be)
{
int retval = ERROR_OK;
struct scan_field fields[2];
struct scan_field fields[3];
retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
if (retval != ERROR_OK)
@@ -223,17 +189,29 @@ static int arm7tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
fields[0].out_value = NULL;
fields[0].in_value = NULL;
fields[1].num_bits = size * 8;
fields[1].out_value = NULL;
fields[1].in_value = in;
if (size == 4) {
fields[1].num_bits = 32;
fields[1].out_value = NULL;
fields[1].in_value = in;
} else {
/* Discard irrelevant bits of the scan, making sure we don't write more
* than size bytes to in */
fields[1].num_bits = 32 - size * 8;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
fields[2].num_bits = size * 8;
fields[2].out_value = NULL;
fields[2].in_value = in;
}
jtag_add_callback4(arm7endianness,
jtag_add_dr_scan(jtag_info->tap, size == 4 ? 2 : 3, fields, TAP_DRPAUSE);
jtag_add_callback4(arm7_9_endianness_callback,
(jtag_callback_data_t)in,
(jtag_callback_data_t)size,
(jtag_callback_data_t)be,
(jtag_callback_data_t)in);
(jtag_callback_data_t)1);
jtag_add_runtest(0, TAP_DRPAUSE);

View File

@@ -244,16 +244,6 @@ int arm9tdmi_clock_data_in(struct arm_jtag *jtag_info, uint32_t *in)
return ERROR_OK;
}
static int arm9endianness(jtag_callback_data_t arg,
jtag_callback_data_t size, jtag_callback_data_t be,
jtag_callback_data_t captured)
{
uint8_t *in = (uint8_t *)arg;
arm_endianness((uint8_t *)captured, in, (int)size, (int)be, 0);
return ERROR_OK;
}
/* clock the target, and read the databus
* the *in pointer points to a buffer where elements of 'size' bytes
* are stored in big (be == 1) or little (be == 0) endianness
@@ -262,7 +252,7 @@ int arm9tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
void *in, int size, int be)
{
int retval = ERROR_OK;
struct scan_field fields[3];
struct scan_field fields[2];
retval = arm_jtag_scann(jtag_info, 0x1, TAP_DRPAUSE);
if (retval != ERROR_OK)
@@ -272,25 +262,33 @@ int arm9tdmi_clock_data_in_endianness(struct arm_jtag *jtag_info,
if (retval != ERROR_OK)
return retval;
fields[0].num_bits = size * 8;
fields[0].out_value = NULL;
fields[0].in_value = in;
if (size == 4) {
fields[0].num_bits = 32;
fields[0].out_value = NULL;
fields[0].in_value = in;
fields[1].num_bits = 3;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
fields[1].num_bits = 3 + 32;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
} else {
/* Discard irrelevant bits of the scan, making sure we don't write more
* than size bytes to in */
fields[0].num_bits = size * 8;
fields[0].out_value = NULL;
fields[0].in_value = in;
fields[2].num_bits = 32;
fields[2].out_value = NULL;
fields[2].in_value = NULL;
fields[1].num_bits = 3 + 32 + 32 - size * 8;
fields[1].out_value = NULL;
fields[1].in_value = NULL;
}
jtag_add_dr_scan(jtag_info->tap, 3, fields, TAP_DRPAUSE);
jtag_add_dr_scan(jtag_info->tap, 2, fields, TAP_DRPAUSE);
jtag_add_callback4(arm9endianness,
jtag_add_callback4(arm7_9_endianness_callback,
(jtag_callback_data_t)in,
(jtag_callback_data_t)size,
(jtag_callback_data_t)be,
(jtag_callback_data_t)in);
(jtag_callback_data_t)0);
jtag_add_runtest(0, TAP_DRPAUSE);

View File

@@ -1265,6 +1265,8 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap,
retval = mem_ap_read_atomic_u32(dap,
(component_base & 0xfffff000) | 0xfcc,
&devtype);
if (retval != ERROR_OK)
return retval;
if ((devtype & 0xff) == type) {
*addr = component_base;
retval = ERROR_OK;

View File

@@ -2890,7 +2890,7 @@ static int t2ev_cond_b(uint32_t opcode, uint32_t address,
offset = opcode & 0x7ff;
offset |= (opcode & 0x003f0000) >> 5;
if (opcode & (1 << 26)) {
offset |= 0xffff << 19;
offset |= 0x1fff << 19;
if ((opcode & (1 << 11)) == 0)
b17 = 0;
if ((opcode & (1 << 13)) == 0)

View File

@@ -524,7 +524,7 @@ static int arm_simulate_step_core(struct target *target,
switch (instruction.info.load_store_multiple.addressing_mode) {
case 0: /* Increment after */
Rn = Rn;
/* Rn = Rn; */
break;
case 1: /* Increment before */
Rn = Rn + 4;
@@ -604,7 +604,7 @@ static int arm_simulate_step_core(struct target *target,
switch (instruction.info.load_store_multiple.addressing_mode) {
case 0: /* Increment after */
Rn = Rn;
/* Rn = Rn; */
break;
case 1: /* Increment before */
Rn = Rn + 4;

View File

@@ -387,7 +387,7 @@ static int armv7a_flush_all_data(struct target *target)
head = target->head;
while (head != (struct target_list *)NULL) {
curr = head->target;
if ((curr->state == TARGET_HALTED)) {
if (curr->state == TARGET_HALTED) {
LOG_INFO("Wait flushing data l1 on core %d", curr->coreid);
retval = _armv7a_flush_all_data(curr);
}

View File

@@ -1025,7 +1025,7 @@ static int cortex_m3_assert_reset(struct target *target)
if (reset_config == CORTEX_M3_RESET_VECTRESET) {
LOG_WARNING("Only resetting the Cortex-M3 core, use a reset-init event "
"handler to reset any peripherals");
"handler to reset any peripherals or configure hardware srst support.");
}
{

View File

@@ -125,9 +125,9 @@ static int wait_for_pracc_rw(struct mips_ejtag *ejtag_info, uint32_t *ctrl)
/* wait for the PrAcc to become "1" */
mips_ejtag_set_instr(ejtag_info, EJTAG_INST_CONTROL);
ejtag_ctrl = ejtag_info->ejtag_ctrl;
while (1) {
ejtag_ctrl = ejtag_info->ejtag_ctrl;
retval = mips_ejtag_drscan_32(ejtag_info, &ejtag_ctrl);
if (retval != ERROR_OK)
return retval;

View File

@@ -443,7 +443,7 @@ static int stm32_stlink_assert_reset(struct target *target)
}
if (use_srst_fallback) {
/* stlink v1 api does support hardware srst, so we use a software reset fallback */
/* stlink v1 api does not support hardware srst, so we use a software reset fallback */
stlink_if->layout->api->write_debug_reg(stlink_if->fd, NVIC_AIRCR, AIRCR_VECTKEY | AIRCR_SYSRESETREQ);
}

View File

@@ -1405,7 +1405,6 @@ static void target_split_working_area(struct working_area *area, uint32_t size)
new_wa->size = area->size - size;
new_wa->address = area->address + size;
new_wa->backup = NULL;
new_wa->user = NULL;
new_wa->free = true;
area->next = new_wa;
@@ -1494,7 +1493,6 @@ int target_alloc_working_area_try(struct target *target, uint32_t size, struct w
new_wa->size = target->working_area_size & ~3UL; /* 4-byte align */
new_wa->address = target->working_area;
new_wa->backup = NULL;
new_wa->user = NULL;
new_wa->free = true;
}
@@ -1538,9 +1536,6 @@ int target_alloc_working_area_try(struct target *target, uint32_t size, struct w
c->free = false;
*area = c;
/* user pointer */
c->user = area;
print_wa_layout(target);
return ERROR_OK;
@@ -1591,13 +1586,6 @@ static int target_free_working_area_restore(struct target *target, struct workin
LOG_DEBUG("freed %"PRIu32" bytes of working area at address 0x%08"PRIx32,
area->size, area->address);
/* mark user pointer invalid */
/* TODO: Is this really safe? It points to some previous caller's memory.
* How could we know that the area pointer is still in that place and not
* some other vital data? What's the purpose of this, anyway? */
*area->user = NULL;
area->user = NULL;
target_merge_working_areas(target);
print_wa_layout(target);
@@ -1625,8 +1613,6 @@ static void target_free_all_working_areas_restore(struct target *target, int res
if (restore)
target_restore_working_area(target, c);
c->free = true;
*c->user = NULL; /* Same as above */
c->user = NULL;
}
c = c->next;
}

View File

@@ -95,7 +95,6 @@ struct working_area {
uint32_t size;
bool free;
uint8_t *backup;
struct working_area **user;
struct working_area *next;
};

View File

@@ -1,11 +0,0 @@
#
# Olimex ARM-USB-OCD
#
# http://www.olimex.com/dev/arm-usb-ocd.html
#
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003

View File

@@ -0,0 +1,14 @@
#
# DISTORTEC JTAG-lock-pick Tiny 2
#
# http://www.distortec.com
#
interface ftdi
ftdi_device_desc "JTAG-lock-pick Tiny 2"
ftdi_vid_pid 0x0403 0x8220
ftdi_layout_init 0x8c28 0xff3b
ftdi_layout_signal nTRST -data 0x0100 -noe 0x0400
ftdi_layout_signal nSRST -data 0x0200 -noe 0x0800
ftdi_layout_signal LED -ndata 0x8000

View File

@@ -4,12 +4,6 @@
# http://www.olimex.com/dev/arm-usb-tiny.html
#
echo "WARNING!"
echo "This file was not tested with real interface, but is assumed to work as this"
echo "interface uses the same layout as configs that were verified. Please report your"
echo "experience with this file to openocd-devel mailing list, so it could be marked"
echo "as working or fixed."
interface ftdi
ftdi_device_desc "Olimex OpenOCD JTAG TINY"
ftdi_vid_pid 0x15ba 0x0004

View File

@@ -0,0 +1,13 @@
#
# embedded projects openocd usb adapter v3
#
# http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=14
#
interface ftdi
ftdi_device_desc "Dual RS232-HS"
ftdi_vid_pid 0x0403 0x6010
ftdi_layout_init 0x0508 0x0f1b
ftdi_layout_signal nTRST -data 0x0200 -noe 0x0100
ftdi_layout_signal nSRST -data 0x0800 -noe 0x0400

View File

@@ -0,0 +1,10 @@
#
# DISTORTEC JTAG-lock-pick Tiny 2
#
# http://www.distortec.com
#
interface ft2232
ft2232_device_desc "JTAG-lock-pick Tiny 2"
ft2232_layout ktlink
ft2232_vid_pid 0x0403 0x8220

View File

@@ -0,0 +1,11 @@
#
# embedded projects openocd usb adapter v3
#
# http://shop.embedded-projects.net/index.php?module=artikel&action=artikel&id=14
#
interface ft2232
ft2232_vid_pid 0x0403 0x6010
ft2232_device_desc "Dual RS232-HS"
ft2232_layout "oocdlink"
ft2232_latency 2

View File

@@ -66,3 +66,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-ar
$_TARGETNAME configure -event gdb-flash-erase-start {
halt
}
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq

View File

@@ -22,3 +22,8 @@ target create $_TARGETNAME cortex_m3 -endian little -chain-position $_TARGETNAME
set _FLASHNAME $_CHIPNAME.flash
flash bank flash0 at91sam3 0x00400000 0 0 0 $_TARGETNAME
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq

View File

@@ -43,3 +43,7 @@ $_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size 16384 -work-ar
$_TARGETNAME configure -event gdb-flash-erase-start {
halt
}
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq

View File

@@ -33,3 +33,7 @@ target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
$_CHIPNAME.cpu configure -event examine-end { puts "END..." ; }
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq

View File

@@ -33,3 +33,7 @@ target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu
$_CHIPNAME.cpu configure -event examine-start { puts "START..." ; }
$_CHIPNAME.cpu configure -event examine-end { puts "END..." ; }
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq

View File

@@ -91,3 +91,7 @@ $_TARGETNAME configure -event reset-init {
mww 0x400FC040 0x01
}
# if srst is not fitted use VECTRESET to
# perform a soft reset - SYSRESETREQ is not supported
cortex_m3 reset_config vectreset

View File

@@ -42,3 +42,7 @@ jtag newtap $_CHIPNAME m0 -irlen 4 -ircapture 0x1 -irmask 0xf \
target create $_CHIPNAME.m4 cortex_m3 -chain-position $_CHIPNAME.m4
target create $_CHIPNAME.m0 cortex_m3 -chain-position $_CHIPNAME.m0
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m3 reset_config sysresetreq