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.
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>
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>
Zachary T Welch [Sat, 21 Nov 2009 00:36:32 +0000 (16:36 -0800)]
log: improve initialization
Removes redundant assignment of start_ms from log_register_commands().
Eliminates command_context parameter and return value.
Adds Doxygen comment block for this API call.
Zachary T Welch [Sun, 22 Nov 2009 06:09:53 +0000 (22:09 -0800)]
add 'testee' target type
Alliteration aside, this should provide the final piece of the puzzle
for developers that want to get started writing a new target type.
In this way, it also seeks to complement the 'dummy' interface driver
and 'faux' NOR flash driver.
Zachary T Welch [Sun, 22 Nov 2009 03:27:20 +0000 (19:27 -0800)]
improve command handling examples
Removes hello and foo commands from top-level registration. Instead,
the dummy interface driver and faux flash driver have been augmented
to register these commands as sub-commands.
Zachary T Welch [Wed, 25 Nov 2009 03:13:03 +0000 (19:13 -0800)]
encapsulate and re-use log capture, retval setup
Factors log capture while running script commands, eliminating
duplicated code between script_command and jim_capture. Factors
setting a command's Jim "retval" into a new helper as well.
Using these new helpers in the new unknown command handler's
fixes possible regressions caused by these bits being missing.
Zachary T Welch [Mon, 23 Nov 2009 20:16:27 +0000 (12:16 -0800)]
allow scripts to update usage information
The add_usage_text command uses the same C handler, which was updated
to support its new polymorphic role. This patch updates the two script
commands that needed this support: 'find' and 'script'.
Zachary T Welch [Tue, 24 Nov 2009 18:58:32 +0000 (10:58 -0800)]
httpd: use register_commands()
Updates httpd_start() to use register_commands() for 'readform' and
'writeform' commands. Adds server/httpd.h to export the new signatures
for this function (and httpd_stop), which allows removing the obsoleted
declarations inside openocd.c.
Zachary T Welch [Mon, 23 Nov 2009 23:03:04 +0000 (15:03 -0800)]
add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper. All command registrations now go through the
register_command{,s}() functions.
Zachary T Welch [Mon, 23 Nov 2009 16:24:02 +0000 (08:24 -0800)]
remove register_commands from etm_capture_driver
Converts callback to an array of command_registration records.
Moves oocd_trace driver definition to end of file to eliminate
useless forward declaration.
Zachary T Welch [Mon, 23 Nov 2009 16:17:01 +0000 (08:17 -0800)]
remove target_type register_command callback
Uses chaining of command_registration structures to eliminate all
target_type register_callback routines. Exports the command_handler
registration arrays for those target types that are used by others.
Zachary T Welch [Sat, 21 Nov 2009 06:01:59 +0000 (22:01 -0800)]
remove register_callbacks from jtag interface
Changes the jtag_interface->register_callbacks field to a list of
commands to be registered. Changes callback to invocation of
register_commands() with that command registration list. Removes all
JTAG interface driver register_command callback functions, which the
previous commits had converted into identical calls.
Zachary T Welch [Sat, 21 Nov 2009 03:58:07 +0000 (19:58 -0800)]
at91rm9200: use register_commands()
Use register_commands() with command registration array.
---
This module was broken by previous changes, but no one has complained.
Are there still users for this modules?
Zachary T Welch [Sat, 21 Nov 2009 23:52:12 +0000 (15:52 -0800)]
demonstrate chaining with foo commands
Use the new command registration chaining capabilities to eliminate
the foo_register_commands helper, folding its remaining command
handler setup into the hello_command_handlers registration array.
Zachary T Welch [Sat, 21 Nov 2009 21:59:51 +0000 (13:59 -0800)]
add command registration chaining
Adds the ability to chain registration structures. Modules can define a
command with the 'chain' and 'num_chain' fields defined in their
registration table, and the register_commands() function will initialize
these commands. If the registration record creates a new command, then
the chained commands are created under it; otherwise, they are created
in the same context as the other commands (i.e. the parent argument).
Zachary T Welch [Fri, 20 Nov 2009 21:36:07 +0000 (13:36 -0800)]
command: use register_commands for handlers
Use register_commands() to register low-level command handlers,
adding a builtin_command_handlers declaration that is easy to understand.
Splits help and usage information into their appropriate fields.
Zachary T Welch [Fri, 20 Nov 2009 22:07:28 +0000 (14:07 -0800)]
add command usage, separate from help
Adds the usage command, to display usage information for commands.
The output for this command will remain erronenously empty until
commands are updated to use these new coventions.
Zachary T Welch [Fri, 20 Nov 2009 20:46:06 +0000 (12:46 -0800)]
add register_commands for batch registration
The register_commands API takes multiple commands in one call, allowing
modules to declare and pass a much simpler (and more explicit) array of
command_registration records.
Zachary T Welch [Fri, 20 Nov 2009 19:23:34 +0000 (11:23 -0800)]
add struct command_registration
Add a structure to encapsulate command registration information, rather
than passing them all as parameters. Enables further API changes that
require additional required or optional parameters.
Updates the register_command API and COMMAND_REGISTER macro to use it,
along with their documentation.
David Brownell [Wed, 25 Nov 2009 05:24:44 +0000 (21:24 -0800)]
Cortex-A8: avoid DSCR reads
There was a lot of needless handshaking overhead in the current
Cortex-A8 DCC/ITR operations, since the status read by each step
was discarded rather than letting the next step know it.
This shrinks the handshaking by: (a) passing status along from
previous steps, avoiding re-fetching; which enables the big win
(b) relying on a useful invariant: that the DSCR_INSTR_COMP bit
is set after every call to a DPM method.
A "reg sp_usr" call previously took 17 flushes; now it takes just 9.
This visibly speeds common operations like entry to debug state and
stepping, as well as "arm reg" and so on.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
David Brownell [Wed, 25 Nov 2009 05:24:44 +0000 (21:24 -0800)]
Cortex-A8: hook up DPM
This replaces two versions of register access functions. One
was commented out, and seemed to have uncertain intent. The
other was fairly new, and helped motivate the DPM framework
once I observed that the ARM11 was doing the very same ops.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>