]> git.sur5r.net Git - openocd/log
openocd
14 years agonand: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
nand: use register_commands()

Eliminates 'nand_cmd' global variable.

14 years agomflash: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
mflash: use register_commands()

14 years agolpc3180_nand_controller: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
lpc3180_nand_controller: use register_commands()

14 years agolpc2900: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
lpc2900: use register_commands()

14 years agolpc2000: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
lpc2000: use register_commands()

14 years agoflash: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
flash: use register_commands()

Eliminates 'flash_cmd' global variable.

14 years agoecos: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
ecos: use register_commands()

14 years agocfi: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
cfi: use register_commands()

14 years agoavrf: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
avrf: use register_commands()

14 years agoat91sam7: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
at91sam7: use register_commands()

14 years agoat91sam3: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 12:13:56 +0000 (04:13 -0800)]
at91sam3: use register_commands()

14 years agoremove register_callbacks from jtag interface
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.

14 years agovsllink: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 05:06:28 +0000 (21:06 -0800)]
vsllink: use register_commands()

Use register_commands() with command registration array.

14 years agojtag: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 05:02:28 +0000 (21:02 -0800)]
jtag: use register_commands()

Use register commands with command registration array.

14 years agopresto: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 05:00:23 +0000 (21:00 -0800)]
presto: use register_commands()

Use register_commands() with command registration array.

14 years agoparport: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 04:17:52 +0000 (20:17 -0800)]
parport: use register_commands()

Use register_commands() with a command registration array.

14 years agojlink: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 04:12:21 +0000 (20:12 -0800)]
jlink: use register_commands()

Use register_commands() with command registration array.

14 years agogw16012: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 04:11:58 +0000 (20:11 -0800)]
gw16012: use register_commands()

Use register_commands() with command registration array.

14 years agoft2232: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 04:06:50 +0000 (20:06 -0800)]
ft2232: use register_commands()

Use register_commands() with a command registration array.

14 years agoat91rm9200: use register_commands()
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?

14 years agoarm-jtag-ew: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 03:56:02 +0000 (19:56 -0800)]
arm-jtag-ew: use register_commands()

Uses register_commands() with command registration array.

14 years agoamt_jtagaccel: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 03:53:28 +0000 (19:53 -0800)]
amt_jtagaccel: use register_commands()

Use register_commands() with command_registration array.

14 years agopld: use static registration instead of callback
Zachary T Welch [Mon, 23 Nov 2009 17:30:02 +0000 (09:30 -0800)]
pld: use static registration instead of callback

Remove register_callbacks from pld_device structure, using an array
of command_registration records instead.

14 years agopld: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 09:50:22 +0000 (01:50 -0800)]
pld: use register_commands()

Updates core PLD and virtex2 commands to use register_commands().

14 years ago{,x}svf: use register_commands()
Zachary T Welch [Sun, 22 Nov 2009 09:11:18 +0000 (01:11 -0800)]
{,x}svf: use register_commands()

Use register_commands() for registering {,x}svf commands.

14 years agoserver: use register_commands
Zachary T Welch [Sat, 21 Nov 2009 22:42:05 +0000 (14:42 -0800)]
server: use register_commands

Converts server directory to use new command registration paradigm.

14 years agolog: use register_commands()
Zachary T Welch [Fri, 20 Nov 2009 23:52:18 +0000 (15:52 -0800)]
log: use register_commands()

Use register_commands() for logging callbacks.  Improve help and add
proper usage.

14 years agoioutil: use register_commands()
Zachary T Welch [Fri, 20 Nov 2009 23:47:08 +0000 (15:47 -0800)]
ioutil: use register_commands()

Use table instead of individual calls.  Add proper usage information.

14 years agoopenocd: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 00:58:45 +0000 (16:58 -0800)]
openocd: use register_commands()

Use register_commands() for top-level version and init command.

14 years agodemonstrate chaining with foo commands
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.

14 years agohello: use register_commands()
Zachary T Welch [Sat, 21 Nov 2009 21:49:00 +0000 (13:49 -0800)]
hello: use register_commands()

