openocd.git
10 years agoETM trigger_percent becomes an ETB command
David Brownell [Sat, 19 Dec 2009 21:06:46 +0000 (13:06 -0800)]
ETM trigger_percent becomes an ETB command

This command was misplaced; it's not generic to all traceport drivers,
only the ETB supports this kind of configuration.  So move it, and
update the relevant documentation.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNEWS: mention libftdi 0.17
David Brownell [Sat, 19 Dec 2009 21:01:30 +0000 (13:01 -0800)]
NEWS: mention libftdi 0.17

10 years agoNOR FLASH: only erase/unlock whole sectors
David Brownell [Fri, 18 Dec 2009 18:16:52 +0000 (10:16 -0800)]
NOR FLASH: only erase/unlock whole sectors

Much to my surprise, I observed a "flash erase_address ..."
command erasing data which I said should not be erased.

The issue turns out to be generic NOR flash code which was
silently, and rather dangerously, morphing partial-sector
references into unrequested whole-sector ones.

This patch removes that low-level morphing.  If desired, it
can and should be done in higher level code.  (We might need
to fix some stuff in the GDB server code.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoSubject: flash fill[bwh] should use bulk i/o
David Brownell [Fri, 18 Dec 2009 18:09:35 +0000 (10:09 -0800)]
Subject: flash fill[bwh] should use bulk i/o

It's currently allocating a big buffer but writing it out in
units of sizeof(host's pointer) ... sub-optimal.

Plus fix a couple minor coding style goofs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: fix min buffer length checks
David Brownell [Fri, 18 Dec 2009 17:59:40 +0000 (09:59 -0800)]
stellaris: fix min buffer length checks

Word count == size/4; cope.  And increase buf_min so it's large
enough to cover the overhead in my tests.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoXScale: better {read,write}_phys()
David Brownell [Fri, 18 Dec 2009 17:53:59 +0000 (09:53 -0800)]
XScale: better {read,write}_phys()

We can actually do the right thing if the MMU is off; save
the error message for the phys-but-MMU-enabled path, which
is what isn't yet supported.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agodsp563xx: cygwin build fixes
David Brownell [Fri, 18 Dec 2009 11:08:49 +0000 (03:08 -0800)]
dsp563xx: cygwin build fixes

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: update bulk flash writes
David Brownell [Fri, 18 Dec 2009 09:33:19 +0000 (01:33 -0800)]
stellaris: update bulk flash writes

Try to right-size the SRAM buffers, by not:
 - using them for very small writes
 - giving up when a large buffer isn't available
 - allocating buffers much larger than their data

Also don't:
 - bother loading the code unless we allocate the writebuffer too
 - be so verbose with messaging:
    * be more concise
    * reduce importance (e.g. DEBUG not WARNING)
    * remove duplication

The minimum buffer size is something of a guess.  It's eight
times smaller than before, almost the same size as the code
being downloaded.  It probably deserves some tuning.

Also, note an erratum affecting flash protection on some chips;
and narrow many over-wide lines affected by the above changes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNAND write data page refactoring.
Dean Glazeski [Fri, 18 Dec 2009 03:02:40 +0000 (21:02 -0600)]
NAND write data page refactoring.

Refactored the write page raw function into two new functions
for writing data to a NAND device and then another function to
finish up a write to a NAND device.  This includes some new
updates to introduce more error checking to existing code.

[dbrownell@users.sourceforge.net: fix fault handling, whitespace]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNAND read data page refactor.
Dean Glazeski [Fri, 18 Dec 2009 03:02:39 +0000 (21:02 -0600)]
NAND read data page refactor.

Added a new function to encapsulate reading a page of data from
a NAND device using either the read_block_data function of a NAND
controller or to use direct reading of data from the NAND device.

This also adds some performance enhancements and uses the read_data
function if the read_block_data function fails safely (because it
can't allocate a buffer in the working area).

[dbrownell@users.sourceforge.net: fix fault handling, whitespace]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget.cfg: update to use new flash configuration syntax
Spencer Oliver [Thu, 17 Dec 2009 10:53:09 +0000 (10:53 +0000)]
target.cfg: update to use new flash configuration syntax

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoRemove duplicate Olimex-"tiny" interface
David Brownell [Wed, 16 Dec 2009 22:21:06 +0000 (14:21 -0800)]
Remove duplicate Olimex-"tiny" interface

We already have tcl/interface/olimex-jtag-tiny.cfg and
don't need a clone of it.

10 years agoJTAG: shrink "scan_chain" output
David Brownell [Wed, 16 Dec 2009 22:19:44 +0000 (14:19 -0800)]
JTAG: shrink "scan_chain" output

Tweak the "scan_chain" output by removing column separators.  Also
remove the "current instruction" state ... which changes constantly.

Now its style resembles the "targets" output, and can even fit on
one line in standard terminals and in the PDF docs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: comments
David Brownell [Wed, 16 Dec 2009 22:17:31 +0000 (14:17 -0800)]
stellaris: comments

Someday revisit various issues:  Tempest parts support writing
more than one word at a time; for some target firmware it might
be necessary to save and restore flash IRQ configuration.  (The
safest policy is likely to always reset after flash updates.)

Plus swap some undesirable TAB characters with SPACE.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: probe() cleanups
David Brownell [Wed, 16 Dec 2009 22:17:31 +0000 (14:17 -0800)]
stellaris: probe() cleanups

Fix potential memory leak:  make sure the per-bank data
structures are only allocated in probe(), and that calling
probe() multiple times is a NOP.  Use it for auto_probe().

Require probe() to have done its thing:  don't make access
routines cope with it not having been called.  Shrink a
bunch of failure paths; and in some cases, correct them.

Don't needlessly insist on a halted target for probe().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: remove needless code
David Brownell [Wed, 16 Dec 2009 22:17:31 +0000 (14:17 -0800)]
stellaris: remove needless code

No point in reading and discarding a status value when fetching
part description data.  Or having that needless "#if 0" code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: avoid chip writes
David Brownell [Wed, 16 Dec 2009 22:17:31 +0000 (14:17 -0800)]
stellaris: avoid chip writes

Previously "reading" clock info (and part info) also, as a side
effect, wrote the flash timing register.  Instead, be more safe:
"reading" should only read.  Write paths still refresh timing,
coping with changes the application code may have made.

Also rename the routine which sets flash timing, indicating what
it's really doing; it's got nothing to do with a "mode".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: bugfix "flash fill[bwh] ..." helptext
David Brownell [Wed, 16 Dec 2009 19:57:59 +0000 (11:57 -0800)]
NOR: bugfix "flash fill[bwh] ..." helptext

These commands don't have a "bank" parameter.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agozy1000: removed some redundant include
Øyvind Harboe [Wed, 16 Dec 2009 13:44:58 +0000 (14:44 +0100)]
zy1000: removed some redundant include

spotted by lint.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoecos: crisper implementation of timeval_ms()
Øyvind Harboe [Tue, 15 Dec 2009 13:57:38 +0000 (14:57 +0100)]
ecos: crisper implementation of timeval_ms()

A crisper/faster implementation under eCos that makes profiling a
tad easier.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoserver: server loop will exhaust data inputs before sleeping
Øyvind Harboe [Tue, 15 Dec 2009 14:43:38 +0000 (15:43 +0100)]
server: server loop will exhaust data inputs before sleeping

By exhausting data on input, the performance will be more
consistent + the code more clearly distinguishes between
polling and processing. A test showed gdb packet load
performance go from ~1550kByte/s to 1650kBytes/s + being
more stable.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agomore tcl/{board,target} cleanup
David Brownell [Tue, 15 Dec 2009 22:39:25 +0000 (14:39 -0800)]
more tcl/{board,target} cleanup

Remove more remnants of the old "jtag_device" syntax.

Don't [format "%s.cpu" $_CHIPNAME] ... it's needless complexity.

Remove various non-supported "-variant" target options; they're not
needed often at all.

Flag some of the board files as needing to have and use target files
for the TAP and target declarations.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotesting/examples/.../*cfg: rm jtag_device calls
David Brownell [Tue, 15 Dec 2009 17:15:54 +0000 (09:15 -0800)]
testing/examples/.../*cfg: rm jtag_device calls

That syntax has been obsolete forever and is now gone; remove a few
remaining references.  Shows how seldom this stuff gets used.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoXScale: use all-ones for BYPASS, not five-ones
David Brownell [Tue, 15 Dec 2009 04:06:21 +0000 (20:06 -0800)]
XScale: use all-ones for BYPASS, not five-ones

PXA3xx has more than five bits in IR.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: add basic dsp563xx support
mkdorg@users.sourceforge.net [Tue, 15 Dec 2009 17:30:59 +0000 (18:30 +0100)]
target: add basic dsp563xx support

10 years agozy1000: keep up with command.h cleanup
Øyvind Harboe [Tue, 15 Dec 2009 12:24:28 +0000 (13:24 +0100)]
zy1000: keep up with command.h cleanup

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agocommand: retire obsolete macro
Øyvind Harboe [Tue, 15 Dec 2009 12:23:07 +0000 (13:23 +0100)]
command: retire obsolete macro

COMMAND_REGISTER() was only used transiently during
code conversion.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoimx31: move srst delay into config script
Øyvind Harboe [Tue, 15 Dec 2009 06:55:20 +0000 (07:55 +0100)]
imx31: move srst delay into config script

reset init/run now works again.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARM11: improved reset support
David Brownell [Tue, 15 Dec 2009 03:56:36 +0000 (19:56 -0800)]
ARM11: improved reset support

Teach ARM11 how to use:

 - the new "reset-assert" event
 - vector catch to implement "reset halt"
 - use SRST more like other cores do
 - ... including leaving post-SRST delays up to config scripts

This gives OMAP2420 the ability to reset, and doesn't seem to
cause new iMX31 problems.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: disassemble STM correctly
David Brownell [Tue, 15 Dec 2009 03:53:10 +0000 (19:53 -0800)]
ARM: disassemble STM correctly

There is no "STMMIDA" instruction.  There is however "STMDAMI".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agolm3748: use new Stellaris config file
David Brownell [Tue, 15 Dec 2009 00:29:53 +0000 (16:29 -0800)]
lm3748: use new Stellaris config file

Use the new file, and remove the old target/lm3s3748.cfg one.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoCommon target file for Stellaris chips
Yegor Yefremov [Tue, 15 Dec 2009 00:29:31 +0000 (16:29 -0800)]
Common target file for Stellaris chips

Common target.cfg file for LM3S CPU family

[dbrownell@users.sourceforge.net: rename, generalize more]

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: device IDs
Eric Wetzel [Mon, 14 Dec 2009 20:59:27 +0000 (15:59 -0500)]
stellaris: device IDs

I added the remaining devices and device IDs to stellaris.c, and
removed several devices that don't exist on the Stellaris web page.

Additionally, I found a few devices with duplicate IDs ... the DID1
Version Number for LM3Sxxx parts have DID1 Version = 0x0, and for
LM3Sxxxx have DID1 Version = 0x1. So I extended the comparison to
use the VER and FAM fields from DID1 also.

ID=0x33: LM3S812 (DID1v0) and LM3S2616 (DID1v1)
ID=0x39: LM3S808 (DID1v0) and LM3S2276 (DID1v1)

These are the parts I removed from the file for lack of documentation
(no data sheet to confirm part ID):

  LM3S318,
  LM3S1101, LM3S1108,
  LM3S1615, LM3S1616,
  LM3S2016,
  LM3S2101, LM3S2108,
  LM3S3759, LM3S3768,
  LM3S5757, LM3S5767, LM3S5768, LM3S5769,
  LM3S6815, LM3S6816,
  LM3S6915, LM3S6916,
  LM3S6111, LM3S6118.

Also, sort devices according to part number.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agojtag: add '-ignore-version' option
David Brownell [Mon, 14 Dec 2009 23:55:51 +0000 (15:55 -0800)]
jtag: add '-ignore-version' option

Add a "-ignore-version" to "jtag newtap" which makes the IDCODE
comparison logic optionally ignore version differences.

Update the "scan_chain" command to illustrate this by showing
the "*" character instead of the (ignored) version nibble.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget files shouldn't #include <target/...h>
David Brownell [Sun, 13 Dec 2009 20:52:23 +0000 (12:52 -0800)]
target files shouldn't #include <target/...h>

Make these ".h" files adopt the same policy the ".c" files already
follow:  don't use <subsystem/...h> syntax for private interfaces.

If we ever get reviewed/supported "public" interfaces they should
come exclusively from some include/... directory; that'll be the
time to switch to <...> syntax for any subsystem's own interfaces.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: further shrink Jim-awareness
David Brownell [Sun, 13 Dec 2009 20:52:23 +0000 (12:52 -0800)]
target: further shrink Jim-awareness

Don't include <helper/jim.h> from target.h ... not everything
which touches targets needs to be able to talk to Jim.  Plus,
most files include this header by another path.

Also, switch the affected files to use the classic sequence
for #included files:  all <framework/headers.h> first, then
the "local_headers.h".  This helps prevent growth of problematic
layering, by minimizing entanglement.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoLPC2000: rename "r13_svc" as "sp_svc"
David Brownell [Sat, 12 Dec 2009 23:43:02 +0000 (15:43 -0800)]
LPC2000: rename "r13_svc" as "sp_svc"

This driver didn't get updated when the name changed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM11: avoid pointless status returns
David Brownell [Fri, 11 Dec 2009 23:38:36 +0000 (15:38 -0800)]
ARM11: avoid pointless status returns

For some routines that only returned ERROR_OK and where the
caller never checked ... don't bother.  Remove some noise,
and bugfix some comments.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoadd missing call to add new NAND devices
Zachary T Welch [Sat, 12 Dec 2009 02:43:27 +0000 (18:43 -0800)]
add missing call to add new NAND devices

I forgot to add a call to the newly factored nand_device_add(), along
with its forward declaration.

10 years agofix 'write_image' usage information
Zachary T Welch [Sat, 12 Dec 2009 02:38:44 +0000 (18:38 -0800)]
fix 'write_image' usage information

The 'flash write_image' command erroneously listed the bank number,
when it actually uses target addresses to do that lookup for the user.

10 years agoARM DPM: support updating HW breakpoints
David Brownell [Fri, 11 Dec 2009 23:26:10 +0000 (15:26 -0800)]
ARM DPM: support updating HW breakpoints

Abstract the DPM breakpoint and watchpoint data structures to
have a shared core for housekeeping.

Abstract the code updating the watchpoint registers so that it
can be used to update breakpoint registers.  Then do so, when
something has set up the breakpoint state used by this code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: disassembly fixes for LDC/STC/MRRC/MCRR
David Brownell [Fri, 11 Dec 2009 23:24:08 +0000 (15:24 -0800)]
ARM: disassembly fixes for LDC/STC/MRRC/MCRR

Properly detect all of these, including the "2" variants;
and bugfix parameter display for LDC and STC.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM11: minor cleanup, mostly ITR comments
David Brownell [Fri, 11 Dec 2009 23:24:08 +0000 (15:24 -0800)]
ARM11: minor cleanup, mostly ITR comments

ITR register handling seemed to be giving me problems, so I updated
the comments to better say what the code is trying to do ... and to
note the preconditions (one of which seems to be an issue) as listed
in the ARM1136 TRM.

Also removed the unused "ARM11_TAP_DEFAULT" from the ITR scan code;
all the callers already specify an exit path, since this register
isn't usable with such vague semantics.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoserver: add server_preinit which is called before config file is parsed.
Spencer Oliver [Thu, 10 Dec 2009 14:31:28 +0000 (14:31 +0000)]
server: add server_preinit which is called before config file is parsed.

This fixes the issue under native win32 of the socket interface not being
enabled (via WSAStartup) before init is called from a script.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agobuild: fix cygwin build warnings
Spencer Oliver [Thu, 10 Dec 2009 11:28:38 +0000 (11:28 +0000)]
build: fix cygwin build warnings

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agogdb_server: use more local variables in inner loop of fetching packetstiny refactorin...
Øyvind Harboe [Thu, 10 Dec 2009 18:14:45 +0000 (19:14 +0100)]
gdb_server: use more local variables in inner loop of fetching packetstiny refactoring to allow optimisation of inner loops

Some profiling information for arm7 16MHz GDB load operation shows
gdb_get_packet_inner() near the very top.

Each sample counts as 0.01 seconds.
  %   cumulative   self              self     total
 time   seconds   seconds    calls  Ts/call  Ts/call  name
 52.91      2.27     2.27                             embeddedice_write_dcc
 11.89      2.78     0.51                             gdb_get_packet_inner
  8.86      3.16     0.38                             memcpy
  3.26      3.30     0.14                             idle_thread_main(unsigned int)
  3.03      3.43     0.13                             cyg_in_cksum

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agogdb_server: make struct gdb_connection private
Øyvind Harboe [Thu, 10 Dec 2009 18:11:03 +0000 (19:11 +0100)]
gdb_server: make struct gdb_connection private

it is only used inside gdb_server.c

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agooptimisation: tiny optimisation for embedded ice
Øyvind Harboe [Thu, 10 Dec 2009 14:09:20 +0000 (15:09 +0100)]
optimisation: tiny optimisation for embedded ice

use two shift operations instead of three to set embedded
ice register.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoembedded hosts: optimize common code path for core arm operations
Øyvind Harboe [Thu, 10 Dec 2009 14:00:19 +0000 (15:00 +0100)]
embedded hosts: optimize common code path for core arm operations

avoid fn call for the if check on whether anything needs
to be done.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoanotyer cygwin compile fix
David Brownell [Fri, 11 Dec 2009 01:42:20 +0000 (17:42 -0800)]
anotyer cygwin compile fix

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agozy1000: revc FPGA now works
Øyvind Harboe [Mon, 7 Dec 2009 11:38:56 +0000 (12:38 +0100)]
zy1000: revc FPGA now works

remove kludge code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARM: update arm_opcodes.h copyright
David Brownell [Thu, 10 Dec 2009 05:43:23 +0000 (21:43 -0800)]
ARM: update arm_opcodes.h copyright

I neglected to copy Magnus' copyright when I moved several
declarations from the ARMv7-M header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agostellaris: flash protection updates, minor fixes
David Brownell [Thu, 10 Dec 2009 05:16:09 +0000 (21:16 -0800)]
stellaris: flash protection updates, minor fixes

Bugfix the read side of flash protection:
 - read the right register(s)!
 - handle more than 64K
 - record the results in the right places
 - don't display garbage.

Partially bugfix the write side:
 - use 2KB lock regions instead of 1KB pages (!)
 - validate input range
 - don't try to _remove_ protection (it's write-once)
 - #define values we'll need to commit writes.
 - ... still doesn't handle pages over 64KB mark, or commit writes

And minor cleanup and fixes:
 - get rid of some forward decls
 - properly locate a doxygen comment
 - fix some bad indentation
 - remove superfluous #include
 - add a new part ID (many are still missing)
 - make the downloaded algorithm code be read-only

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoComment and doxygen fixes
David Brownell [Wed, 9 Dec 2009 18:25:08 +0000 (10:25 -0800)]
Comment and doxygen fixes

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoETM: only include oocd_trace.h when tracing enabled.
Spencer Oliver [Wed, 9 Dec 2009 10:35:30 +0000 (10:35 +0000)]
ETM: only include oocd_trace.h when tracing enabled.
Fixes build issue on systems that do not have <termios.h>, eg native win32.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
10 years agoFix compilation error with gcc 4.4.1
Rafael Campos Las Heras [Tue, 8 Dec 2009 19:25:50 +0000 (20:25 +0100)]
Fix compilation error with gcc 4.4.1

Signed-off-by: Rafael Campos Las Heras <methril@gmail.com>
10 years agotarget: remove more exit() calls
David Brownell [Tue, 8 Dec 2009 21:09:38 +0000 (13:09 -0800)]
target: remove more exit() calls

These were all basically "can't happen" cases ... like having
state be corrupted by an alpha particle after the previous check
for whether a value was in-range.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: remove needless "extern"s
David Brownell [Tue, 8 Dec 2009 21:06:41 +0000 (13:06 -0800)]
target: remove needless "extern"s

Most of these happened to be in the target.h file.

Some of those are associated with symbols that could be
removed at some point ... e.g. NVP_ASSERT/true and its
sibling NVP_DEASSERT/false.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: move 'extern' decls to *.h files
David Brownell [Tue, 8 Dec 2009 21:06:41 +0000 (13:06 -0800)]
target: move 'extern' decls to *.h files

The exception being declarations for drivers.  Those should
be split out in some clean way -- like driver add/remove calls
made by initialization code -- but that's for another day.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: cygwin complile fixes
David Brownell [Tue, 8 Dec 2009 10:00:35 +0000 (02:00 -0800)]
ARM: cygwin complile fixes

It's as if despite integers being 32-bits, GCC refuses to
convert a "uint32_t" to one of them.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agozy1000: some background info on the zy1000 file.
Øyvind Harboe [Tue, 8 Dec 2009 09:40:47 +0000 (10:40 +0100)]
zy1000: some background info on the zy1000 file.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agominidriver: fix inline capability of minidriver
Øyvind Harboe [Fri, 4 Dec 2009 15:00:43 +0000 (16:00 +0100)]
minidriver: fix inline capability of minidriver

Low latency low CPU processing power systems(embedded)
will benefit greatly from being able to inline certain
jtag_add_xxx() fn's. The trick is that this has to be
done in such a way as to allow implementing an OpenOCD
API with a shared library(eventually) on a PC hosted
OpenOCD.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agozy1000: remove unecessary include
Øyvind Harboe [Sat, 5 Dec 2009 10:07:06 +0000 (11:07 +0100)]
zy1000: remove unecessary include

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agobuild: add build/src to include path
Øyvind Harboe [Sat, 5 Dec 2009 09:50:59 +0000 (10:50 +0100)]
build: add build/src to include path

This allows including generated include files.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
10 years agoARM: cope with stupidheaded compiler
David Brownell [Tue, 8 Dec 2009 02:14:46 +0000 (18:14 -0800)]
ARM: cope with stupidheaded compiler

Some versions of GCC don't understand that if you mask with 0x3
then have cases 0-3, it's not possible for a variable assigned in
all those branches to have no value at end-of-case.  Feh.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: list number of HW breakpoints/watchpoints
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
ARM: list number of HW breakpoints/watchpoints

When starting up, say how many hardware breakpoints and watchpoints
are available on various targets.

This makes it easier to tell GDB how many of those resources exist.
Its remote protocol currently has no way to ask OpenOCD for that
information, so it must configured by hand (or not at all).

Update the docs to mention this; remove obsolete "don't do this" info.
Presentation of GDB setup information is still a mess, but at least
it calls out the three components that need setup.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agotarget: add debug_reason_name()
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
target: add debug_reason_name()

Provide and use debug_reason_name() instead of expecting targets
to call Jim_Nvp_value2name_simple().  Less dependency on Jim, and
the code becomes more clear too.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: don't clone arm_arch_state() code
David Brownell [Mon, 7 Dec 2009 22:55:08 +0000 (14:55 -0800)]
ARM: don't clone arm_arch_state() code

Have various ARM cores delegate to arm_arch_state() to display
basic information, instead of duplicating that logic.

This shrinks the code, makes them all report when semihosting
is active, and highlights which data are specific to this core.
(Like ARM720 not having separate instruction and data caches.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoUser's Guide: add quickie setup notes
David Brownell [Mon, 7 Dec 2009 22:55:07 +0000 (14:55 -0800)]
User's Guide: add quickie setup notes

Add a brief "setup with no customization" note showing the
how easily things can work if standard OpenOCD config scripts
already exist.  We've had some new users comment that this
information is needlessly hard to find, so that starting to
use OpenOCD is more difficult than it should be.

Plus describe a few other issues that come up when setting
up an OpenOCD server.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: use <target/arm.h> not armv4_5.h
David Brownell [Mon, 7 Dec 2009 22:54:13 +0000 (14:54 -0800)]
ARM: use <target/arm.h> not armv4_5.h

Move most declarations in <target/armv4_5.h> to <target/arm.h>
and update users.

What's left in the older file is stuff that I think should be
removed ... the old register cache access stuff, which makes it
awkward to support microcontroller profile (Cortex-M) cores.

The armv4_5_run_algorithm() declaration was moved too, even
though it's not yet as generic as it probably ought to be.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename some generic routines
David Brownell [Mon, 7 Dec 2009 22:54:13 +0000 (14:54 -0800)]
ARM: rename some generic routines

Rename some (mostly) generic ARM functions:

    armv4_5_arch_state()       --> arm_arch_state()
    armv4_5_get_gdb_reg_list() --> arm_get_gdb_reg_list()
    armv4_5_init_arch_info()   --> arm_init_arch_info()

Cores using the microcontroller profile may want a different
arch_state() routine though.

(Also fix strange indentation in arm_arch_state: use tabs only!
And update a call to it, removing assignment-in-conditional.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: move opcode macros to <target/arm_opcodes.h>
David Brownell [Mon, 7 Dec 2009 22:54:12 +0000 (14:54 -0800)]
ARM: move opcode macros to <target/arm_opcodes.h>

Move the ARM opcode macros from <target/armv4_5.h>, and a few
Thumb2 ones from <target/armv7m.h>, to more appropriate homes
in a new <target/arm_opcodes.h> file.

Removed duplicate opcodes from that v7m/Thumb2 set.  Protected
a few macro argument references by adding missing parentheses.

Tightening up some of the line lengths turned up a curious artifact:
the macros for the Thumb opcodes are all 32 bits wide, not 16 bits.
There's currently no explanation for why it's done that way...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: remove mrc_opcode(), use MRC() or MCR()
David Brownell [Mon, 7 Dec 2009 22:54:12 +0000 (14:54 -0800)]
ARM: remove mrc_opcode(), use MRC() or MCR()

Get rid of mrc_opcode() in favor of ARMV4_5_MRC() or, where
arm*20t should have used it, ARMV4_5_MCR() instead.

Basically, *writing* coprocessor registers shouldn't have
used the *read* opcode ... and both should stick to standard
opcode constructors, not rearranging parameter sequence any
more than already needed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: disassemble two more v6+ instructions
David Brownell [Mon, 7 Dec 2009 22:46:29 +0000 (14:46 -0800)]
ARM: disassemble two more v6+ instructions

The SRS and RFE instructions speed exception entry/exit by
making it easy to save and restore PC and SPSR.  This handles
both ARM and Thumb2 encodings.

Fix minor PLD goofage; that "should never reach this point"
can't happen, so remove it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM DPM: don't write low bits of watchpoint value
David Brownell [Mon, 7 Dec 2009 20:05:59 +0000 (12:05 -0800)]
ARM DPM: don't write low bits of watchpoint value

The low two bits are defined as should-be-zero-or-presereved.
We'll take the zero option, it's easier to enforce.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoOMAP2420: define reset-assert event
David Brownell [Mon, 7 Dec 2009 19:57:46 +0000 (11:57 -0800)]
OMAP2420: define reset-assert event

Behave like OMAP3530:  force global software reset.  Given the
patch to teach ARM11 how to use these events, and use VCR to
catch the reset vector, this works better than either the
current reset logic or than using SRST.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoUser's Guide: mention ETM on ARM11 comes up too
David Brownell [Mon, 7 Dec 2009 19:54:06 +0000 (11:54 -0800)]
User's Guide: mention ETM on ARM11 comes up too

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoadd 'flash list', rewrite 'flash banks'
Zachary T Welch [Mon, 7 Dec 2009 05:30:21 +0000 (21:30 -0800)]
add 'flash list', rewrite 'flash banks'

Rename the existing 'flash banks' implementation as 'flash list', and
replace the broken 'flash_banks' TCL wrapper with a new command handler.

Adds documentation for the new 'flash list' command in the user guide.

10 years agoallow 'flash_banks' command to give GDB output
Zachary T Welch [Mon, 7 Dec 2009 04:19:18 +0000 (20:19 -0800)]
allow 'flash_banks' command to give GDB output

The 'flash banks' command produces a list that needs to be formatted
properly for GDB's 'mem info' to work properly.  The flash_banks TCL
wrapper provided this formatting, but wrappers no longer work for
second-level commands as they did in the past.  With this patch,
the 'flash_banks' command can be used with the new command syntax
and display the required information.

10 years agofix NOR flash regression
Zachary T Welch [Mon, 7 Dec 2009 04:15:08 +0000 (20:15 -0800)]
fix NOR flash regression

When factoring the bank setup command into flash_bank_add(), I forgot
to include a call to the new helper.

10 years agomisc code review updates
David Brownell [Sat, 5 Dec 2009 22:40:06 +0000 (14:40 -0800)]
misc code review updates

More updates from the code review by Steve Grubb <sgrubb@redhat.com>.
The Jim float-comparision bug just gets a comment not a fix, though.

Cc: Steve Grubb <sgrubb@redhat.com>.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoNOR: add 29LV400BC flash device
Mathias Kuester [Sat, 5 Dec 2009 13:55:24 +0000 (14:55 +0100)]
NOR: add 29LV400BC flash device

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM semihosting: use breakpoint on ARM7
Nicolas Pitre [Sat, 5 Dec 2009 06:01:55 +0000 (01:01 -0500)]
ARM semihosting: use breakpoint on ARM7

Fall back to software breakpoint when vector catch isn't available.

Possible enhancements:

 - add extra optional command parameter to select high vectors
 - add extra optional command parameter to select hardware breakpoint

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM semihosting: work with both low and high vectors
Nicolas Pitre [Sat, 5 Dec 2009 06:01:54 +0000 (01:01 -0500)]
ARM semihosting: work with both low and high vectors

Signed-off-by: Nicolas Pitre <nico@marvell.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agorename nand.h to flash//nand/core.h
Zachary T Welch [Sat, 5 Dec 2009 06:04:37 +0000 (22:04 -0800)]
rename nand.h to flash//nand/core.h

Rename nand.h as flash/nand/core.h, chase consumers.  The public APIs
need to be sorted out with imp.h, but this allows other changes to
begin improving the separation between policy and mechanism.

Moves #include <target/target.h> and #include "driver.h" into the
internal headers or source files, removing it from <flash/nand/core.h>.

10 years agomove remaining nand helper files
Zachary T Welch [Sat, 5 Dec 2009 05:38:13 +0000 (21:38 -0800)]
move remaining nand helper files

Move remaining NAND implementation files into src/flash/nand/.

10 years agosplit nand.c into nand/{core,fileio,tcl}.c
Zachary T Welch [Sat, 5 Dec 2009 03:28:18 +0000 (19:28 -0800)]
split nand.c into nand/{core,fileio,tcl}.c

Moves commands into nand/tcl.c and core implementation to 'nand/core.c'
and 'nand/fileio.c'.  Eliminates 'flash/nand.c'.

Adds 'nand/imp.h' to share routines between TCL commands and core.

10 years agosplit NAND driver handling into nand/driver.[ch]
Zachary T Welch [Sat, 5 Dec 2009 02:24:14 +0000 (18:24 -0800)]
split NAND driver handling into nand/driver.[ch]

This work parallels the NOR directory, encapsulating the NAND drivers
into a separate file.  This takes an extra step by encapsulating the
type of data structure used to manage the drivers, allowing it to be
changed from an array to a dynamic list in the future.

10 years agoARM: doc updates for main header
David Brownell [Sat, 5 Dec 2009 04:44:29 +0000 (20:44 -0800)]
ARM: doc updates for main header

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename armv4_5_build_reg_cache() as arm_*()
David Brownell [Sat, 5 Dec 2009 04:33:02 +0000 (20:33 -0800)]
ARM: rename armv4_5_build_reg_cache() as arm_*()

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename armv4_5_algorithm as arm_algorithm
David Brownell [Sat, 5 Dec 2009 04:19:49 +0000 (20:19 -0800)]
ARM: rename armv4_5_algorithm as arm_algorithm

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: misc generic cleanup
David Brownell [Sat, 5 Dec 2009 04:14:46 +0000 (20:14 -0800)]
ARM: misc generic cleanup

Remove an undesirable use of the CPSR symbol ... it needs to vanish.
Flag mode-to-number stuff as obsolete; say why ... should also vanish.

Get rid of no-longer-used mode and state typedefs.

Comment a few of the implicit ties to "classic ARM".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: ARMV4_5_COMMON_MAGIC --> ARM_COMMON_MAGIC
David Brownell [Sat, 5 Dec 2009 03:46:44 +0000 (19:46 -0800)]
ARM: ARMV4_5_COMMON_MAGIC --> ARM_COMMON_MAGIC

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: switch target_to_armv4_5() to target_to_arm()
David Brownell [Sat, 5 Dec 2009 03:43:03 +0000 (19:43 -0800)]
ARM: switch target_to_armv4_5() to target_to_arm()

And remove that old symbol.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename armv4_5_state_* as arm_state_*
David Brownell [Sat, 5 Dec 2009 03:39:25 +0000 (19:39 -0800)]
ARM: rename armv4_5_state_* as arm_state_*

And make arm_state_strings[] be const.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename armv4_5_mode_* AS arm_mode_*
David Brownell [Sat, 5 Dec 2009 03:33:33 +0000 (19:33 -0800)]
ARM: rename armv4_5_mode_* AS arm_mode_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename ARMV4_5_MODE_* as ARM_MODE_*
David Brownell [Sat, 5 Dec 2009 03:21:14 +0000 (19:21 -0800)]
ARM: rename ARMV4_5_MODE_* as ARM_MODE_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM: rename ARMV4_5_STATE_* as ARM_STATE_*
David Brownell [Sat, 5 Dec 2009 03:14:48 +0000 (19:14 -0800)]
ARM: rename ARMV4_5_STATE_* as ARM_STATE_*

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM11: report watchpoint trigger insn
David Brownell [Sat, 5 Dec 2009 02:57:31 +0000 (18:57 -0800)]
ARM11: report watchpoint trigger insn

As with Cortex-A8, the WFAR register holds useful information
that should be recorded and, where relevant, displayed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
10 years agoARM11: basic watchpoint support
David Brownell [Sat, 5 Dec 2009 02:57:31 +0000 (18:57 -0800)]
ARM11: basic watchpoint support

Use the DPM watchpoint support; remove old incomplete stubs.

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