openocd.git
10 years agoARMv7-M: make DAP commands verify target is an ARMv7-M
David Brownell [Thu, 4 Feb 2010 22:39:51 +0000 (14:39 -0800)]
ARMv7-M: make DAP commands verify target is an ARMv7-M

Init the ARMv7-M magic number.  Define predicate verifying it.
Use it to resolve a lurking bug/FIXME:  make sure the ARMv7-M
specific DAP ops reject non-ARMv7-M targets.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoDocumentation: mention bug database
David Brownell [Thu, 4 Feb 2010 19:10:15 +0000 (11:10 -0800)]
Documentation: mention bug database

Have the User's Guide and BUG handling notes both reference
the fact that we now have a bug database at SourceForge.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoJLink: reference protocol documentation
David Brownell [Thu, 4 Feb 2010 18:50:24 +0000 (10:50 -0800)]
JLink: reference protocol documentation

Segger publishes some documentation on this protocol;
reference it, so future maintainers can know it exists.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoCMD: duplicate cmd error msg
Spencer Oliver [Thu, 4 Feb 2010 10:33:33 +0000 (10:33 +0000)]
CMD: duplicate cmd error msg

When registering cmds we report duplicate attempts to register a cmd
as a LOG_ERROR.
Some situations need this, such as when registering dual flash banks.
http://www.mail-archive.com/openocd-development@lists.berlios.de/msg11152.html

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoscripts: Phytec/LPC2350 config scripts
Ethan Eade [Thu, 4 Feb 2010 09:25:44 +0000 (10:25 +0100)]
scripts: Phytec/LPC2350 config scripts

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoJTAG: fix bug when no interface connected
Spencer Oliver [Wed, 3 Feb 2010 13:08:42 +0000 (13:08 +0000)]
JTAG: fix bug when no interface connected

 - fix coredump when OpenOCD is started without a jtag interface connected.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoAT91R40008/Ethernut 3 configuration
Harald Kipp [Tue, 2 Feb 2010 19:09:53 +0000 (11:09 -0800)]
AT91R40008/Ethernut 3 configuration

Moved board specific settings from target/at91r40008.cfg to a new
file board/ethernut3.cfg.

Set correct CPUTAPID.  Reset delay increased, see MIC2775 data sheet.
Increased work area size from 16k to 128k.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: User's Guide updates
David Brownell [Tue, 2 Feb 2010 18:53:13 +0000 (10:53 -0800)]
NOR: User's Guide updates

Remove long-obsolete text about "erase_check" affecting "flash info" output.
Move parts of that text to "protect_check", where it's still relevant; and
update the "flash info" description to mention the issue.

