]> git.sur5r.net Git - openocd/log
openocd
14 years agoremove BUILD_IOUTIL symbol
Zachary T Welch [Wed, 2 Dec 2009 03:52:00 +0000 (19:52 -0800)]
remove BUILD_IOUTIL symbol

Add ioutil_stubs.c to provide an empty ioutil_init() routine.
Add ioutil.h to prevent applications from needing to declare it.

Allows unconditionally calling that function during startup, and the
resulting libocdhelper library API is now more stable.

Prints a DEBUG message when the stub implementation is included.

14 years agoremove #if logic for openocd_sleep_*lude
Zachary T Welch [Wed, 2 Dec 2009 03:41:16 +0000 (19:41 -0800)]
remove #if logic for openocd_sleep_*lude

Adds server_stubs.c to hold these routines, using automake logic to
ensure it gets included under the right conditions.

14 years agotarget: factor init to 'target init'
Zachary T Welch [Tue, 1 Dec 2009 02:45:38 +0000 (18:45 -0800)]
target: factor init to 'target init'

Adds 'target init' command handler, called as part of 'init'.

14 years agotarget: factor target_init() into pieces
Zachary T Welch [Tue, 1 Dec 2009 02:27:23 +0000 (18:27 -0800)]
target: factor target_init() into pieces

Moves body of target initialization loop into a helper function,
cleaning up its visual flow in the process.

14 years agojtag: factor init into 'jtag init'
Zachary T Welch [Tue, 1 Dec 2009 02:30:38 +0000 (18:30 -0800)]
jtag: factor init into 'jtag init'

Adds 'jtag init' command handler, which can be called as part of a
fine-grained 'init' process.

14 years agoflash: factor init to 'flash init'
Zachary T Welch [Tue, 1 Dec 2009 01:38:02 +0000 (17:38 -0800)]
flash: factor init to 'flash init'

Split flash initialiation into 'flash init', called from 'init'.

14 years agomflash: factor init to 'mflash init'
Zachary T Welch [Tue, 1 Dec 2009 01:32:56 +0000 (17:32 -0800)]
mflash: factor init to 'mflash init'

Splits mflash initialiation to 'mflash init', called from 'init'.

14 years agonand: factor init to 'nand init'
Zachary T Welch [Tue, 1 Dec 2009 01:27:21 +0000 (17:27 -0800)]
nand: factor init to 'nand init'

Split NAND initialization into 'nand init', which gets called from
the main 'init' command.

14 years agopld: factor init to 'pld init'
Zachary T Welch [Tue, 1 Dec 2009 01:20:18 +0000 (17:20 -0800)]
pld: factor init to 'pld init'

Split PLD initialization into 'pld init', which gets called from 'init'.

14 years agoARMv7a/Cortex-A8: report watchpoint trigger insn
David Brownell [Wed, 2 Dec 2009 19:31:32 +0000 (11:31 -0800)]
ARMv7a/Cortex-A8: report watchpoint trigger insn

Save and display the address of the instruction which triggered the
watchpoint.  Because of pipelining, that's well behind the PC value
when debug entry completes.  (Example in a subroutine that had been
returned from...)

Remove unused A8 stuff, mostly watchpoint hooks from the header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: label SP and LR correctly
David Brownell [Wed, 2 Dec 2009 19:31:32 +0000 (11:31 -0800)]
ARM: label SP and LR correctly

Except for USR/SYS mode, the labels for the shadowed SP and LR
registers were reversed.  LR is r14; SP is r13.  Fix.

This would not affect GDB users; GDB references are positional.
Only folk working directly with OpenOCD register values would
have noticed this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agozy1000: keep up with startup refactoring work.
Øyvind Harboe [Wed, 2 Dec 2009 11:45:12 +0000 (12:45 +0100)]
zy1000: keep up with startup refactoring work.

keep up with server_init() introduction.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoCortex-A8: basic watchpoint support
David Brownell [Wed, 2 Dec 2009 05:47:45 +0000 (21:47 -0800)]
Cortex-A8: basic watchpoint support

Actually this should handle both breakpoints and watchpoints ... but
the DPM framework only handles watchpoints for now.  Works on Beagle.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: core DPM support for watchpoints
David Brownell [Wed, 2 Dec 2009 05:47:45 +0000 (21:47 -0800)]
ARM: core DPM support for watchpoints

This is a NOP unless the underlying core exposes two new methods, and
neither of the two cores using this (ARM11xx, Cortex-A8) do so yet.

This patch only updates those cores so they pass a flag saying whether
or not to update breakpoint and watchpoint status before resuming; and
removing some now-needless anti-segfault code from ARM11.  Cortex-A8
didn't have that code ... yes, it segfaulted when setting watchpoints.

