Commit Graph

3398 Commits (2a4a94b7ac4401802832f37ef07b0500efc92f0e)

Author SHA1 Message Date
Zachary T Welch 2a4a94b7ac at91sam3: use register_commands() 2009-11-24 21:37:34 -08:00
Zachary T Welch 8d46720cda 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.
2009-11-24 21:37:33 -08:00
Zachary T Welch fc2d9f8761 vsllink: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 355a673032 jtag: use register_commands()
Use register commands with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 9a31d66b3f presto: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 339e08baa5 parport: use register_commands()
Use register_commands() with a command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch b1d034bf2f jlink: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 779bdbe797 gw16012: use register_commands()
Use register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 3ab599a7e4 ft2232: use register_commands()
Use register_commands() with a command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 30be874de8 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?
2009-11-24 21:37:33 -08:00
Zachary T Welch 0af32bb938 arm-jtag-ew: use register_commands()
Uses register_commands() with command registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch 48429dcfad amt_jtagaccel: use register_commands()
Use register_commands() with command_registration array.
2009-11-24 21:37:33 -08:00
Zachary T Welch e2f23c5437 pld: use static registration instead of callback
Remove register_callbacks from pld_device structure, using an array
of command_registration records instead.
2009-11-24 21:37:33 -08:00
Zachary T Welch 76b89755c9 pld: use register_commands()
Updates core PLD and virtex2 commands to use register_commands().
2009-11-24 21:37:33 -08:00
Zachary T Welch 75e37b5348 {,x}svf: use register_commands()
Use register_commands() for registering {,x}svf commands.
2009-11-24 21:37:33 -08:00
Zachary T Welch b4c4b5f71e server: use register_commands
Converts server directory to use new command registration paradigm.
2009-11-24 21:37:32 -08:00
Zachary T Welch 29772ec372 log: use register_commands()
Use register_commands() for logging callbacks.  Improve help and add
proper usage.
2009-11-24 21:37:32 -08:00
Zachary T Welch 8de1e7bd9e ioutil: use register_commands()
Use table instead of individual calls.  Add proper usage information.
2009-11-24 21:37:32 -08:00
Zachary T Welch 1595fd7c4b openocd: use register_commands()
Use register_commands() for top-level version and init command.
2009-11-24 21:37:32 -08:00
Zachary T Welch 16e0404777 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.
2009-11-24 21:37:32 -08:00
Zachary T Welch e7fd1d3d50 hello: use register_commands()
Use new register_commands() with command registration table.
2009-11-24 21:37:32 -08:00
Zachary T Welch 62e5649600 rewrite 'unknown' command dispatching in C
Rewrite the magical 'unknown' command in C as a Jim handler, allowing
it to dispatch commands to any level in the tree.
2009-11-24 21:37:30 -08:00
Zachary T Welch 769fbfa058 add public API for locating commands
Allow other modules to find a command, primarily for the purpose of
registering and unregistering subcommands.
2009-11-24 21:37:30 -08:00
Zachary T Welch 4c54c27da7 refactor script_command context grabbing
Move command context acquisition to current_command_context() for re-use.
2009-11-24 21:37:30 -08:00
Zachary T Welch 60ba4641d6 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).
2009-11-24 21:37:30 -08:00
Zachary T Welch 607634f967 more command registration refactoring
Split out the handler registration into its own function, and add a
few obviously missing NULL pointer error checking.
2009-11-24 21:37:30 -08:00
Zachary T Welch 25a7ac2c75 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.
2009-11-24 21:37:30 -08:00
Zachary T Welch d107f71c50 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.
2009-11-24 21:37:29 -08:00
Zachary T Welch 2461855494 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.
2009-11-24 21:37:29 -08:00
Zachary T Welch 69076057dd 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.
2009-11-24 21:37:29 -08:00
Zachary T Welch 833e7f5248 use COMMAND_REGISTER macro
Replaces direct calls to register_command() with a macro, to allow
its parameters to be changed and callers updated in phases.
2009-11-24 21:37:29 -08:00
Zachary T Welch f7e1f2df74 add COMMAND_REGISTER macro
Provides a migration path for the widely used register_command API,
which needs to be updated to provide new functionality.

This macro allows the API to change without having to update all of its
callers at the same time.
2009-11-24 21:37:29 -08:00
Zachary T Welch 47cb10217a improve startup tcl scripts
Fix a couple of layering violations missed in the last round.
Add missing comment headers.
2009-11-24 21:37:29 -08:00
David Brownell b6210907ea 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>
2009-11-24 21:24:44 -08:00
David Brownell e109bb6af2 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>
2009-11-24 21:24:44 -08:00
David Brownell c008d30fe8 Cortex-A8: implement DPM
This implements the DPM interface for Cortex-A8 cores.  It
also adds a synchronization operation to the DPM framework,
which is needed by the Cortex-A8 after CPSR writes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-24 21:24:44 -08:00
David Brownell 991daa03eb Cortex-A8: minor cleanup
Make various functions static, add some comments, report
vector catch as a flavor of DBG_REASON_BREAKPOINT, get
rid of needless/undesirable ARMV4_5_CORE_REG_MODE, etc.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-24 21:24:44 -08:00
Andreas Fritiofson 338a674faa improve alloc_vprintf
The previous implementation was unnecessarily complex. Get rid of the loops,
let vsnprintf() tell us directly how much storage we need and allocate that. A
second pass writes the actual string. Also add a va_end() that was missing.
This should be much faster for large strings and less wasteful for small ones.