(This is still awkward.  It might be best to make "protect_check" mirror
"erase_check" by dumping what it finds, so "flash info" doesn't dump any
potentially-stale cache info.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotcl/str7x: Reset init unlocks the flash
Edgar Grimberg [Tue, 2 Feb 2010 12:17:26 +0000 (13:17 +0100)]
tcl/str7x: Reset init unlocks the flash

For STR7x flash, the device cannot be queried for the protect status.
The solution is to remove the protection on reset init. The driver
also initialises the sector protect field to unprotected.

[dbrownell@users.sourceforge.net: line length shrinkage]

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoflash/str7x: After reset init the flash is unlocked
Edgar Grimberg [Tue, 2 Feb 2010 09:39:52 +0000 (10:39 +0100)]
flash/str7x: After reset init the flash is unlocked

The default state of the STR7 flash after a reset init is unlocked.
The information in the flash driver now reflects this.

The information about the lock status cannot be read from the
flash chip, so the user is informed that flash info might not
contain accurate information.

[dbrownell@users.sourceforge.net: line length shrinkage]

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM semihosting: fix EOF handling with SYS_READ
Nicolas Pitre [Tue, 2 Feb 2010 05:05:42 +0000 (00:05 -0500)]
ARM semihosting: fix EOF handling with SYS_READ

The semihosting interface has a strange convention for read/write where
the unused amount of buffer must be returned.  We failed to return the
total buffer size when the local read() call returned 0.

Signed-off-by: Nicolas Pitre <nico@marvell.com>
10 years agoTest cases ran on v0.4.0-rc1
Edgar Grimberg [Fri, 29 Jan 2010 08:46:11 +0000 (09:46 +0100)]
Test cases ran on v0.4.0-rc1

Test cases ran on v0.4.0-rc1 for a number of targets:
AT91FR40162
LPC2148
SAM7
STR710
STR912

The goal of the testing session was to prove basic functionality of OpenOCD for different targets.

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
10 years agogdb: restore behavior from 0.3.1 for srst_asserted and power_restore
Øyvind Harboe [Sun, 31 Jan 2010 20:02:06 +0000 (21:02 +0100)]
gdb: restore behavior from 0.3.1 for srst_asserted and power_restore

srst_asserted and power_restore can now be overriden to do
nothing. By default they will "reset init" the targets and
halt gdb.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoADIv5: more messaging cleanup, docs
David Brownell [Sun, 31 Jan 2010 22:16:53 +0000 (14:16 -0800)]
ADIv5: more messaging cleanup, docs

When the TAR cache was explicitly invalidated, don't bother
printing it; the actual hardware status is more informative.

Provide some doxygen for the MEM-AP setup routine.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agobuild: fix problems with "struct stat" not being defined under eCos
Øyvind Harboe [Sun, 31 Jan 2010 14:48:14 +0000 (15:48 +0100)]
build: fix problems with "struct stat" not being defined under eCos

Include <sys/stat.h> according to
http://www.opengroup.org/onlinepubs/000095399/functions/stat.html

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agotelnet: fix strage blank spaces at beginning of telnet lines
Øyvind Harboe [Thu, 21 Jan 2010 15:41:54 +0000 (16:41 +0100)]
telnet: fix strage blank spaces at beginning of telnet lines

Sometimes we saw two strange blank spaces at the beginning
of the telnet lines.

progress
  ogress
>

This patch fixes this problem:

progress
progress
>

The code changes are *reasonably* clean, but perhaps it could be
made a bit more elegant, but I didn't want to change things after
I finished diagnosis/testing & submitting the patch.

The problem was that logging can send the text and the newline
separately in two different requests and the telnet code would
incorrectly remove the prompt from the end of a line.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoSubject: ADIv5: fix more diagnostics
David Brownell [Sun, 31 Jan 2010 08:26:21 +0000 (00:26 -0800)]
Subject: ADIv5: fix more diagnostics

If the MEM-AP cache is invalid, don't display it; just report that
invalidity as an error.  (This bug has been observed with "mdw 0 32"
after just a "reset halt".  Some code is being wrongly bypassed...)

If it's valid, display that cache at DEBUG level, not ERROR.  Also,
don't assume it's an AHB-AP; it could be another flavor of MEM-AP.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoADIv5 error checking for Tcl commands
David Brownell [Sun, 31 Jan 2010 06:40:50 +0000 (22:40 -0800)]
ADIv5 error checking for Tcl commands

Reject invalid AP numbers (256+) as Tcl operation parameters.
Shrink one of the overlong lines.

Add my copyright to the ADIv5 code (multiple contributions).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM ADIv5: fix diagnostics for block writes
David Brownell [Sun, 31 Jan 2010 02:08:19 +0000 (18:08 -0800)]
ARM ADIv5: fix diagnostics for block writes

They were reporting "read" errors, not "write" errors.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoADIv5: cleanup, rename swjdp_transaction_endcheck()
David Brownell [Fri, 29 Jan 2010 22:31:19 +0000 (14:31 -0800)]
ADIv5: cleanup, rename swjdp_transaction_endcheck()

Make messages reference "DAP" if they're actually transport-agnostic, or
"JTAG-DP" when they're JTAG-specific.  Saying SWJ-DP is often wrong (on
most Cortex-A8 chips) and is confusing even if correct (since we don't
yet support SWD).

Rename a JTAG-specific routine to jtagdp_transaction_endcheck() to highlight
that it's JTAG-specific, and that identify DAP clients undesirably depending
on JTAG.  (They will all need to change for SWD support.)

Shrink a few overlong lines of code.  Copy a comment from code removed
in a previous patch (for the ARMv7-M "dap baseaddr" command).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARMv7-M: use command handler for "dap baseaddr".
David Brownell [Fri, 29 Jan 2010 22:16:14 +0000 (14:16 -0800)]
ARMv7-M: use command handler for "dap baseaddr".

Make the ARMv7-M DAP code reuse the command handler for "dap baseaddr".
For some reason, this DAP command wasn't converted earlier.

This is a code shrink and simplification; it also removes a needless
transport dependency on JTAG.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: cleanup driver decls
David Brownell [Fri, 29 Jan 2010 21:52:08 +0000 (13:52 -0800)]
NOR: cleanup driver decls

Fix goofy struct indents.  Function names *are* their addresses.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoClang buildfixes
Alex Austin [Fri, 29 Jan 2010 06:41:44 +0000 (00:41 -0600)]
Clang buildfixes

Building with clang took a few very small changes. The change to
helper/log.h is because clang doesn't like an expression where the
result is unused. In helper/system.h, I just defined true and false
since clang doesn't have them builtin.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agodoc clarifications for server flags
David Brownell [Thu, 28 Jan 2010 22:03:29 +0000 (14:03 -0800)]
doc clarifications for server flags