NOTE:  this uses a slightly different strategy for setting/clearing
breakpoints than the ARM7/ARM9/etc code uses.  It leaves them alone
unless it's *got* to change something, to speed halt/resume cycles
(including single stepping).

ALSO NOTE:  this under-delivers for Cortex-A8, where regions with size
up to 2 GBytes can be watched ... it handles watchpoints which ARM11 can
also handle (size 1/2/4 bytes).  Should get fixed later.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7a: move constants out of Cortex-A8 header
David Brownell [Wed, 2 Dec 2009 04:39:58 +0000 (20:39 -0800)]
ARMv7a: move constants out of Cortex-A8 header

These are architecturally defined, not core-specific.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoTcl and doc: update to match new 'arm mcr ...' etc
David Brownell [Tue, 1 Dec 2009 09:09:10 +0000 (01:09 -0800)]
Tcl and doc: update to match new 'arm mcr ...' etc

Make them match the C code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: at91eb40a.cfg is a board, not a target.
Øyvind Harboe [Tue, 1 Dec 2009 09:03:15 +0000 (10:03 +0100)]
target: at91eb40a.cfg is a board, not a target.

Also updated to use target name when creating flash
and set jtag_khz to 16000.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: keep up with latest changes to command handling
Øyvind Harboe [Tue, 1 Dec 2009 07:42:53 +0000 (08:42 +0100)]
zy1000: keep up with latest changes to command handling

Keep up with Jim Tcl interpreter creation cleanup.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agocommand: the Jim interpreter can now be provided rather than created
Øyvind Harboe [Tue, 1 Dec 2009 07:41:41 +0000 (08:41 +0100)]
command: the Jim interpreter can now be provided rather than created

In embedded hosts, the Jim interpreter can come from the
existing context rather than be created by OpenOCD.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM11: remove previous mcr()/mrc() methods
David Brownell [Tue, 1 Dec 2009 08:49:16 +0000 (00:49 -0800)]
ARM11: remove previous mcr()/mrc() methods

We don't need this code, now that the DPM code handles it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-A8: remove previous mcr()/mrc() methods
David Brownell [Tue, 1 Dec 2009 08:49:11 +0000 (00:49 -0800)]
Cortex-A8: remove previous mcr()/mrc() methods

We don't need this code, now that the DPM code handles it.
Neither do we need the ARMv7-A CP15 operations; remove their
remnants too.  And disable a mostly-needless diagnostic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: implement mrc()/mcr() as DPM ops
David Brownell [Tue, 1 Dec 2009 08:49:04 +0000 (00:49 -0800)]
ARM: implement mrc()/mcr() as DPM ops

Instead of having separate ARM11 and Cortex-A8 implementations of
this code, have one shared implementation which just builds on the
existing "run instruction via R0" support.