Use new register_commands() with command registration table.

14 years agorewrite 'unknown' command dispatching in C
Zachary T Welch [Sun, 22 Nov 2009 03:55:50 +0000 (19:55 -0800)]
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.

14 years agoadd public API for locating commands
Zachary T Welch [Sun, 22 Nov 2009 09:48:55 +0000 (01:48 -0800)]
add public API for locating commands

Allow other modules to find a command, primarily for the purpose of
registering and unregistering subcommands.

14 years agorefactor script_command context grabbing
Zachary T Welch [Sun, 22 Nov 2009 04:00:37 +0000 (20:00 -0800)]
refactor script_command context grabbing

Move command context acquisition to current_command_context() for re-use.

14 years agoadd command registration chaining
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).

14 years agomore command registration refactoring
Zachary T Welch [Sat, 21 Nov 2009 21:33:32 +0000 (13:33 -0800)]
more command registration refactoring

Split out the handler registration into its own function, and add a
few obviously missing NULL pointer error checking.

14 years agocommand: use register_commands for handlers
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.

14 years agoadd command usage, separate from help
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.

14 years agoadd register_commands for batch registration
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.

14 years agoadd struct command_registration
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.

14 years agouse COMMAND_REGISTER macro
Zachary T Welch [Fri, 20 Nov 2009 19:26:35 +0000 (11:26 -0800)]
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.

14 years agoadd COMMAND_REGISTER macro
Zachary T Welch [Fri, 20 Nov 2009 19:30:00 +0000 (11:30 -0800)]
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.

14 years agoimprove startup tcl scripts
Zachary T Welch [Sun, 22 Nov 2009 03:41:21 +0000 (19:41 -0800)]
improve startup tcl scripts

Fix a couple of layering violations missed in the last round.
Add missing comment headers.

14 years agoCortex-A8: avoid DSCR reads
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>
14 years agoCortex-A8: hook up DPM
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>
14 years agoCortex-A8: implement DPM
David Brownell [Wed, 25 Nov 2009 05:24:44 +0000 (21:24 -0800)]
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>
14 years agoCortex-A8: minor cleanup
David Brownell [Wed, 25 Nov 2009 05:24:44 +0000 (21:24 -0800)]
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>
14 years agoimprove alloc_vprintf
Andreas Fritiofson [Tue, 24 Nov 2009 20:24:06 +0000 (21:24 +0100)]
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>
14 years agofix doxygen build
Zachary T Welch [Tue, 24 Nov 2009 16:59:45 +0000 (08:59 -0800)]
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.

14 years agojlink: rewrite to use jtag_usb_open
Zachary T Welch [Thu, 19 Nov 2009 20:57:32 +0000 (12:57 -0800)]
jlink: rewrite to use jtag_usb_open

Rewrite jlink_usb_open to use jtag_usb_open helper.

14 years agojlink: remove superfluous indentation
Zachary T Welch [Thu, 19 Nov 2009 20:41:25 +0000 (12:41 -0800)]
jlink: remove superfluous indentation

Rewrite logic to remove indentation in jlink_usb_open, in prep
for further surgery.

14 years agorlink: use jtag_usb_open helper
Zachary T Welch [Thu, 19 Nov 2009 20:25:16 +0000 (12:25 -0800)]
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.

14 years agorlink: eliminate spurious indentation
Zachary T Welch [Thu, 19 Nov 2009 20:12:21 +0000 (12:12 -0800)]
rlink: eliminate spurious indentation

Rework rlink_init to use less indentation.  Best viewed with diff -w.

14 years agovsllink: rewrite to use jtag_usb_open
Zachary T Welch [Thu, 19 Nov 2009 20:11:03 +0000 (12:11 -0800)]
vsllink: rewrite to use jtag_usb_open

Rewrite vsllink_usb_open to use jtag_usb_open helper.

Eliminates spurious calls to exit().

14 years agousbprog: use jtag_usb_open
Zachary T Welch [Thu, 19 Nov 2009 20:09:11 +0000 (12:09 -0800)]
usbprog: use jtag_usb_open