The "-f" is a shortcut for "-c" ... and providing any "-c" options
means the "openocd.cfg" file isn't implicitly used.  Both the User's
Guide and the manual page were weak on these points, which has led
to some confusion.

Also update the manual page to include highlights of the search path
mechanism, including the facts that it exists and that "-s" adds to it.
Stop saying only the current directory is involved; the OpenOCD
script library is quite significant.

(Missing: complete manpage coverage of the search path, including a
FILES section listing all components and saying where the script
library is found.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: reference DPM defn from v6/v7 arch spec
David Brownell [Thu, 28 Jan 2010 21:58:20 +0000 (13:58 -0800)]
ARM: reference DPM defn from v6/v7 arch spec

The term "DPM" is probably not well known ("Device Power Management"?),
so identify its source in the current ARM architecture specification.
It's relevant to ARMv6, ARMv7-A, and ARMv7-R ... but not "M" profiles.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM semihosting: win32 and cygwin fixes
Spencer Oliver [Thu, 28 Jan 2010 21:05:09 +0000 (21:05 +0000)]
ARM semihosting: win32 and cygwin fixes

Cygwin would fail to reopen a previously written file if the mode is
not given.

Simplified converting the open flags and made sure the win32 O_BINARY
bit is set.

Added define for systems that do not support O_BINARY.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoARM semihosting: fix writing to stdout
Spencer Oliver [Wed, 27 Jan 2010 21:20:18 +0000 (21:20 +0000)]
ARM semihosting: fix writing to stdout

SYS_FLEN would be called before a write on a descriptor to check its size.
Currently lseek would fail with -1 when given the stdout/stderr descriptor.
Changing to use fstat seems to be the standard way of handling this.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoCortex-M3: report lockup, and recover
David Brownell [Wed, 27 Jan 2010 21:47:48 +0000 (13:47 -0800)]
Cortex-M3: report lockup, and recover

ARMv7-M defines a "lockup" state that's entered in certain double
fault sequences which can't be recovered from without external help.
OpenOCD has previously ignored this.

Issue a diagnostic saying the chip has locked up, and force exit
from this state by halting the core.  It's not clear this is the
best way to handle lockup; but there should now be less confusion.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM ADIv5: messaging tweaks
David Brownell [Wed, 27 Jan 2010 21:40:05 +0000 (13:40 -0800)]
ARM ADIv5: messaging tweaks

Add space missing after the invalid ACK value.  On init, say
which AP is being used, and don't assume it's an AHP-AP.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoCortex-A8: debug messaging tweaks
David Brownell [Wed, 27 Jan 2010 21:24:21 +0000 (13:24 -0800)]
Cortex-A8: debug messaging tweaks

Make that "TODO" message say what needs to be done.
Say what part of examining failed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agovarious: don't mention wiki
David Brownell [Wed, 27 Jan 2010 02:09:27 +0000 (18:09 -0800)]
various: don't mention wiki

The openfacts.berlios wiki isn't particularly current, and isn't
publicly editable.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agocygwin buildfix
David Brownell [Wed, 27 Jan 2010 01:54:49 +0000 (17:54 -0800)]
cygwin buildfix

isspace() parameter must be an integer, else a 'char' gets
used as an array index (sigh).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoSVF: all content between parentheses is one parameter
simon qian [Sat, 23 Jan 2010 20:08:47 +0000 (04:08 +0800)]
SVF: all content between parentheses is one parameter

More SVF fixes:

 * Treat all content between parentheses as part of the same
   parameter; don't (wrongly) treat whitespace as a delimiter.

 * Use isspace() to catch that whitespace; it's not all single
   spaces, newlines etc are also valid.

 * When parsing bitstrings, strip leading whitespace too.

So for example, these are equivalent and should (now) be OK:

  "TDI( 1234 )"
  "TDI( 1 2 3 4 )"
  "TDI(00 12 34 )"
  "TDI(
   00 12
34)"

[dbrownell@users.sourceforge.net: comment updates; trivial cleanup]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agocore arm11: Silence logs at level 3 if there is no activity
Edgar Grimberg [Mon, 25 Jan 2010 15:34:27 +0000 (16:34 +0100)]
core arm11: Silence logs at level 3 if there is no activity

If the target and openocd are idling, the log should normally
be silent at level 3.  (Given no verbose logging options.)

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoSVF: insert space before '(' and after ')'
simon qian [Sun, 17 Jan 2010 20:56:08 +0000 (04:56 +0800)]
SVF: insert space before '(' and after ')'

See http://forum.sparkfun.com/viewtopic.php?p=90983#90983 for discussion;
basically, the SVF parser wrongly expects "TDI (123)" but the space is
optional and it should accept "TDI(123)" too.