This enables followup patches to remove that now-unused code from
those two drivers.  (Patches to move the "mrc" and "mcr" code into
"struct arm" are due too ... MIPS and other cores do not support
those ARM-specific concepts.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: "mcr" and "mrc" are ARM-specific
David Brownell [Tue, 1 Dec 2009 08:48:53 +0000 (00:48 -0800)]
target: "mcr" and "mrc" are ARM-specific

Switch "mrc" and "mcr" commands to be toplevel ARM operations,
as they should initially have been.

Correct the usage message for both commands:  it matches ARM
documentation (as one wants!) instead of reordering them to
match the funky mrc() and mcr() method usage (sigh).

For Cortex-A8: restore a line that got accidentally dropped,
so the secure monitor mode shadow registers will show again.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7-A: stop using CP15 ops
David Brownell [Tue, 1 Dec 2009 08:48:40 +0000 (00:48 -0800)]
ARMv7-A: stop using CP15 ops

The ARMv7-A code uses read_cp15() to access fault registers.
Instead, use DPM operations directly, passing in the relevant
MRC instructions.

This eliminates per-operation overhead (though it'll be hard
to observe, this is uncommon) and helps eliminate read_cp15().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-A8: stop using CP15 ops
David Brownell [Tue, 1 Dec 2009 08:48:40 +0000 (00:48 -0800)]
Cortex-A8: stop using CP15 ops

There were two chunks of Cortex-A8 code which called the
ARMv7-A CP15 operations; get rid of them, helping prepare
to remove those methods completely:

 - post_debug_entry() can use the mrc() method to read
   its two registers.

 - write_memory() can use dpm->instr_write_data_r0() to
   flush the ICache and DCache ... doing it this way is
   actually faster since it reduces per-write overhead.

Note that the mrc() method parameters are re-ordered with
respect to the ARM instruction documentation, so that part
can be confusing.

Cleaned up the layout and comments in those areas a bit.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agomain: invoke jtag_interface_quit() explicitly
Øyvind Harboe [Mon, 30 Nov 2009 08:13:56 +0000 (09:13 +0100)]
main: invoke jtag_interface_quit() explicitly

There is no particular reason to invoke jtag_interface_quit()
on the atexit() handler, it just makes the code more obtuse
and stops other legitimate usage of atexit().

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoimprove command prohibition error report
Zachary T Welch [Sun, 29 Nov 2009 00:29:41 +0000 (16:29 -0800)]
improve command prohibition error report

Ensures that the correct information gets displayed, depending on the
mode of the command being denied.  Fixes misreporting all commands as
needing to run "before 'init'".

14 years agoXScale: restore_context() cleanup
David Brownell [Tue, 1 Dec 2009 03:14:19 +0000 (19:14 -0800)]
XScale: restore_context() cleanup

Clean up two aspects to this routine:  bad naming, since it
doesn't restore the context, just the banked registers; and
excess indentation for the bulk of the code.

Also make some of its call sites stash the function's return
code; someday they should use it for error checking.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoXScale: context restore, cleanup/bugfix
David Brownell [Tue, 1 Dec 2009 03:14:19 +0000 (19:14 -0800)]
XScale: context restore, cleanup/bugfix

This "loop over all registers" routine shared the same mess as
full_context() in terms of dozens of needless number_to_mode()
calls.  Fix that, and comments, with related cleanup.

The misnamed xscale_restore_context() had a related bug.  It
was restoring the *WRONG REGISTERS* ... always from whatever
the current mode was, instead of using the copy from whichever
register bank it was trying to restore.  (But it marked the
intended register as having been restored...)  Fixed that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoremove interp global variable!
Zachary T Welch [Mon, 30 Nov 2009 02:50:48 +0000 (18:50 -0800)]
remove interp global variable!

Finish removing references to the 'interp' global variable from the
command module, encapsulating all reference via command_context.

Eliminates use of the global entirely, so it can be removed.  Hurrah!

14 years agocommand output capture: do not use interp global
Zachary T Welch [Mon, 30 Nov 2009 02:39:13 +0000 (18:39 -0800)]
command output capture: do not use interp global

Adds a log_capture_state structure to pass to the log capture
callback used by the command module.  Ensures that the capture occurs
in the proper context.

14 years agodo not extern 'interp' from command.c
Zachary T Welch [Mon, 30 Nov 2009 02:27:45 +0000 (18:27 -0800)]
do not extern 'interp' from command.c

Adds 'interp' field to command_context, chasing the few remaining
references to the global variable outside of the command module.

14 years agotarget: avoid using interp global variable
Zachary T Welch [Mon, 30 Nov 2009 02:21:59 +0000 (18:21 -0800)]
target: avoid using interp global variable

Adds 'interp' to target_event_action structure to avoid using the
global variable of the same name.

14 years agojtag: avoid using interp global variable
Zachary T Welch [Mon, 30 Nov 2009 02:08:13 +0000 (18:08 -0800)]
jtag: avoid using interp global variable

Adds 'interp' field to jtag_tap_event_action structure to avoid
using the global variable of same name.

14 years agofix foo command group help messages
Zachary T Welch [Mon, 30 Nov 2009 00:48:40 +0000 (16:48 -0800)]
fix foo command group help messages

Splits the old help strings to provide proper usage as well.

14 years agomake syntax errors respond with 'usage'
Zachary T Welch [Mon, 30 Nov 2009 00:32:06 +0000 (16:32 -0800)]
make syntax errors respond with 'usage'

The 'help' text will become more verbose, so its entire text will be
far more than desired when you only borked your syntax.  The usage
still allows the commands to be looked up for more help.

14 years agomove improperly located documentation
Zachary T Welch [Mon, 30 Nov 2009 00:30:00 +0000 (16:30 -0800)]
move improperly located documentation

Somehow, the comment block for command handlers ended up associated
with the output_handler.  Move it to the command_handler_t declaration.

14 years agoimprove command_done() API and docs
Zachary T Welch [Sun, 29 Nov 2009 23:58:16 +0000 (15:58 -0800)]
improve command_done() API and docs

command_done() does not need to return an error, but it needed
Doxygen comment.  Provide some for copy_command_context as well.

Note: this audit revealed some potential bugs with the command context
implementation.  There was a reason that commands were added at the
end of the list.  Shallow copying of command_context means that
the list is shared between them.  And commands added at the top-level
before the pre-existing commands will not be available in the shared
context as they were before.  Yikes!

Fortunately, this does not seem to occur in general use, as
'add_help_text' gets registered in startup.tcl and claims the first slot
in my own test cases.  Thus, it seems that we have been masking the issue
for now, but it shows the need for further architectural improvement in
the core command module.

14 years agoonly display usable commands in help
Zachary T Welch [Sun, 29 Nov 2009 22:29:24 +0000 (14:29 -0800)]
only display usable commands in help

With the ability to defer 'init', users can access the help system while
still in CONFIG mode.  This patch omits commands from the help and usage
list when they cannot be run in the current command mode, making it much
easier to see what can be done at a given time.

14 years agoallow deferal of init
Zachary T Welch [Sun, 29 Nov 2009 22:04:21 +0000 (14:04 -0800)]
allow deferal of init

Adds 'noinit' command to prevent OpenOCD from running 'init' at the end
up startup, allowing it to be given from telnet or TCL.  This provides
the old behavior by default, and users can add this command to their
scripts to get the new behavior.

14 years agomove server_init() to openocd_main()
Zachary T Welch [Sun, 29 Nov 2009 22:04:21 +0000 (14:04 -0800)]
move server_init()  to openocd_main()

Moves the telnet and TCL server startup to server_init(), moving their
respective command registration in to server_register_commands().
Adds proper error checking for these particular startup processes.

Moves the core server startup to openocd_main(), improving related error
checking and preparing to defer 'init'.

14 years agoimprove gdb_init() sequence
Zachary T Welch [Sun, 29 Nov 2009 02:56:23 +0000 (18:56 -0800)]
improve gdb_init() sequence

Rework gdb_init to create flexible APIs (gdb_target_add_{one,all}) and
static helper (gdb_target_start) for starting GDB services.  Eliminates
duplicated code and provides general mechanisms for adding GDB services.
The 'init' command is updated to call the new API, and later patches can
decouple its policy of adding all targets therein.

Provides the new capability to use both piped and TCP servers when
multiple targets are defined.  The first target fills the pipe, and
others will be started on TCP ports (unless disabled, i.e. gdb_port=0).

15 years agozy1000: keep up with changes to command structure
Øyvind Harboe [Mon, 30 Nov 2009 07:43:49 +0000 (08:43 +0100)]
zy1000: keep up with changes to command structure

Add missing COMMAND_REGISTRATION_DONE.

For now the command syntax for zy1000 needs to be compatible
across 0.3/0.4, the world outside OpenOCD interfaces to
zy1000 using the old syntax. Post 0.4 release(0.4.1 even)
I'll switch to subcommand scheme.

Switch to subcommands post 0.3 lifecycle.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 years agoXScale: clean up full_context() (#2)
David Brownell [Sun, 29 Nov 2009 21:06:12 +0000 (13:06 -0800)]
XScale: clean up full_context() (#2)

Streamline the loop by continuing as soon as we know there's no
work to be done; this lets us un-indent almost everything.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoXScale: clean up full_context() (#1)
David Brownell [Sun, 29 Nov 2009 21:04:56 +0000 (13:04 -0800)]
XScale: clean up full_context() (#1)

When fetching all the registers, XScale was doing various stupid
things like calling number_to_mode() a few dozen times instead of
just once, and mapping access to each register three times (again,
instead of just once).  Stop that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoXScale: debug entry uses new register mapping
David Brownell [Sun, 29 Nov 2009 20:58:30 +0000 (12:58 -0800)]
XScale: debug entry uses new register mapping

Use the new mapping interfaces in the debug entry path.
SPSR and the banked registers now have smaller and faster
accessors ... use them.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agocreate target/pxa3xx.cfg
Marek Vasut [Sun, 29 Nov 2009 11:54:41 +0000 (12:54 +0100)]
create target/pxa3xx.cfg

[dbrownell@users.sourceforge.net; remove pxa255 comment]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoXScale: initial PXA3xx support
Marek Vasut [Sun, 29 Nov 2009 11:53:06 +0000 (12:53 +0100)]
XScale: initial PXA3xx support

[dbrownell@users.sourceforge.net: user's guide; variant param is optional]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM11: fix warning on cygwin
David Brownell [Sun, 29 Nov 2009 17:14:52 +0000 (09:14 -0800)]
ARM11: fix warning on cygwin

Previous version of JTAG_DEBUG() macro hid this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agobugfix: 'init' changes state, not main()
David Brownell [Sun, 29 Nov 2009 07:08:05 +0000 (23:08 -0800)]
bugfix: 'init' changes state, not main()

Code other than main() may invoke "init".  When it does so,
customized handlers may need to run ... so make sure the
command context state is updated before they do so.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agofix s3c24xx device command helper
lementec fabien [Sat, 28 Nov 2009 23:50:01 +0000 (15:50 -0800)]
fix s3c24xx device command helper

Returns the common structure for the s3c24xx device, which was
somehow nuked during past cleaning efforts.

15 years agoCortex-M3: don't chain "struct arm" commands
David Brownell [Sat, 28 Nov 2009 22:19:45 +0000 (14:19 -0800)]
Cortex-M3: don't chain "struct arm" commands

Those commands presume support for the "classic" set of CPU
modes (FIQ, supervisor, IRQ, etc) ... which aren't supported
by the ARMv7-M or ARMv6-M architectures.  They also presume
a "struct arm" base type, which this code doesn't use.

We haven't cleaned up the register handling enough to be able
to share any of those "base" methods.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoadd 'nonce' nand driver
Zachary T Welch [Fri, 27 Nov 2009 17:29:07 +0000 (09:29 -0800)]
add 'nonce' nand driver

The nonce NAND driver provides a no-op implementation useful for
testing the system independently of any driver side-effects.

15 years agoadd more stub handlers to testee target
Zachary T Welch [Thu, 26 Nov 2009 00:57:12 +0000 (16:57 -0800)]
add more stub handlers to testee target

Prevent everything from crashing when exercising various commands.

15 years agoexplode tcl_target_func into many handlers
Zachary T Welch [Thu, 26 Nov 2009 00:36:46 +0000 (16:36 -0800)]
explode tcl_target_func into many handlers

Eliminate the monolithic tcl_target_func by registering each of its
commands using the new chained command registration mechanism.

Also chains the target's commands under the CPU command, though these
may not work properly without some further modification.

15 years agosplit jim_target into multiple handlers
Zachary T Welch [Wed, 25 Nov 2009 20:57:28 +0000 (12:57 -0800)]
split jim_target into multiple handlers

The 'target' command group was implemented using its own command
dispatching, which can be eliminated by using the new chained command
registration mechanism.  This patch splits the jim_target() function
into individual handlers, which makes them to be visible to the help and
usage commands.  These one-trick handlers are much easier to understand.

15 years agosplit jim_newtap_cmd into pieces
Zachary T Welch [Thu, 26 Nov 2009 22:04:02 +0000 (14:04 -0800)]
split jim_newtap_cmd into pieces

Moves the ID and IR-related option parsing to static helpers, removing
two levels of indent.

15 years agoimprove jtag_tap_configure
Zachary T Welch [Thu, 26 Nov 2009 21:52:04 +0000 (13:52 -0800)]
improve jtag_tap_configure

Splits bulk of the jtag_tap_configure into jtag_tap_configure_event,
removing three or four levels of indentation in the process.
The resulting code was stylistically improved in other ways, but it
should be functionally identical.

15 years agoimprove jtag_tap_handle_event indentation
Zachary T Welch [Thu, 26 Nov 2009 19:00:03 +0000 (11:00 -0800)]
improve jtag_tap_handle_event indentation

Use 'continue' to reduce identation levels and superfluous logic.

15 years agobegin moving JTAG jim handlers/helpers
Zachary T Welch [Thu, 26 Nov 2009 16:19:40 +0000 (08:19 -0800)]
begin moving JTAG jim handlers/helpers

Moves the tertiary jim handlers and required static helpers to the top
of tcl.c, defining them in a new registration array that is chained in
both the top-level context and under the jtag command.  The top-level
commands can be removed at some point in the future to reduce clutter.

15 years agosplit jim_jtag_command into multiple handlers
Zachary T Welch [Thu, 26 Nov 2009 05:35:24 +0000 (21:35 -0800)]
split jim_jtag_command into multiple handlers

Explodes the 'jtag' into separate command handlers, which are easier
to understand and extend.  Makes the code much easier to understand,
though further simplifications are possible.  This patch tries to
minimize the noise when viewed with 'git diff -w'.

Gives these commands improved built-in help and usage information.

15 years agoremove redundant 'rm' command handler
Zachary T Welch [Sat, 28 Nov 2009 18:46:53 +0000 (10:46 -0800)]
remove redundant 'rm' command handler

Two 'rm' commands were implemented and registered.  This removes the
version that would have never been called prior to refactoring the
command registration.

15 years agoadd error checking in command_new
Zachary T Welch [Sat, 28 Nov 2009 18:42:51 +0000 (10:42 -0800)]
add error checking in command_new

Adds checks for memory allocation failures.  Started to use calloc()
instead of malloc()/memset(), but I got carried away.  This kind of work
should be done throughout the tree, but it's almost hopeless at present.

15 years agoinclude mode information in help text.
Zachary T Welch [Sat, 28 Nov 2009 20:42:06 +0000 (12:42 -0800)]
include mode information in help text.

Extends the help output to list the valid modes for each commands.
Fixes a memory leak of the returned command_name() string.

15 years agorefactor command mode detection
Zachary T Welch [Fri, 27 Nov 2009 18:16:42 +0000 (10:16 -0800)]
refactor command mode detection

Splits the check for a command's ability to run into a helper.

This also fixes a bug whereby commands that specified COMMAND_EXEC
were allowed to run during the configuration stage.  This allowed
problematic commands to be called before 'init', defeating the intention
of specifying that command mode.  With this change, the run_command()
helper denies access to handlers that should run only after 'init'
during the configuration stage.

15 years agoadd command private data setter/accessor
Zachary T Welch [Sat, 28 Nov 2009 00:30:28 +0000 (16:30 -0800)]
add command private data setter/accessor

Presently, commands registration taks a static handler data pointer.
This patch adds support for commands that require a dynamic pointer,
such as those registered in a dynamic context (e.g. subcommands for a
user-created 'foo.cpu' command).  The command_set_handler_data will
update a command (group) to use a new context pointer, while the
CMD_DATA macro allows command handlers to access the value.
Jim handlers should find this value in interp->cmdPrivData.

15 years agoadd 'command mode' introspective handler
Zachary T Welch [Sat, 28 Nov 2009 20:29:42 +0000 (12:29 -0800)]
add 'command mode' introspective handler

Allows scripts to behave different depending on the current mode.
Also allows introspection of the mode required for commands.

15 years agoremove unknown handler
Zachary T Welch [Sat, 28 Nov 2009 05:47:54 +0000 (21:47 -0800)]
remove unknown handler

Updates command registration to provide top-level handlers for all
commands, rather than falling back onto the 'unknown' command. Instead,
that same handler is registered for placeholders, providing the same
functionality under the root verb command name instead.  This permits
users to implement their own 'unknown' function, and it resolves some
mind-bending breakage related to function object lookup while recursing.

Changes 'ocd_bounce' to call 'ocd_command' and 'ocd_help' from the
wrapper directly, rather than bouncing through their wrappers. This
prevents endless recursion caused by the above changes, whereby the
'command' wrapper's type check would blow the stack to hell and gone.

15 years agoimprove command handler wrapper script
Zachary T Welch [Sat, 28 Nov 2009 03:14:30 +0000 (19:14 -0800)]
improve command handler wrapper script

Adds 'ocd_bouncer' in startup.tcl that is called as a helper for
all command handlers, shrinking the embedded C wrapper to a mere stub.

Jim handlers are called directly, simple handlers get called with the
wrapper to capture and discard their output on error, and placeholders
call help directly (though the unknown handler still does this too).
It attempts to improve the quality of the error messages as well.

15 years agoadd 'command type' introspective handler
Zachary T Welch [Sat, 28 Nov 2009 02:59:14 +0000 (18:59 -0800)]
add 'command type' introspective handler

Adds the 'command' group handler, with the 'type' command producing
a string that tells whether the given command is 'native' (for Jim-based
command handlers), 'simple' (for simple built-in commands), 'group'
for command group placeholders, and 'unknown' if not found in the
command registration tables (e.g. core built-ins functions).

15 years agoARM11: fix warning on amd64
David Brownell [Sat, 28 Nov 2009 19:55:00 +0000 (11:55 -0800)]
ARM11: fix warning on amd64

Previous version of JTAG_DEBUG() macro hid this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM11: fix dbgtap JTAG_DEBUG
David Brownell [Sat, 28 Nov 2009 19:28:17 +0000 (11:28 -0800)]
ARM11: fix dbgtap JTAG_DEBUG

There is no DEBUG() macro; don't call one!  Always at
least *parse* debug code, to help prevent such errors.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agotarget: uplevel add_{break,watch}point() error checks
David Brownell [Sat, 28 Nov 2009 18:40:26 +0000 (10:40 -0800)]
target: uplevel add_{break,watch}point() error checks

In target_type.h it's documented that the target must be
halted for add_breakpoint() ... and with slight ambiguity,
also for its add_watchpoint() sibling.  So rather than
verifying that constraint in the CPU drivers, do it in the
target_add_{break,watch}point() routines.

Add minor paranoia on the remove_*point() paths too:  save
the return value, and print it out in in the LOG_DEBUG message
in case it's nonzero.

Note that with some current cores, like all ARMv7 ones I've
looked at, there's no technical issue preventing watchpoint or
breakpoint add/remove operations on active cores.  This model
seems deeply wired into OpenOCD though.

ALSO:  the ARM targets were fairly "good" about enforcing that
constraint themselves.  The MIPS ones were relied on other code
to catch such stuff, but it's not clear such code existed ...
keep an eye out for new issues on MIPS.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agotarget: remove unused TARGET_EVENT_OLD_* symbols
David Brownell [Sat, 28 Nov 2009 18:36:32 +0000 (10:36 -0800)]
target: remove unused TARGET_EVENT_OLD_* symbols

Just two *_OLD_* symbols left...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoNEWS: mention new reset-assert event
David Brownell [Sat, 28 Nov 2009 02:53:43 +0000 (18:53 -0800)]
NEWS: mention new reset-assert event

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoomap3530.cfg: use new "reset-assert" event
David Brownell [Sat, 28 Nov 2009 02:50:31 +0000 (18:50 -0800)]
omap3530.cfg: use new "reset-assert" event

Replaces previous "reset-assert-pre" workaround.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoCortex-A8: support "reset-assert" event
David Brownell [Sat, 28 Nov 2009 02:50:26 +0000 (18:50 -0800)]
Cortex-A8: support "reset-assert" event

Use the new "reset-assert" event; else SRST; else fail.
Tested on an OMAP3, using the event.

NOTE:  still doesn't handle "reset halt".  For some reason
neither VCR nor PRCR seemed effective; they held the value
that was written, but VCR didn't trigger debug entry when
the reset vector fired (maybe the vector needs configuring?)
and PRCR refused to hold the chip in reset until deassert()
could force the core into debug state.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agotarget: groundwork for "reset-assert" event
David Brownell [Sat, 28 Nov 2009 02:50:20 +0000 (18:50 -0800)]
target: groundwork for "reset-assert" event

This defines a "reset-assert" event and a supporting utility
routine, and documents both how targets should implement it
and how config scripts should use it.  Core-specific updates
are needed to make this work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM11: write_memory() avoids increment check
David Brownell [Sat, 28 Nov 2009 02:40:37 +0000 (18:40 -0800)]
ARM11: write_memory() avoids increment check

When writing to a chip's "reset yourself" register, the ARM11 code
was reporting a spurious failure.  Just don't bother checking for
correctly incremented pointers given single-unit writes ... it's
a bit faster that way too.  (Reads should likely do the same thing.
For that matter, such checks are usually just a waste...)

Shrink an overlong parameter name, and associated lines'o'code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agofix regression causing duplicated output
Zachary T Welch [Fri, 27 Nov 2009 21:51:17 +0000 (13:51 -0800)]
fix regression causing duplicated output

The command refactoring caused subcommand handlers to produce duplicate
output when run.  The problem was introduced by failing to ensure all
such invocations went through a top-level "catcher" script, prefixing
the command name with the 'ocd_' prefix and consuming its results.

The fix is to ensure such a top-level "catcher" script gets created
for each top-level command, regardless of whether it has a handler.
Indeed, this patch removes all command registrations for sub-commands,
which would not have worked in the new registration scheme anyway.

For now, dispatch of subcommands continues to be handled by the new
'unknown' command handler, which gets fixed here to strip the 'ocd_'
prefix if searching for the top-level command name fails initially.
Some Jim commands may be registered with this prefix, and that situation
seems to require the current fallback approach.  Otherwise, that prefix
could be stripped unconditionally and the logic made a little simpler.
The same problem must be handled by the 'help' command handler too,
so its lookup process works as intended.

Overall, the command dispatching remains more complicated than desired,
but this patch fixes the immediate regressions.

15 years agozy1000: keep up with new command registration stuff
Øyvind Harboe [Fri, 27 Nov 2009 19:41:06 +0000 (20:41 +0100)]
zy1000: keep up with new command registration stuff

jim and classic style commands are both supported.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 years agoupdate minidummy interface driver command handling
Zachary T Welch [Fri, 27 Nov 2009 19:02:54 +0000 (11:02 -0800)]
update minidummy interface driver command handling

Changes the interface definition field reference from register_commands
to commands, which allows the module to compile.

15 years agofix 'nand info' command
Zachary T Welch [Fri, 27 Nov 2009 17:57:25 +0000 (09:57 -0800)]
fix 'nand info' command

Move device argument parsing after check for number of arguments;
otherwise, calling this command without any arguments would access
argv[0] before checking whether it even existed.

15 years agozy1000: keep up with changes to log_init()
Øyvind Harboe [Fri, 27 Nov 2009 18:41:22 +0000 (19:41 +0100)]
zy1000: keep up with changes to log_init()

fn's and return value for log_init() changed to void.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 years agominidummy: fix compilation error
Øyvind Harboe [Fri, 27 Nov 2009 08:10:37 +0000 (09:10 +0100)]
minidummy: fix compilation error

during refactoring a search and replace error crept in

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 years agoARM NAND I/O header documentation update.
Dean Glazeski [Mon, 16 Nov 2009 18:47:45 +0000 (12:47 -0600)]
ARM NAND I/O header documentation update.

Fixed the header file to properly specify the doxygen documentation for the
items defined in it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM NAND I/O documentation update.
Dean Glazeski [Mon, 16 Nov 2009 18:43:39 +0000 (12:43 -0600)]
ARM NAND I/O documentation update.

This updates the functions in the file to all have doxygen comments
describing what they do.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM NAND I/O refactor code copying.
Dean Glazeski [Mon, 16 Nov 2009 18:26:21 +0000 (12:26 -0600)]
ARM NAND I/O refactor code copying.

Created a function for copying code to the working area on
a target.  The NAND write and read functions are updated to
include use of this function.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM NAND I/O read function.
Dean Glazeski [Sun, 15 Nov 2009 08:32:38 +0000 (02:32 -0600)]
ARM NAND I/O read function.

Implementation of the NAND read function for ARM NAND I/O that
includes running a local algorithm on a device to increase the
performance of block reads.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoNAND Flash documentation update.
Dean Glazeski [Tue, 17 Nov 2009 20:16:23 +0000 (14:16 -0600)]
NAND Flash documentation update.

Updated doxygen comments for different interface structures for
the NAND interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoXScale: add stub {read,write}_phys routines
David Brownell [Thu, 26 Nov 2009 20:00:56 +0000 (12:00 -0800)]
XScale: add stub {read,write}_phys routines

Just make these fail, instead of letting them write over
potentially random memory.  Users should be able to work
around the lack of real implementations by disbling the
MMU by hand ... until someone provides a Real Fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoupdate bug reporting information
Uwe Hermann [Tue, 24 Nov 2009 19:42:42 +0000 (20:42 +0100)]
update bug reporting information

The Berlios bug-tracker is disabled, bug reports go to the list.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
15 years agofix typos in documentation
Uwe Hermann [Tue, 24 Nov 2009 19:28:21 +0000 (20:28 +0100)]
fix typos in documentation

Fixes some minor typos in the top-level documentation files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
15 years agofix typos in source files
Uwe Hermann [Tue, 24 Nov 2009 19:01:15 +0000 (20:01 +0100)]
fix typos in source files

Correct some spelling errors in source comments and printed output.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
15 years agostyleguide: add some embedded style rules.
Øyvind Harboe [Tue, 24 Nov 2009 19:26:40 +0000 (20:26 +0100)]
styleguide: add some embedded style rules.

Embedded and pthreads rely on modest and predictable
stack usage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
15 years agofix 'flash protect' and 'flash erase_sector'
Eric Wetzel [Thu, 26 Nov 2009 15:54:45 +0000 (07:54 -0800)]
fix 'flash protect' and 'flash erase_sector'

Command upgrading introduced two off-by-one bugs in the flash commands.
This patch fixes the 'flash {protect,erase_sector}' commands to check
that they have been passed the correct number of arguments.

Ammended during commit to fix help text for 'erase_address' too.

15 years agotarget: create and use target_name()
David Brownell [Thu, 26 Nov 2009 00:38:08 +0000 (16:38 -0800)]
target: create and use target_name()

Several of the sites now using target_type_name() really
ought to be using an instance-specific name.  Create a
function called target_name(), accessing the instance's
own (command) name.

Use it in several places that really should be displaying
instance-specific names.  Also in several places which
were already doing so, but which had no wrapper to call.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agotarget: target_get_name() --> target_type_name()
David Brownell [Thu, 26 Nov 2009 00:38:08 +0000 (16:38 -0800)]
target: target_get_name() --> target_type_name()

There are two names that may matter on a per-target basis.
One is a per-instance name (for example, "at91sam7s.cpu").
The other is the name of its type (for example, "arm7tdmi"),
which is shared among multiple targets.

Currently target_get_name() returns the type name, which is
misleading and is rarely appropriate for target diagnostics.
Rename that as target_type_name().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoomap3530.cfg: yes we have SRAM!
David Brownell [Thu, 26 Nov 2009 00:19:53 +0000 (16:19 -0800)]
omap3530.cfg: yes we have SRAM!

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
15 years agoARM: minor armv4/armv5 cleanup
David Brownell [Thu, 26 Nov 2009 00:18:22 +0000 (16:18 -0800)]
ARM: minor armv4/armv5 cleanup

Lines of 300+ characters are still bad; debug tweaks.

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