Rewrite usbprob_jtag_open to use jtag_usb_open helper.

14 years agoarm-jtag-ew: use jtag_usb_open
Zachary T Welch [Thu, 19 Nov 2009 20:06:05 +0000 (12:06 -0800)]
arm-jtag-ew: use jtag_usb_open

Rewrite armjtagwe_usb_open to use jtag_usb_open.

14 years agoadd jtag/usb_common.[ch] files
Zachary T Welch [Thu, 19 Nov 2009 20:02:07 +0000 (12:02 -0800)]
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.

14 years agoARM11: remove old R0..R15/CPSR code
David Brownell [Tue, 24 Nov 2009 09:27:29 +0000 (01:27 -0800)]
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>
14 years agoARM11: use standard run_algorithm()
David Brownell [Tue, 24 Nov 2009 09:27:24 +0000 (01:27 -0800)]
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>
14 years agoARM11: use standard single step simulation
David Brownell [Tue, 24 Nov 2009 09:27:21 +0000 (01:27 -0800)]
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>
14 years agoARM11: partial support for standard ARM register interfaces.
David Brownell [Tue, 24 Nov 2009 09:27:16 +0000 (01:27 -0800)]
ARM11: partial support for standard ARM register interfaces.

This provides "standard" ARM register support -- with twenty or
more shadow registers on top of what this code now handles, but
properly associated with the various core modes -- parallel to
the current register code.  That is, the current code is stilil
managing the "current" registers; the new code shadows them.

You can see all the registers with "arm reg", modify the shadows
like "r8_fiq" or "sp_abt" with "reg", and see them get properly
written back when you step.  (Just don't do that with any of the
registers managed by the "old" code ...)

It also switches to using more standard code, relying on those
standard registers, in two places:  (a) the poll status display,
which now shows core state (ARM/Thumb/...) and mode (Supervisor,
IRQ, etc); and (b) GDB register access.

So it's not a full migration, there are warts -- every place that
touches the old register cache is a potential bug -- but it's a
small more-or-less-comprehensible step that's even somewhat useful.
Later patches complete the migration.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: remove register "history" debug stuff
David Brownell [Tue, 24 Nov 2009 08:14:15 +0000 (00:14 -0800)]
ARM11: remove register "history" debug stuff

This was a private mechanism to snapshot registers before leaving
debug state, and then on reentry to optionally display what changed.
It was coupled to the private register cache, which won't be sticking
around in that form for much longer.  Remove (instead of teaching
it how to handle *all* the registers).

(The idea is interesting, but we ought to be able to implement
this in a generic way.  Ideally through Tcl scripts that can
automatically be invoked following debug entry...)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: implement provider for new DPM interface
David Brownell [Tue, 24 Nov 2009 08:14:06 +0000 (00:14 -0800)]
ARM11: implement provider for new DPM interface

This is a very thin layer over some of the current ARM11
debug TAP utilities.  The layer isn't yet hooked up.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: new DPM interface
David Brownell [Tue, 24 Nov 2009 08:13:58 +0000 (00:13 -0800)]
ARM: new DPM interface

First version of interface for sharing code between ARMv6 and ARMv7a
debug modules ... now the architecture includes debug support.  (Not
the same as for the trimmed-down v7m or v6m though!)  This is a first
version of an interface that will let the ARM11 and Cortex-A8 support
share code, features, and bugfixes.  Based on existing code from both
of those cores.

The ARM v7-AR architecture specification calls this commonality the
"Debug Programmer's Model (DPM)", which seemed to be an appropriate
acronym -- a TLA even! -- for use in our code.  Made it so.  :)

The initial scope of this just supports register access, and is geared
towards supporting top level "struct arm" mechanisms.  Later, things
like breakpoint and watchpoint support should be included.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: cope with *any* error setting a breakpoint
David Brownell [Tue, 24 Nov 2009 08:13:43 +0000 (00:13 -0800)]
target: cope with *any* error setting a breakpoint