A quirk that has been retained is that some callers patch in a newline at the
end of the returned string and depend on alloc_vprintf to allocate at least
one byte extra.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-24 12:48:02 -08:00
Zachary T Welch 5507b5f430 fix doxygen build
Update build rules to skip the PDF unless the TeX has been created.
Also, fixes a warning regarding pattern rules being a GNU make trick.
2009-11-24 09:17:52 -08:00
Zachary T Welch 96f0ab894a jlink: rewrite to use jtag_usb_open
Rewrite jlink_usb_open to use jtag_usb_open helper.
2009-11-24 07:30:20 -08:00
Zachary T Welch 31fc1586a0 jlink: remove superfluous indentation
Rewrite logic to remove indentation in jlink_usb_open, in prep
for further surgery.
2009-11-24 07:30:20 -08:00
Zachary T Welch 9a21ef7614 rlink: use jtag_usb_open helper
Rewrite rlink_init routine to use jtag_usb_open helper.  Eliminates
some spurious calls to exit().

Wraps a tremendously long line of comment to fit 80 columns too.
2009-11-24 07:30:20 -08:00
Zachary T Welch ec5e484fd6 rlink: eliminate spurious indentation
Rework rlink_init to use less indentation.  Best viewed with diff -w.
2009-11-24 07:30:19 -08:00
Zachary T Welch de9a182ca6 vsllink: rewrite to use jtag_usb_open
Rewrite vsllink_usb_open to use jtag_usb_open helper.

Eliminates spurious calls to exit().
2009-11-24 07:30:19 -08:00
Zachary T Welch 0f544f4310 usbprog: use jtag_usb_open
Rewrite usbprob_jtag_open to use jtag_usb_open helper.
2009-11-24 07:30:19 -08:00
Zachary T Welch d836b079b4 arm-jtag-ew: use jtag_usb_open
Rewrite armjtagwe_usb_open to use jtag_usb_open.
2009-11-24 07:30:19 -08:00
Zachary T Welch 3a660e2293 add jtag/usb_common.[ch] files
Begins to consolidate code used by several USB JTAG interfaces.
This first patch provides the required build system changes and
a common jtag_usb_open routine, which will replace the guts for
probing the busses and devices for possible VID/PID matches.
The following patches convert each driver to use it.
2009-11-24 07:30:19 -08:00
David Brownell 3efc99b34a ARM11: remove old R0..R15/CPSR code
This finishes the basic switchover to the new register code,
for everything except the debug registers.  (And maybe we
shouldn't have a cache for *those* which works this way...)

The context save/restore code now uses the new code, but
it's in a slightly different sequence.  That should be fine
since the R0/PC/CPSR stuff is all that really matters (and
if we can update those, we can update the rest).

Now there's no longer a way any code can be confused about
which copy of "r1" (etc) to use.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-24 01:27:29 -08:00
David Brownell ec64acf536 ARM11: use standard run_algorithm()
As with single stepping, the previous stuff was needed because
the ARM11 code wasn't using the standard ARM base type and
register access ... but now those mechanisms work, so we can
switch out that special-purpose glue, in favor of the more
thoroughly tested/capable "standard" code.

Fixes a bug in the resume() implementation:  it wasn't handling
two of its arguments correctly, preventing the "flash erase_check"
algorithm from working.  (This code needs a *subsequent* update
for correct register handling, though... removing the confusion
about which "r2", for example, to use.)

This should resolve some "FIXME" comments too, for Thumb and
processor mode support.  It also gets rid of a nasty exit()
call; servers should only have *clean* shutdown paths.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-24 01:27:24 -08:00
David Brownell bf3abc48f0 ARM11: use standard single step simulation
The previous stuff was needed because the ARM11 code wasn't using
the standard ARM base type and register access ... but now those
mechanisms work, so we can switch out that special-purpose glue.

This should resolve all the "FIXME -- handle Thumb single stepping"
comments too, and properly handle the processor's mode.  (Modulo
the issue that this code doesn't yet handle two-byte breakpoints.)

Clarify the comments about the the hardware single stepping.  When
we eventually share breakpoint code with Cortex-A8, we can just make
that be the default on cores which support it.  We may still want an
override command, not just to facilitate testing but to cope with
"instruction address mismatch" not quite being true single-step.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-24 01:27:21 -08:00