In the same way, "TDI(123)TDO(456)" should work too.

Rather than update the command parsing, this just makes sure the expected
spaces are present.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoEmbeddedICE - fix Feroceon/Dragonite message
David Brownell [Sat, 23 Jan 2010 06:54:39 +0000 (22:54 -0800)]
EmbeddedICE - fix Feroceon/Dragonite message

The breakpoint/watchpoint message was wrong for Feroceon and
Dragonite, which have only one working watchpoint unit.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNEWS updates
David Brownell [Sat, 23 Jan 2010 06:49:42 +0000 (22:49 -0800)]
NEWS updates

Summarize most ARM11 and Cortex-A8 updates as "acting much more
like other ARMs", and mention code sharing.

Clarify a few other points, including support for "reset-assert"
on all ARMs except Cortex-M (which doesn't exactly need it).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM11: fix breakpoints with GDB
David Brownell [Sat, 23 Jan 2010 06:37:15 +0000 (22:37 -0800)]
ARM11: fix breakpoints with GDB

This fixes a bug whereby GDB's breakpoints weren't activated.
The root cause is a confused interface to resume().  Fix by
almost ignoring the "handle breakpoints" parameter; it only
seems related to the case of skipping breakpoint-at-PC.

Update a few coments to clarify what's happening.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoVarious doc/comment updates
David Brownell [Fri, 22 Jan 2010 00:45:00 +0000 (16:45 -0800)]
Various doc/comment updates

Doxygen: don't be needlessly verbose; alphabetically sort members
TODO: add random bits; clarify which manuals are referenced
ARM disassembler: mention a few opcodes that still aren't handled

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoUser's Guide secton on target hardware setup
David Brownell [Fri, 22 Jan 2010 00:15:41 +0000 (16:15 -0800)]
User's Guide secton on target hardware setup

Highlight the needs to properly jumper development boards; to
make the OpenOCD configuration match the jumpering; and to have
a usable "reset-init" method when debugging early boot code.

Specific mention of the "ATX Mode" that seems useful on
many i.MX boards, forcing NAND boot.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoADIv5 header cleanup (+ #defines)
David Brownell [Thu, 21 Jan 2010 21:39:22 +0000 (13:39 -0800)]
ADIv5 header cleanup (+ #defines)

Update the comments about DP registers and some of the bitfields.
Remove inappropriate (and unused) DP_ZERO declaration.

Add some (currently unused) #defines needed for SWD protocol support,
based on previous patches from Andreas Fritiofson and Simon Qian.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: print reason why GDB halts
Øyvind Harboe [Thu, 21 Jan 2010 09:16:42 +0000 (10:16 +0100)]
target: print reason why GDB halts

If GDB halts unexpectedly, print reason: srst assert or power
out detected.

If polling fails, then things are a bit trickier. We do not
want to spam telnet or the log with polling failed messages.
Leave that case be w/a comment in a code for now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agointerface: Changed parport address to LPT1
Edgar Grimberg [Thu, 21 Jan 2010 11:08:19 +0000 (12:08 +0100)]
interface: Changed parport address to LPT1

Changed the parport address to LPT1, since it's the most obvious default value.

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
10 years agotarget: Fixed format problem for mdh
Edgar Grimberg [Thu, 21 Jan 2010 12:42:25 +0000 (13:42 +0100)]
target: Fixed format problem for mdh

Fixed format problem for mdh. It needs to display 4 chars.

Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
10 years agogdb_server: handle stepi/continue packet while target is running with more grace
Øyvind Harboe [Wed, 20 Jan 2010 22:36:57 +0000 (23:36 +0100)]
gdb_server: handle stepi/continue packet while target is running with more grace

Rather than issuing a halt and then stepi/resume, just
wait for target to halt.

Issue a sterner warning via gdb console that any gdb
register changes will be ignored in this case.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoecos: add missing PRId8 definition
Øyvind Harboe [Thu, 21 Jan 2010 07:11:39 +0000 (08:11 +0100)]
ecos: add missing PRId8 definition

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoBUILD: remove cygwin gcc 3.4.4 build warnings
Spencer Oliver [Wed, 20 Jan 2010 23:09:20 +0000 (23:09 +0000)]
BUILD: remove cygwin gcc 3.4.4 build warnings

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoCortex-M3 vector_catch testing support
David Brownell [Wed, 20 Jan 2010 19:07:42 +0000 (11:07 -0800)]
Cortex-M3 vector_catch testing support

The "cm3-ftest.cfg" can be used to verify that OpenOCD handles
certain faults correctly:

 - Test #1: it ignores faults that it wasn't told to catch
 - Test #2: if vector_catch is told to catch, it catches

The "fault.c" generates ASM code to trigger faults, while the
config script loads and runs pre-compiled code.

This covers most, but not all, of the vector_catch options.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoboard configs -- unique names for flash chips
David Brownell [Wed, 20 Jan 2010 18:46:53 +0000 (10:46 -0800)]
board configs -- unique names for flash chips

Don't give the same names to both flash chips on two OMAP boards.

For OSK, enable DCC downloads (removing a warning).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agogdb_server: correctly report flash sector sizes
David Brownell [Wed, 20 Jan 2010 18:43:32 +0000 (10:43 -0800)]
gdb_server: correctly report flash sector sizes

Report each region of same-size sectors separately, instead of
incorrectly reporting that every sector has the same size.

This is a longstanding bug on NOR flash chips with non-uniform
sector sizes.  It was largely hidden by other bugs in flash
handling.  When some of those were recently fixed, this one was
exposed as a regression on str710.

[oyvind.harboe@zylin.com: update the loop to behave on str7 ]

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotcl/target/at91sam3u4e.cfg: changed case in dependent file
Michael Grzeschik [Wed, 20 Jan 2010 18:06:13 +0000 (19:06 +0100)]
tcl/target/at91sam3u4e.cfg: changed case in dependent file

openocd does not start with the target configfile due to the case in the
dependent config file.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotesting: fix str710 test case now builds
Øyvind Harboe [Wed, 20 Jan 2010 14:11:09 +0000 (15:11 +0100)]
testing: fix str710 test case now builds

Make the test case easily adjustable in size. str710
has very peculiar flash sector layout, nice for testing,
but a larget test_rom.elf is required.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoarm7/9: add nags upon reset about options to improve performance
Øyvind Harboe [Wed, 20 Jan 2010 12:04:56 +0000 (13:04 +0100)]
arm7/9: add nags upon reset about options to improve performance

arm7_9 fast_memory_access and working area nags added.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARMV7M: handle bkpt instruction on resume/step
Spencer Oliver [Tue, 19 Jan 2010 21:00:55 +0000 (21:00 +0000)]
ARMV7M: handle bkpt instruction on resume/step

Skip over a bkpt instruction if found on resume/step.
Only software breakpoints known to OpenOCD are currently handled.

So this handles the special case of either a user added bkpt
or library added, eg. semi-hosting support.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoUser's guide: mention lpc2000 checksum issue
David Brownell [Wed, 20 Jan 2010 08:04:17 +0000 (00:04 -0800)]
User's guide: mention lpc2000 checksum issue

Folk almost certainly want to have OpenOCD compute the checksum
when they modify the vector table.  However, that almost guarantees
that "verify_image" will fail.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agogdb_server -- subroutinize memory map logic
David Brownell [Wed, 20 Jan 2010 07:32:54 +0000 (23:32 -0800)]
gdb_server -- subroutinize memory map logic

Put the memory map logic into its own subroutine.
This will make it a bit easier to package bugfixes,
and simplifies the query packet handling.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agogdb_server -- symbol cleanup
David Brownell [Wed, 20 Jan 2010 07:30:36 +0000 (23:30 -0800)]
gdb_server -- symbol cleanup

Make most methods static; net minor object code shrink.
Likewise various data symbols; no net change.
Shrink some overlong lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoupdate win32 script search path
Andreas Fritiofson [Sat, 21 Nov 2009 15:53:31 +0000 (16:53 +0100)]
update win32 script search path

The default script search path on Windows is out of date with
the current layout (from installation and documentation), which
makes the standard script library not be found after a normal

./configure && make && make install

under msys/MinGW. The same should hold true for cygwin native builds
(not verified).

Update search path to ../share/openocd/scripts not ../lib/openocd,
relative to the openocd executable.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: fix diagnostic
David Brownell [Tue, 19 Jan 2010 21:56:33 +0000 (13:56 -0800)]
NOR: fix diagnostic

The "NOR: last_addr also needs correction when checking alignment"
patch omitted a necessary update to the key diagnostic; fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agozy1000: flush jtag buffer before changing speed
Øyvind Harboe [Mon, 18 Jan 2010 20:54:58 +0000 (21:54 +0100)]
zy1000: flush jtag buffer before changing speed

It is conceivable that there could be commands in the
queue when a speed change request comes in. Flush the
hw queue before changing speed. Not observed, found by
inspection.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agozy1000: print out PCB revision upon boot
Øyvind Harboe [Tue, 19 Jan 2010 08:46:49 +0000 (09:46 +0100)]
zy1000: print out PCB revision upon boot

Simplify debugging a bit.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoflash: add error messages upon incorrect arguments to flash iteration
Øyvind Harboe [Tue, 19 Jan 2010 08:47:21 +0000 (09:47 +0100)]
flash: add error messages upon incorrect arguments to flash iteration

According to OpenOCD error handling rules the error is
logged at where it occurs(same site where an exception
would have been thrown).

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agovsllink -- add comment
David Brownell [Mon, 18 Jan 2010 21:17:05 +0000 (13:17 -0800)]
vsllink -- add comment

Previous patch deserved *inline* comment, not just
in git revision history.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agocommands: allow scan_chain command to be executed during config
Øyvind Harboe [Mon, 18 Jan 2010 13:45:08 +0000 (14:45 +0100)]
commands: allow scan_chain command to be executed during config

Adding taps and then dumping them is quite reasonable thing
to do in a config script.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoread target voltage first in vsllink
simon qian [Mon, 18 Jan 2010 07:37:15 +0000 (23:37 -0800)]
read target voltage first in vsllink

The very first command after init command should be "read target voltage".

This is a tweak for the Old Versaloon firmware.  Without this, in most
most cases, it works.   Under Ubuntu9.04, there is a chance that the USB
will fail.  The problem disappears if I read target voltage first.

For the lastest Versaloon firmware, it's OK.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNAND: lpc3180 crashes on LPC3250
richard vegh [Sat, 16 Jan 2010 20:27:45 +0000 (12:27 -0800)]
NAND: lpc3180 crashes on LPC3250

The LPC3180 NAND driver was crashing on some large page chips.
Fix:

 - Crash and related functionality (don't memset too much OOB data)
 - Some debug messages
 - Command handling now works

[dbrownell@users.sourceforge.net: whitespace/linelength/message cleanup]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoADIv5 improved diagnostic
David Brownell [Fri, 15 Jan 2010 21:02:45 +0000 (13:02 -0800)]
ADIv5 improved diagnostic

Don't just complain about an invalid ACK; say what the
value was, to help troubleshooting.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM DPM: disable some nyet-ready breakpoint code
David Brownell [Fri, 15 Jan 2010 20:53:26 +0000 (12:53 -0800)]
ARM DPM: disable some nyet-ready breakpoint code

Until we manage breakpoints at runtime (patches not ready for 0.4)
the only way this code should touch them is to disable them at server
startup (a previous debug session may have left them active).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNEWS: include s3c64xx NAND driver
David Brownell [Fri, 15 Jan 2010 17:36:01 +0000 (09:36 -0800)]
NEWS: include s3c64xx NAND driver

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agojtag.h whitespace/comment cleanup
David Brownell [Thu, 14 Jan 2010 22:38:24 +0000 (14:38 -0800)]
jtag.h whitespace/comment cleanup

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM ADIv5: add comments
David Brownell [Thu, 14 Jan 2010 20:58:39 +0000 (12:58 -0800)]
ARM ADIv5: add comments

Add doxygen and other comments for what's more or less the lowest
level JDAG-DP primitive, to access JTAG_DP_{A,D}PACC registers.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM7/ARM9: improved reset support
David Brownell [Thu, 14 Jan 2010 20:45:58 +0000 (12:45 -0800)]
ARM7/ARM9: improved reset support

Teach most remaining ARM cores how to use the "reset-assert" event.

Same model as elsewhere:  iff a handler is provided for that event,
use that instead of trying to assert SRST (which may be unavailable,
or inappropriate since it resets too much).  Else no change.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agonand flash support for s3c64xx
Peter Korsgaard [Mon, 11 Jan 2010 21:59:29 +0000 (22:59 +0100)]
nand flash support for s3c64xx

Identical to the existing 2412/2443 support except for the base address
and NFCONF value (bit 2 is reserved and should be written as 1 ref UM).

Tested on a s3c6410 board, but controller is identical in 6400/6410
except for 8bit MLC ECC support in 6410 which isn't supported by the
driver.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agostr9x.c: remove optimization when erasing the whole bank
Laurentiu Cocanu [Thu, 14 Jan 2010 12:59:36 +0000 (13:59 +0100)]
str9x.c: remove optimization when erasing the whole bank

Using the erase bank command will cause a time out error. Replacing
this with the erase sector bank will provide a slower but safer and
stable method to erase the flash.

Signed-off-by: Laurentiu Cocanu <laurentiu.cocanu@zylin.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARM7/9 minor cleanups
David Brownell [Thu, 14 Jan 2010 11:16:07 +0000 (03:16 -0800)]
ARM7/9 minor cleanups

Shrink some overlong lines.  Add my 2009 copyright.
Move a declaration to the beginning of its block.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoGDB: change gdb_breakpoint_override to COMMAND_ANY
Spencer Oliver [Thu, 14 Jan 2010 00:58:07 +0000 (00:58 +0000)]
GDB: change gdb_breakpoint_override to COMMAND_ANY

 - enable gdb_breakpoint_override to be used within config script.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoUser's Guide updates
David Brownell [Thu, 14 Jan 2010 07:33:53 +0000 (23:33 -0800)]
User's Guide updates

Capture various bits of useful information that have come up on the
list but haven't yet gotten into the documentation:

 - Watchdog timers firing during JTAG debug need attention;

 - Some chips have special registers to help JTAG debug;

 - Cortex-M3 stepping example with IRQs and maskisr;

 - Clarifications re adaptive clocking:  not all ARMs do it, and
   explain it a bit better.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: add optional "flash erase_address" sector padding
David Brownell [Thu, 14 Jan 2010 07:33:25 +0000 (23:33 -0800)]
NOR: add optional "flash erase_address" sector padding

Add a NOR flash mechanism where erase_address ranges can be padded
out to sector boundaries, triggering a diagnostic:

  > flash erase_address 0x0001f980 16
  address range 0x0001f980 .. 0x0001f98f is not sector-aligned
  Command handler execution failed
  in procedure 'flash' called at file "command.c", line 647
  called at file "command.c", line 361
  >

  > flash erase_address pad 0x0001f980 16
  Adding extra erase range, 0x0001f800 to 0x0001f97f
  Adding extra erase range, 0x0001f990 to 0x0001fbff
  erased address 0x0001f980 (length 16) in 0.095975s (0.163 kb/s)
  >

This addresses what would otherwise be something of a functional
regression.  An earlier version of the interface had a dangerous
problem:  it would silently erase data outside the range it was
told to erase.  Fixing that bug turned up some folk who relied on
that unsafe behavior.  (The classic problem with interface bugs!)
Now they can get that behavior again.  If they really need it,
just specify "pad".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoCortex-M3: improved core exception handling
David Brownell [Wed, 13 Jan 2010 11:16:37 +0000 (03:16 -0800)]
Cortex-M3: improved core exception handling

This updates three aspects of debugger/exception interactions:

 - Save the user's "vector_catch" setting, and restore it after reset.
   Previously, it was obliterated (rather annoyingly) each time.

 - Don't catch BusFault and HardFault exceptions unless the user says
   to do so.  Target firmware may need to handle them.

 - Don't modify SHCSR to prevent escalating BusFault to HardFault.
   Target firmware may expect to handle it as a HardFault.

Those simplifications fix several bugs.  In one annoying case, OpenOCD
would cause the target to lock up on ome faults which triggered after
the debugger disconnected.

NOTE:  a known remaining issue is that OpenOCD can still leave DEMCR
set after an otherwise-clean OpenOCD shutdown.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoarm7/9: enable check that DCC downloads have been enabled
Øyvind Harboe [Mon, 11 Jan 2010 14:30:22 +0000 (15:30 +0100)]
arm7/9: enable check that DCC downloads have been enabled

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoarm7/9: add fn to check if dcc downloads have been enabled
Øyvind Harboe [Mon, 11 Jan 2010 14:29:09 +0000 (15:29 +0100)]
arm7/9: add fn to check if dcc downloads have been enabled

DCC downloads should be enabled for any self repecting
openocd config file for arm7/9. Print out note about
it otherwise.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agotarget: add check_reset hook
Øyvind Harboe [Mon, 11 Jan 2010 14:28:18 +0000 (15:28 +0100)]
target: add check_reset hook

Allow targets to run checks post reset. Used to check
that e.g. DCC downloads have been enabled.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agogdbserver: fix typo that broke read/write watchpoint
Øyvind Harboe [Mon, 11 Jan 2010 08:22:08 +0000 (09:22 +0100)]
gdbserver: fix typo that broke read/write watchpoint

It looks like a bugfix from normal breakpoints was not
copied over.

Do not use clever mathematics and assumptions to convert from
GDB enum for break/watchpoints to OpenOCD enum.

Drop connection upon unknown breakpoint type, this code path
was not really considered by the previous code I think.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agodebug: make logging of commands terser
Øyvind Harboe [Mon, 11 Jan 2010 14:54:52 +0000 (15:54 +0100)]
debug: make logging of commands terser

one line / command instead of one line per argument.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARM: bugfix for "movt" disassembly
David Brownell [Tue, 12 Jan 2010 20:40:39 +0000 (12:40 -0800)]
ARM: bugfix for "movt" disassembly

Use the correct bitfield to specify the register whose
top halfword gets replaced.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoAdded Openmoko USB JTAG interface config file.
Vladimir Zapolskiy [Mon, 11 Jan 2010 14:49:37 +0000 (17:49 +0300)]
Added Openmoko USB JTAG interface config file.

Added interface config file for JTAG/RS232 debug board originally
integrated to Neo 1973 and Neo FreeRunner phones.
Adapter was tested with i.MX31, S3C2410 and AT91SAM9260 processors.

Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
10 years agotarget: return JIM_OK instead of ERROR_OK
Øyvind Harboe [Mon, 11 Jan 2010 13:59:14 +0000 (14:59 +0100)]
target: return JIM_OK instead of ERROR_OK

No change in actual binary as JIM_OK == ERROR_OK,
but JIM_OK is correct here.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoreset: better error messages
Øyvind Harboe [Mon, 11 Jan 2010 11:54:49 +0000 (12:54 +0100)]
reset: better error messages

Use correct tcl syntax to throw exception.

the syntax is "return -code error" not "return -error"

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agocommands: make error messages a bit more terse
Øyvind Harboe [Mon, 11 Jan 2010 11:53:55 +0000 (12:53 +0100)]
commands: make error messages a bit more terse

we don't need to know the build path of command.c when
reading normal user level error messages.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agozy1000: reset bugfix
Øyvind Harboe [Mon, 11 Jan 2010 09:21:56 +0000 (10:21 +0100)]
zy1000: reset bugfix

flush JTAG FIFO before reset. Fixes RCLK problems observed
w/lpc2148, but really fixes a wider range of problems.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoDoxygen file comments
David Brownell [Mon, 11 Jan 2010 08:14:01 +0000 (00:14 -0800)]
Doxygen file comments

Add file comments to a few files.  Make the GDB server use
more conventional (pointer-free) hex digit conversion.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoshutdown: more graceful shutdown
Øyvind Harboe [Fri, 8 Jan 2010 14:30:10 +0000 (15:30 +0100)]
shutdown: more graceful shutdown

Shutdown is not an error condition, do not return error
from main.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agobuild: doxygen build
Spencer Oliver [Sun, 10 Jan 2010 14:30:06 +0000 (14:30 +0000)]
build: doxygen build

 - Fix for building doxygen out of tree

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoFreeBSD build fixes
David Brownell [Sun, 10 Jan 2010 18:06:58 +0000 (10:06 -0800)]
FreeBSD build fixes

Based on notes from Tomek Cedro <tomek.cedro@gmail.com> and
Steve Franks <bahamasfranks@gmail.com>.

In the User's Guide, sort the list of operating systems reported
through Tcl with $ocd_HOSTOS ... and include FreeBSD.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoPresto: doxygen fix
David Brownell [Sun, 10 Jan 2010 06:24:43 +0000 (22:24 -0800)]
Presto: doxygen fix

Newline needed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agojtag/tcl help/usage fixups
David Brownell [Sun, 10 Jan 2010 06:15:57 +0000 (22:15 -0800)]
jtag/tcl help/usage fixups

The usual: expand several helptexts to be more correct and to use
full sentences; make the usage messages use the same EBNF as the
User's Guide; use function names for their addresses.

Also add a comment about that odd jtag_command_handlers_to_move[] thing.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoZY1000 help/usage fixups
David Brownell [Sun, 10 Jan 2010 06:14:08 +0000 (22:14 -0800)]
ZY1000 help/usage fixups

The usual:  same EBNF as in the User's Guide, full sentence helptext,
function names *are* their addresses.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agojtag: presto, parport help/usage updates
David Brownell [Sun, 10 Jan 2010 06:09:08 +0000 (22:09 -0800)]
jtag: presto, parport help/usage updates

Presto: add doxygen file comment.

Parport: note a couple gaps in layout config.

Both: use the uniform EBNF for usage, bugfix helptexts, use function
name as its address not "&name".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agojtag/gw16012 usage/help updates
David Brownell [Sun, 10 Jan 2010 06:05:55 +0000 (22:05 -0800)]
jtag/gw16012 usage/help updates

Use standard BNF.  Improve/correct helptext for its "parport_port"
command.  Function address is just its name.

10 years agoparport (mostly) doc fixes
David Brownell [Sun, 10 Jan 2010 05:56:11 +0000 (21:56 -0800)]
parport (mostly) doc fixes

The "parport_port" commands generally don't *require* a port_number;
they're of the "apply any parameter, then print result" variety.  Update
the User's Guide accordingly.

Some of those commands are intended to be write-once: parport_port,
and parport_cable.  Say so.

Use proper EBNF for the parport_write_on_exit parameter.

Parport address 0xc8b8 is evidently mutant.  Say so in the "parport.cfg"
file, to avoid breaking anyone with that mutant config.  But update the
User's Guide to include a sane example for the LP2 port.

Finally document the "presto_serial" command.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>