It's wrong to map unrecognized failure codes to success.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agosupport for scripts in $HOME/.openocd
Andreas Fritiofson [Mon, 23 Nov 2009 23:32:54 +0000 (00:32 +0100)]
support for scripts in $HOME/.openocd

Add $HOME/.openocd as the first default script search directory, allowing
the user to override the standard scripts.

Update the user guide with information on where OpenOCD expects to find
configuration files and scripts. Also fixed some minor formatting issues.

Add entry to NEWS as well.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agomips: fix gaffe when removing dynamic array allocation
Jerry Ling [Mon, 23 Nov 2009 11:11:54 +0000 (12:11 +0100)]
mips: fix gaffe when removing dynamic array allocation

Classic sizeof() gaffe.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoarm926ejs: fix gaffe when converting from arm926ejs cp15 to mcr
Øyvind Harboe [Mon, 23 Nov 2009 17:23:10 +0000 (18:23 +0100)]
arm926ejs: fix gaffe when converting from arm926ejs cp15 to mcr

the first arg is the register number 15 = cp15.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoarm926ejs: retire cp15 commands, handled by mrc/mcr.
Øyvind Harboe [Mon, 26 Oct 2009 13:08:43 +0000 (14:08 +0100)]
arm926ejs: retire cp15 commands, handled by mrc/mcr.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM11: remove unused state and exports
David Brownell [Sun, 22 Nov 2009 23:51:16 +0000 (15:51 -0800)]
ARM11: remove unused state and exports

For now there's no point in saving this stuff after examine()
checks it out as OK.  Ditto exporting symbols that aren't
used outside of the module which defines them.  In fact, those
two things needlessly complicate the code...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: macro cleanup
David Brownell [Sun, 22 Nov 2009 23:50:24 +0000 (15:50 -0800)]
ARM11: macro cleanup

Make this code look more like the rest of the OpenOCD code.

 - Use calloc() directly, not NEW() ... and fix some potential
   memory leaks while we're at it.

 - Remove FNC_INFO ... it's a NOP that just clutters things,
   and it's trivial for developers to add tracing as needed.

 - Replace FNC_INFO_NOTIMPLEMENTED with LOG_WARNING calls;
   ditto.  And stop having those call sites wrongly succeed!

 - Waste less space with the CHECK_RETVAL() macro.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agomips: remove dynamic arrays - reduces stack usage
Øyvind Harboe [Sun, 22 Nov 2009 19:23:34 +0000 (20:23 +0100)]
mips: remove dynamic arrays - reduces stack usage

Allocate working memory dynamically.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agomips: use const for code sequences
Øyvind Harboe [Sun, 22 Nov 2009 19:18:26 +0000 (20:18 +0100)]
mips: use const for code sequences

This will allow data to be allocated in read only
memory instead of on the stack. Speeds things up
and reduces stack usage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoarm11: do not use dynamic arrays
Øyvind Harboe [Sun, 22 Nov 2009 18:57:57 +0000 (19:57 +0100)]
arm11: do not use dynamic arrays

Allocate working memory dynamically, caught by checkstack.pl

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoarm926ejs: fix warnings
Øyvind Harboe [Sun, 22 Nov 2009 18:52:37 +0000 (19:52 +0100)]
arm926ejs: fix warnings

buf_set_u32() operated on an uninitialized stack
variable with non-byte boundaries, which led to
warnings about reading uninitialized stack.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoTODO: ref 'checkstack.pl' not 'checkpatch.pl'
David Brownell [Sun, 22 Nov 2009 18:28:19 +0000 (10:28 -0800)]
TODO: ref 'checkstack.pl' not 'checkpatch.pl'

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: use arm_reg_current()
David Brownell [Sun, 22 Nov 2009 18:21:48 +0000 (10:21 -0800)]
ARM: use arm_reg_current()

Start using the arm_reg_current() call.  This shrinks and speeds
the affected code.  It can also prevent some coredumps coming from
invalid CPSR values ... the ARMV4_5_CORE_REG_MODE() macro returns
bogus registers if e.g. "Secure Monitor" mode isn't supported by
the current CPU.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: remove needless string format #ifdeffery
David Brownell [Sun, 22 Nov 2009 18:21:22 +0000 (10:21 -0800)]
ARM11: remove needless string format #ifdeffery

We don't need to use size_t in these places; so it's easy
to be rid of the need for this #ifdef and its MS-derived
portability problems.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: make register flags "bool"
David Brownell [Sun, 22 Nov 2009 18:20:14 +0000 (10:20 -0800)]
target: make register flags "bool"

Mostly for clarity, but it also saves code and data space.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: remove 'armv4_5_common_s' migration #define
David Brownell [Sun, 22 Nov 2009 18:19:58 +0000 (10:19 -0800)]
ARM: remove 'armv4_5_common_s' migration #define

Finish migrating from the old symbol to the new one.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoflash: dynamically allocate working storage
Øyvind Harboe [Sun, 22 Nov 2009 18:06:44 +0000 (19:06 +0100)]
flash: dynamically allocate working storage

Allocate working memory rather than using stack.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agotarget: reduce stack usage
Øyvind Harboe [Sun, 22 Nov 2009 17:58:42 +0000 (18:58 +0100)]
target: reduce stack usage

4096 byte buffer allocated dynamically. Better
for embedded OS's.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agotodo: add tip on how to identify excessive stack usage
Øyvind Harboe [Sun, 22 Nov 2009 17:50:57 +0000 (18:50 +0100)]
todo: add tip on how to identify excessive stack usage

Use dynamic allocations for working memory rather than stack.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: un-break uart command after command handler refactoring
Øyvind Harboe [Wed, 18 Nov 2009 10:08:33 +0000 (11:08 +0100)]
zy1000: un-break uart command after command handler refactoring

Switched it to jim command to insulate it from command refactoring.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoembedded: reduce stack usage
Øyvind Harboe [Sat, 21 Nov 2009 22:29:58 +0000 (23:29 +0100)]
embedded: reduce stack usage

Allocate working structures on stack to avoid issues with
path lengths + reduce stack usage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoembedded: do not allocate large temporary structures on stack
Øyvind Harboe [Sat, 21 Nov 2009 22:25:46 +0000 (23:25 +0100)]
embedded: do not allocate large temporary structures on stack

With -O3 when inlining aggressively the total stack usage will
be the sum of many fn's, which can easily get out of hand.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoembedded: save stack
Øyvind Harboe [Sat, 21 Nov 2009 22:45:36 +0000 (23:45 +0100)]
embedded: save stack

and also do not recaluate the crc32_table upon
every invocation.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: fix breakage in command parsing code for power command
Øyvind Harboe [Sun, 22 Nov 2009 12:16:48 +0000 (13:16 +0100)]
zy1000: fix breakage in command parsing code for power command

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agobuild: fix breakage in building bin2char
Øyvind Harboe [Sun, 22 Nov 2009 12:24:45 +0000 (13:24 +0100)]
build: fix breakage in building bin2char

bin2char build relied on $(builddir) which is not defined
for arm-elf X builds at least.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM: arm_set_cpsr() handles T and J bits
David Brownell [Sun, 22 Nov 2009 11:41:14 +0000 (03:41 -0800)]
ARM: arm_set_cpsr() handles T and J bits

Have arm_set_cpsr() handle the two core state flags, updating
the CPU state.  This eliminates code in various debug_entry()
paths, and marginally improves handling of the J bit.

Catch and comment a few holes in the handling of the J bit on
ARM926ejs cores ... it's unlikely our users will care about
Jazelle mode, but we can at least warn of Impending Doom.  If
anyone does use it, these breadcrumbs may help them to find
the right path through the code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: define two register utilities
David Brownell [Sun, 22 Nov 2009 11:38:34 +0000 (03:38 -0800)]
ARM: define two register utilities

Define arm_reg_current() ... returning handle to a given register,
and encapsulating the current mode's register shadowing.  It's got
one current use, for reporting the current register set to GDB.
This will let later patches clean up much ARMV4_5_CORE_REG_MODE()
nastiness, saving a bit of code.

Define and use arm_set_cpsr() ... initially it updates the cached
CPSR and sets up state used by arm_reg_current(), plus any SPSR
handle.   (Later: can also set up for T and J bits.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: simplify CPSR handling
David Brownell [Sun, 22 Nov 2009 11:37:21 +0000 (03:37 -0800)]
ARM: simplify CPSR handling

Stash a pointer to the CPSR in the "struct arm", to help get rid
of the (common) references to its index in the register cache.

This removes almost all references to CPSR offsets outside of the
toplevel ARM code ... except a pair related to the current ARM11
"simulator" logic (which should be removable soonish).

This is a net minor code shrink of a few hundred bytes of object
code, and also makes the code more readable.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: remove disabled register hooks
David Brownell [Sun, 22 Nov 2009 11:36:24 +0000 (03:36 -0800)]
ARM11: remove disabled register hooks

Minor cleanup of ARM11 register handling:  remove disabled
register hooks.  This should all be handled by shared code,
and this stuff is just clutter.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agojtag: remove useless forward declarations
Zachary T Welch [Sat, 21 Nov 2009 18:20:56 +0000 (10:20 -0800)]
jtag: remove useless forward declarations

Removes some more useless forward declarations from a few JTAG drivers.
Moves interface and bit-bang structure defitions below their callbacks.

14 years agoallow jtag interfaces to lack commands
Zachary T Welch [Sat, 21 Nov 2009 18:19:47 +0000 (10:19 -0800)]
allow jtag interfaces to lack commands

Allow JTAG interface drivers to skip registering an register_commands
callback when it will just be empty.

14 years agoshow script search dirs in debug log
Andreas Fritiofson [Sat, 21 Nov 2009 17:30:09 +0000 (09:30 -0800)]
show script search dirs in debug log

Add this to ease debugging why the standard scripts aren't
found on the default script search path in some build/install
enviroments. Especially on Windows it's not straight forward
where openocd actually looks for the scripts.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: pass 'struct reg *' to register r/w routines
David Brownell [Sat, 21 Nov 2009 00:27:24 +0000 (16:27 -0800)]
ARM: pass 'struct reg *' to register r/w routines

Implementations need to access the register struct they modify;
make it easier and less error-prone to identify the instance.
(This removes over 10% of the ARMV4_5_CORE_REG_MODE nastiness...)

Plus some minor fixes noted when making these updates:  ARM7/ARM9
accessor methods should be static; don't leave CPSR wrongly marked
"dirty"; note significant XScale omissions in register handling;
and have armv4_5_build_reg_cache() record its result.

Rename "struct armv4_5_core_reg" as "struct arm_reg"; it's used
for more than those older architecture generations.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM7/ARM9: remove old "debug commands"
David Brownell [Sat, 21 Nov 2009 00:21:29 +0000 (16:21 -0800)]
ARM7/ARM9: remove old "debug commands"

Remove two commands that were documented as "debug commands"
and where "you probably don't want to use this".   We never
intended to support them, and at least one problem report
boiled down to using this when it shouldn't have been used.

Update the docs on the existing register commands to talk a
bit more about register access and cache behavior.  (Those
debug commands existed largely to *bypass* the cache.)  And
fix some minor doc goofs that snuck in with recent changes,
renaming "armv4_5" as "arm" and "arm9tdmi" as "arm9".

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agomaintain command lists in sorted order
Zachary T Welch [Fri, 20 Nov 2009 18:16:46 +0000 (10:16 -0800)]
maintain command lists in sorted order

Use insertion sort to the command link lists.  The only practical effect
of this is to order the output of the new 'help' command.

14 years agoadd add_help_text command handler
Zachary T Welch [Thu, 19 Nov 2009 15:23:25 +0000 (07:23 -0800)]
add add_help_text command handler

Rewrite means for scripts to register help text for commands.  These
cause the new commands to be stored in the command heirarchy, with
built-in commands; however, they will never be invoked there because
they do not receive a command handler.  The same trick is used for
the Jim commands.

Remove the old helpers that were used to register commands.