openocd.git
14 years agoadd help regardless of callback
Zachary T Welch [Wed, 11 Nov 2009 17:40:28 +0000 (09:40 -0800)]
add help regardless of callback

Add help for commands regardless of whether a handler is involved.
With this, all sorts of new commands can be found in 'help' text.
Hopefully, all of them have been documented....

Sadly, the lsort function appears to handle nested lists poorly, such
that sub-commands do not group with their parents.

14 years agoeliminate duplicate helptext management
Zachary T Welch [Wed, 11 Nov 2009 16:20:09 +0000 (08:20 -0800)]
eliminate duplicate helptext management

Add helpers to manage adding entries to the helptext list.
Adds support for arbitrarily nested commands.

14 years agoadd command_name helper
Zachary T Welch [Wed, 11 Nov 2009 13:26:17 +0000 (05:26 -0800)]
add command_name helper

The command_name function returns a malloced string for a given
command and its parents.  This can be used to display a message
to the user, but it is used internally to handle registration
and syntax errors.  This helps permit arbitrary command nesting.

14 years agowrap help command
Zachary T Welch [Wed, 11 Nov 2009 15:19:13 +0000 (07:19 -0800)]
wrap help command

Use continuation characters to wrap the help command into 80 columns.

14 years agoremove obsolete doxygen comments
Zachary T Welch [Wed, 11 Nov 2009 11:19:29 +0000 (03:19 -0800)]
remove obsolete doxygen comments

Documenting command handler parameters is redundant and pointless.

14 years agoremove more useless declarations
Zachary T Welch [Tue, 10 Nov 2009 07:20:34 +0000 (23:20 -0800)]
remove more useless declarations

Removes forward declarations by moving command registration after
defintion of the command handlers.

14 years agocortex_a8: remove declarations, use static keyword
Zachary T Welch [Wed, 11 Nov 2009 02:26:13 +0000 (18:26 -0800)]
cortex_a8: remove declarations, use static keyword

14 years agoadd const keyword to some APIs
Zachary T Welch [Tue, 10 Nov 2009 12:27:15 +0000 (04:27 -0800)]
add const keyword to some APIs

Add 'const' keyword to 'char *' parameters to allow command handlers to
pass constant string arguments.  These changes allow the 'args' command
handler to be changed to 'const' in a subsequent patch.

14 years agochange argv to args in command handlers
Zachary T Welch [Tue, 10 Nov 2009 10:43:11 +0000 (02:43 -0800)]
change argv to args in command handlers

Subsequent patches expect all command handlers to use a uniform
parameter naming scheme.  In the entire tree, these two files used
standard 'argv' instead of our non-standard 'args'.  This patch opts
to reduces the noise required to unify the command handlers, using
dominant 'args' form.

A future patch may be used to convert us back to the standard argv, but
that requires coordination with all developers to minimize disruptions.

14 years agoscript_debug(): improve types
Zachary T Welch [Mon, 9 Nov 2009 14:07:21 +0000 (06:07 -0800)]
script_debug(): improve types

Use unsigned type for number of arguments.

14 years agocommand.c: make private routines static
Zachary T Welch [Mon, 9 Nov 2009 14:09:30 +0000 (06:09 -0800)]
command.c: make private routines static

This patch also improves the signature of run_command function.

14 years agolog: improve log_callback_fn signature
Zachary T Welch [Mon, 9 Nov 2009 14:12:02 +0000 (06:12 -0800)]
log: improve log_callback_fn signature

Use unsigned type for line number in log_callback_fn signature.

14 years agotime_support: improve use of types
Zachary T Welch [Mon, 9 Nov 2009 13:45:57 +0000 (05:45 -0800)]
time_support: improve use of types

Update timeval_add_time to use long int; implement timeval_add with it.
Update timeval_ms to check gettimeofday return value, return int64_t.

14 years agomakefiles: improve build order
Zachary T Welch [Tue, 10 Nov 2009 12:27:02 +0000 (04:27 -0800)]
makefiles: improve build order

Separates various groups of files to be built in logical succession.
In each layer, the core module (target.c, nand.c, etc.) is built _after_
their helper modules (e.g. image.c, nand_ecc.c) but _before_ any of
their drivers (e.g. arm966e.c, mx3_nand.c).

This allows problems introduced at the bottom of the stack to result
in build failures as soon as possible, as the helpers and core should
wrap portions of them.

14 years agoETM cleanup
David Brownell [Wed, 11 Nov 2009 12:42:50 +0000 (04:42 -0800)]
ETM cleanup

Various cleanups of ETM related code.

 - Saner error return paths
 - Simplify arm7_9 init ... no need for extra zeroing!
 - Shrink some lines
 - Tweak some diagnostics
 - Use shorter name for ETM struct type.
 - Don't exit()

and similar.  The diagnostics look forward to having
this ETM code work with more than just ARM7/ARM9.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agofix bug in ARM720: bugfix
Zachary T Welch [Wed, 11 Nov 2009 05:02:30 +0000 (21:02 -0800)]
fix bug in ARM720: bugfix

14 years agoARM720: bugfix
David Brownell [Wed, 11 Nov 2009 03:06:10 +0000 (19:06 -0800)]
ARM720: bugfix

The "ARM720 uses the new inheritance/nesting scheme" patch
wrongly scrubbed a calloc() from arm720t_target_create().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: MMU-aware init for memory read/write
David Brownell [Tue, 10 Nov 2009 19:58:31 +0000 (11:58 -0800)]
target: MMU-aware init for memory read/write

Start switching MMU handling over to a more sensible scheme.
Having an mmu() method enables MMU-aware behaviors.  Not having
one kicks in simpler ones, with no distinction between virtual
and physical addresses.

Currently only a handful of targets have methods to read/write
physical memory:  just arm720, arm920, and arm926.  They should
all initialize OK now, but the arm*20 parts don't do the "extra"
stuff arm926 does (which should arguably be target-generic).

Also simplify how target_init() loops over all targets by making
it be a normal "for" loop, instead of scattering its three parts
to the four winds.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget.cfg: (re)move some bogus reset_config lines
David Brownell [Tue, 10 Nov 2009 17:25:26 +0000 (09:25 -0800)]
target.cfg: (re)move some bogus reset_config lines

General rule, this is all board-specific and doesn't belong
in target config files.  Some of these were just cosmetic.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agostm32.cfg: remove reset_config
Thomas Kindler [Tue, 10 Nov 2009 17:16:12 +0000 (09:16 -0800)]
stm32.cfg: remove reset_config

Here's a patch for the double-reset problem on STM32.  I've tested
downloading and debugging with GDB and Eclipse, and everything seems
to work fine.

This effectively sets reset_config to none. trst_only would also
be ok, but that's better left to a board configuration file since
not all boards wire it up.

The NVIC is used to trigger reset, which at least on this chip also
pulses nSRST so the whole system does get rest -- exactly once.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoarm11: add etmr/etmw registers to access ETM via DBGTAP scan chain
Michael Bruck [Tue, 27 Oct 2009 21:41:00 +0000 (22:41 +0100)]
arm11: add etmr/etmw registers to access ETM via DBGTAP scan chain

First cut of these commands. Øyvind tinkered a bit with
the number parsing to bring it up to speed + rebased it.
Ready for testing.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM11: remove old mrc/mcr commands
Øyvind Harboe [Mon, 26 Oct 2009 13:39:32 +0000 (14:39 +0100)]
ARM11: remove old mrc/mcr commands

Switch to new commands in config scripts

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agotelo.cfg: fix search paths
Øyvind Harboe [Tue, 10 Nov 2009 12:09:15 +0000 (13:09 +0100)]
telo.cfg: fix search paths

Add the missing "target/" prefix for scripts in the
target folder.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoTarget: minor cleanup
David Brownell [Tue, 10 Nov 2009 10:01:20 +0000 (02:01 -0800)]
Target: minor cleanup

 - improve some names -- a "default" prefix is not descriptive
 - add doxygen @todo entries for some issues
 - avr8 isn't ever going to need those MMU hooks

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM920: implement basic MMU ops
David Brownell [Tue, 10 Nov 2009 09:36:59 +0000 (01:36 -0800)]
ARM920: implement basic MMU ops

mmu() works; virt2phys() fails and logs an error.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM720: implement basic MMU ops
David Brownell [Tue, 10 Nov 2009 09:35:50 +0000 (01:35 -0800)]
ARM720: implement basic MMU ops

mmu() works; virt2phys() fails and logs an error.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoTarget: fix bad error messages
David Brownell [Tue, 10 Nov 2009 09:33:59 +0000 (01:33 -0800)]
Target: fix bad error messages

And shrink a few too-long lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agohttpd: fix warnings, more robust error handling, improved MIME handling
Øyvind Harboe [Sun, 8 Nov 2009 18:50:35 +0000 (19:50 +0100)]
httpd: fix warnings, more robust error handling, improved MIME handling

The httpd is work in progress...

No mime type set by default. Let the browser guess.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agotcl: HostOs now picks up eCos as well during compile time
Øyvind Harboe [Tue, 10 Nov 2009 07:36:19 +0000 (08:36 +0100)]
tcl: HostOs now picks up eCos as well during compile time

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agosvf,xsvf,arm7_9_common: trim forard declarations
Zachary T Welch [Tue, 10 Nov 2009 05:24:45 +0000 (21:24 -0800)]
svf,xsvf,arm7_9_common: trim forard declarations

Remove forward declarations by reordering command registration.

14 years agocommand.c: make commands static
Zachary T Welch [Tue, 10 Nov 2009 05:23:38 +0000 (21:23 -0800)]
command.c: make commands static

Removes useless declarations, moving the handler functions to appear
before their use in the (much bigger) command registriation function.

14 years agoserver: remove useless declarations
Zachary T Welch [Tue, 10 Nov 2009 05:22:48 +0000 (21:22 -0800)]
server: remove useless declarations

Remove server command declarations, make handler routines static.

14 years agojtag: remove useless declarations
Zachary T Welch [Tue, 10 Nov 2009 05:21:06 +0000 (21:21 -0800)]
jtag: remove useless declarations

Contrary to my previous assessment, some opportunities to remove forward
declarations were overlooked.  Remove them by moving the definitions
of the command registration and interface structure to the end of files.

14 years agotarget.c: remove useless declarations
Zachary T Welch [Tue, 10 Nov 2009 03:24:06 +0000 (19:24 -0800)]
target.c: remove useless declarations

This patch removes the last batch of forward references from the tree,
moving the target command registration routines to the end of the file.

14 years ago{pic32m,stm32}x.c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:34 +0000 (09:20 -0800)]
{pic32m,stm32}x.c: remove useless declarations

Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agostr{7,9}x*.c: remove useless forward declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:34 +0000 (09:20 -0800)]
str{7,9}x*.c: remove useless forward declarations

Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/<various>.c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/<various>.c: remove useless declarations

Remove useless forward declarations.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/<assorted>.c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/<assorted>.c: remove useless declarations

Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/at91sam[37].c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/at91sam[37].c: remove useless declarations

Remove useless forward declarations.
Moves command registration to end of file.
Moves flash structure definitions to end of files.

Changes a few references to global flash structure to local refs.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/lpc2???.c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/lpc2???.c: remove useless declarations

Remove useless forward declarations.
Moves command registrations to end of files.
Moves flash structure definitions to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/*nand*.c: remove useless declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/*nand*.c: remove useless declarations

Remove useless forward declarations.
Moves command registration to end of files.
Moves flash structure definition to end of files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoflash/flash.c: remove forward declarations
Zachary T Welch [Mon, 9 Nov 2009 17:20:33 +0000 (09:20 -0800)]
flash/flash.c: remove forward declarations

Remove useless forward declarations.
Moves command registration to end of file.
Moves flash structure definition to end of file.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
14 years agoRevert "target: add target->type->has_mmu fn"
David Brownell [Mon, 9 Nov 2009 22:46:23 +0000 (14:46 -0800)]
Revert "target: add target->type->has_mmu fn"

This patch introduced a bug preventing flash writes from working
on Cortex-M3 targets like the STM32.  Moreover, it's the wrong
approach for handling no-MMU targets.

The right way to handle no-MMU targets is to provide accessors
for physical addresses, and use them everywhere; and any code
which tries to work with virtual-to-physical mappings should use
a identity mapping (which can be defaulted).

And ... we can tell if a target has an MMU by seeing if it's
got an mmu() method.  No such methood means no MMU.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agofinish removing deprecated/obsolete commands
David Brownell [Mon, 9 Nov 2009 21:16:32 +0000 (13:16 -0800)]
finish removing deprecated/obsolete commands

It's been about a year since these were deprecated and, in most
cases, removed.  There's no point in carrying that documentation,
or backwards compatibility for "jtag_device" and "jtag_speed",
around forever.  (Or a few remnants of obsolete code...)

Removed a few obsolete uses of "jtag_speed":

 - The Calao stuff hasn't worked since July 2008.  (Those Atmel
   targets need to work with a 32KHz core clock after reset until
   board-specific init-reset code sets up the PLL and enables a
   faster JTAg clock.)
 - Parport speed controls don't actually work (tops out at about
   1 MHz on typical HW).
 - In general, speed controls need to live in board.cfg files (or
   sometimes target.cfg files), not interface.cfg ...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoUser's Guide: Flash/NAND doc tweaks
David Brownell [Mon, 9 Nov 2009 20:02:23 +0000 (12:02 -0800)]
User's Guide: Flash/NAND doc tweaks

Rename the "Drivers, Options, and Commands" sections to be
just "Driver List" matching the earlier reference.  Add an
example of parallel CFI flash.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agosrc/target: remove 'extern' and wrap headers
Zachary T Welch [Mon, 9 Nov 2009 12:22:23 +0000 (04:22 -0800)]
src/target: remove 'extern' and wrap headers

Remove extern keywords from function prototypes and wrap long lines.

14 years agotarget.h: remove extern keyword and wrap
Zachary T Welch [Mon, 9 Nov 2009 12:21:36 +0000 (04:21 -0800)]
target.h: remove extern keyword and wrap

Removes 'extern' keyword from function prototypes and wraps long lines.

14 years agosrc/{server,pld,svf,xsvf}: remove 'extern' keyword
Zachary T Welch [Mon, 9 Nov 2009 11:38:34 +0000 (03:38 -0800)]
src/{server,pld,svf,xsvf}: remove 'extern' keyword

Removes 'extern' keyword from function declarations in header filess.

14 years agosrc/flash: remove 'extern' and wrap headers
Zachary T Welch [Mon, 9 Nov 2009 11:10:11 +0000 (03:10 -0800)]
src/flash: remove 'extern' and wrap headers

Removes 'extern' keywords from function prototypes in the flash headers.
Wraps long lines to fit into 80 columns.

Adds multiple inclusion protection for s3c2xx_nand.h.

14 years agosrc/jtag: remove 'extern' and wrap headers.
Zachary T Welch [Mon, 9 Nov 2009 10:53:22 +0000 (02:53 -0800)]
src/jtag: remove 'extern' and wrap headers.

Removes the 'extern' keyword from function declarations.
Wraps long prototypes to fit into 80 columns.

Fixes documentation for jtag_tap_s::{,has}idcode fields.

14 years agosrc/helper: wrap and clean headers.
Zachary T Welch [Mon, 9 Nov 2009 10:47:00 +0000 (02:47 -0800)]
src/helper: wrap and clean headers.

Remove all useless 'extern' keywords from function prototypes.
Wraps long lines for readability.

14 years agoUser's Guide: bugfix global state info
David Brownell [Mon, 9 Nov 2009 17:40:55 +0000 (09:40 -0800)]
User's Guide: bugfix global state info

The "$ocd_HOSTOS" variable was wrongly documented.  Fix its
documentation, and its value on Linux.

Shrink a few of the too-long lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoEmbeddedICE: minor cleanups
David Brownell [Mon, 9 Nov 2009 17:34:51 +0000 (09:34 -0800)]
EmbeddedICE: minor cleanups

Add comments (Doxygen and normal), remove unused code,
shrink some overlong lines.  Get rid of a forward decl.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoOverhaul time support API
Zachary T Welch [Sun, 8 Nov 2009 07:20:33 +0000 (23:20 -0800)]
Overhaul time support API

This patch changes the duration_* API in several ways.  First, it
updates the API to use better names.  Second, string formatting has
been removed from the API (with its associated malloc).  Finally, a
new function added to convert the time into seconds, which can be
used (or formatted) by the caller.  This eliminates hidden calls to
malloc that require associated calls to free().

This patch also removes the useless extern keyword from prototypes,
and it eliminates the duration_t typedef (use 'struct duration').
These API also allows proper error checking, as it is possible for
gettimeofday to fail in certain circumstances.

The consumers have all been chased to use this new API as well, as
there were relatively few cases doing this type of measurement.
In most cases, the code performs additional checks for errors, but
the calling code looks much cleaner in every case.

14 years agoAdd private header for ARM11 internals.
Zachary T Welch [Fri, 6 Nov 2009 11:50:26 +0000 (03:50 -0800)]
Add private header for ARM11 internals.

Reduces confusion about location of associated routines and
reduces clutter in the arm11 header.

Removes extra whitespace around the lines touched by these changes.

14 years agoARM11: remove exports and forward decls
Zachary T Welch [Fri, 6 Nov 2009 11:36:46 +0000 (03:36 -0800)]
ARM11: remove exports and forward decls

Unneeded exports cause confusion about the module interfaces.
Make almost everything static in the arm11.c module.

14 years agoARM: minor simulator cleanup
David Brownell [Sun, 8 Nov 2009 20:44:28 +0000 (12:44 -0800)]
ARM: minor simulator cleanup

Make several functions be static.  Shrink some of the overlong
lines.  Use pure tab indents in some places that mixed in spaces.
This gives a minor object code shrink (about 2% on amd64).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-M3: fix (debug) message priority
David Brownell [Sun, 8 Nov 2009 20:23:17 +0000 (12:23 -0800)]
Cortex-M3: fix (debug) message priority

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget.cfg: remove "-work-area-virt 0"
David Brownell [Sun, 8 Nov 2009 16:52:40 +0000 (08:52 -0800)]
target.cfg: remove "-work-area-virt 0"

The semantics of "-work-area-virt 0" (or phys) changed with
the patch to require specifying physical or virtrual work
area addresses.  Specifying zero was previously a NOP.  Now
it means that address zero is valid.

This patch addresses three related issues:

 - MMU-less processors should never specify work-area-virt;
   remove those specifications.  Such processors include
   ARM7TDMI, Cortex-M3, and ARM966.

 - MMU-equipped processors *can* specify work-area-virt...
   but zero won't be appropriate, except in mischievous
   contexts (which hide null pointer exceptions).

   Remove those specs from those processors too.  If any of
   those mappings is valid, someone will need to submit a
   patch adding it ... along with a comment saying what OS
   provides the mapping, and in which context.  Example,
   say "works with Linux 2.6.30+, in kernel mode".  (Note
   that ARM Linux doesn't map kernel memory to zero ...)

 - Clarify docs on that "-virt" and other work area stuff.

Seems to me work-area-virt is quite problematic; not every
operating system provides such static mappings; if they do,
they're not in every MMU context...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoFix vsllink bulk out endpoint parsing.
Zachary T Welch [Sat, 7 Nov 2009 21:36:47 +0000 (13:36 -0800)]
Fix vsllink bulk out endpoint parsing.

14 years agoMerge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd...
David Brownell [Fri, 6 Nov 2009 23:01:46 +0000 (15:01 -0800)]
Merge branch 'master' of ssh://dbrownell@openocd.git.sourceforge.net/gitroot/openocd/openocd

14 years agotarget: don't swap MMU/no-MMU work areas
David Brownell [Fri, 6 Nov 2009 22:57:21 +0000 (14:57 -0800)]
target: don't swap MMU/no-MMU work areas

Resolve serious bug inserted by the "target: require working
area for physical/virtual addresses to be specified" patch.
It forced use of (invalid) virtual addresses when the MMU
was disabled, and vice versa.

Observed to break at least Cortex-M3, ARM926, ARM7TDMI whenever
work areas are used, such as during bulk writes to flash, DDR2,
SRAM, and so on.

Also, fix overlong lines and whitespace goofs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoSimplify nand indentation.
Zachary T Welch [Fri, 6 Nov 2009 02:40:52 +0000 (18:40 -0800)]
Simplify nand indentation.

Removes check covered by new nand_command_get_device_by_num helper.
Reverses logic of probe check to further reduce indentation.

14 years agoImprove flash indentation.
Zachary T Welch [Fri, 6 Nov 2009 07:52:03 +0000 (23:52 -0800)]
Improve flash indentation.

Removes redundant tests and reverses backwards logic to reduce the
indentation level in flash.c.

14 years agoFix arm11 vcr command parsing.
Zachary T Welch [Fri, 6 Nov 2009 08:16:39 +0000 (00:16 -0800)]
Fix arm11 vcr command parsing.

14 years agoARM: shrink offsets
David Brownell [Fri, 6 Nov 2009 06:04:25 +0000 (22:04 -0800)]
ARM: shrink offsets

Move various embedded target structs to the beginnings of
their containers ... pretty much the way C++ or Obj-C
would for single inheritance.

This shrinks code that accesses those embedded structs by
letting common offsets use smaller instructions.  Sample
before/after sizes (on amd64):

  17181     312       0   17493    4455 arm920t.o
  16810     312       0   17122    42e2 arm920t.o

Where the "after" is the smaller number, with this patch
over the ones leveraging that embedding knowledge.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: other code uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:04:22 +0000 (22:04 -0800)]
ARM: other code uses the new inheritance/nesting scheme

Remove most remaining uses of target->arch_info from ARM
infrastructure, where it hasn't already been updated.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-A8: use the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:04:13 +0000 (22:04 -0800)]
Cortex-A8: use the new inheritance/nesting scheme

Use target_to_armv7a() etc, replacing needless pointer traversals.
Stop using X->arch_info scheme in most ARMv7-A and Cortex-A8 code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM7TDMI uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:04:04 +0000 (22:04 -0800)]
ARM7TDMI uses the new inheritance/nesting scheme

Use target_to_arm7_9(), replacing needless pointer traversals.

Also:  remove now-useless contents of arm7tdmi struct; it's
almost ready to be removed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM720 uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:56 +0000 (22:03 -0800)]
ARM720 uses the new inheritance/nesting scheme

Use target_to_arm720(), replacing needless pointer traversals
and simplifying a bunch of nasty code.  Stop setting arch_info
for arm720 type parts, it's not used any longer.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoXScale uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:45 +0000 (22:03 -0800)]
XScale uses the new inheritance/nesting scheme

Use target_to_xscale(), replacing needless pointer traversals
and simplifying a bunch of code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM9TDMI uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:40 +0000 (22:03 -0800)]
ARM9TDMI uses the new inheritance/nesting scheme

Replace needless pointer traversals and simplify.  Also remove most
remaining contents from arm9tdmi struct; it's almost removable.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM966 uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:33 +0000 (22:03 -0800)]
ARM966 uses the new inheritance/nesting scheme

Use target_to_arm966(), replacing needless pointer traversals.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM926 uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:30 +0000 (22:03 -0800)]
ARM926 uses the new inheritance/nesting scheme

Use target_to_arm926(), replacing needless pointer traversals
and simplifying a bunch of code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoFA526 uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:24 +0000 (22:03 -0800)]
FA526 uses the new inheritance/nesting scheme

Replace needless pointer traversals, simplify.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM920 uses the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 06:03:13 +0000 (22:03 -0800)]
ARM920 uses the new inheritance/nesting scheme

Use target_to_arm920(), replacing needless pointer traversals
and simplifying.  Stop setting arm9tdmi->arch_info for arm920
type parts, it's not used any longer.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-M3: use the new inheritance/nesting scheme
David Brownell [Fri, 6 Nov 2009 05:59:45 +0000 (21:59 -0800)]
Cortex-M3: use the new inheritance/nesting scheme

Use new target_to_cm3() and target_to_armv7m() inlines,
instead of a series of x->arch_info conversions.  Remove
arch_info, since nothing uses it.

Also fix an omission:  the Cortex-M3 commands didn't verify
that they were operating on that kind of target.  Add comment
about the ARMv7M version of that omission.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: provide container_of()
David Brownell [Fri, 6 Nov 2009 05:59:39 +0000 (21:59 -0800)]
target: provide container_of()

Provide a cleaner way to handle single inheritance of targets
in C, using the same model Linux does:  structs containing other
structs, un-nested via calls to a "container_of()" macro that
are packaged in typesafe inline functions.

Targets already use this containment idiom, but make it much
more complicated because they un-nest using embedded "void *"
pointers ... in chains of up to five per target, which is all
pure needless complication.  (Example: arm92x core, arm9tdmi,
arm7_9, armv4_5 ... on top of the base "target" class.)

Applying this scheme consistently simplifies things, and gets
rid of many error-prone untyped pointers.  It won't change any
part of the type model though -- it just simplifies things.
(And facilitates more cleanup later on.)

Rule of thumb:  where there's an X->arch_info void* pointer,
access to that pointer can and should be removed.  It may be
convenient to set up pointers to some of the embedded structs;
and shrink their current "*_common" names (annoyingly long).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM7TDMI: remove forward decls
David Brownell [Fri, 6 Nov 2009 04:36:42 +0000 (20:36 -0800)]
ARM7TDMI: remove forward decls

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

Also shrink a few overly-long lines with function declarations
or definitions;  get rid of arm7tdmi_register_commands(), it's
not needed (just delegated); minor whitespace declutter.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM720: remove exports and forward decls
David Brownell [Fri, 6 Nov 2009 04:36:27 +0000 (20:36 -0800)]
ARM720: remove exports and forward decls

Unneeded exports cause confusion about the module interfaces.
Make all functions static.  Add a short header comment.

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

Remove unneeded indirection for the write_memory() method.  Make
a table static, remove a can't-happen case with nasty exit().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoFA526: remove exports and forward decls
David Brownell [Fri, 6 Nov 2009 04:36:18 +0000 (20:36 -0800)]
FA526: remove exports and forward decls

Unneeded exports cause confusion about the module interfaces.
Make most functions static.

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM9TDMI: remove forward decls
David Brownell [Fri, 6 Nov 2009 04:36:09 +0000 (20:36 -0800)]
ARM9TDMI: remove forward decls

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

Also shrink a few overly-long lines with function declarations
or definitions.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM966: remove exports and forward decls
David Brownell [Fri, 6 Nov 2009 04:35:53 +0000 (20:35 -0800)]
ARM966: remove exports and forward decls

Unneeded exports cause confusion about the module interfaces.
Make most functions static.

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

Also remove needless arm966e_init_target(), in favor of the
arm9tdmi routine to which it delegates its work.

This saved over 100 bytes of code on x86_32.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM926: more cleanup
David Brownell [Fri, 6 Nov 2009 04:35:47 +0000 (20:35 -0800)]
ARM926: more cleanup

An init_target() wrapper isn't needed, and target_create()
can shrink a bit.  Add a header comment and some doxygen.

Remove arm926ejs_catch_broken_irscan() which has been a NOP
for quite a few months now, and in any case duplicates logic
in the JTAG core to validate IR capture data.  But force the
capture mask to 0x0f, so those tests are most effective.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM920: remove exports and forward decls
David Brownell [Fri, 6 Nov 2009 04:35:37 +0000 (20:35 -0800)]
ARM920: remove exports and forward decls

Unneeded exports cause confusion about the module interfaces.
Make most functions static.  Add a short header comment.

The forward decls are just code clutter; remove them, by moving
their references after definitions.  This is another file which
never needed even one internal forward declaration.

This saved almost 900 bytes of code on x86_32; it seems the
compiler can leverage its knowledge that these functions are
not called from the outside world...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoImprove str9xpec command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 08:18:25 +0000 (01:18 -0700)]
Improve str9xpec command argument parsing.

14 years agoImprove str9x config command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 08:25:22 +0000 (01:25 -0700)]
Improve str9x config command argument parsing.

14 years agoImprove str7x config command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 08:32:20 +0000 (01:32 -0700)]
Improve str7x config command argument parsing.

14 years agoImprove stm32x.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 05:33:12 +0000 (22:33 -0700)]
Improve stm32x.c command argument parsing.

14 years agoImprove stellaris.c erase argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 08:40:47 +0000 (01:40 -0700)]
Improve stellaris.c erase argument parsing.

14 years agoImprove pic32mx.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 05:33:12 +0000 (22:33 -0700)]
Improve pic32mx.c command argument parsing.

14 years agoImprove mflash.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve mflash.c command argument parsing.

14 years agoImprove lpc3180_nand_controller.c parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve lpc3180_nand_controller.c parsing.

This fixes a memory leak in lpc3180_nand_device_command by
reordering the malloc to occur after all parsing has completed.

14 years agoImprove lpc2900.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve lpc2900.c command argument parsing.

14 years agoImprove lpc288x.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve lpc288x.c command argument parsing.

14 years agoImprove lpc2000.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve lpc2000.c command argument parsing.

14 years agoImprove cfi.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve cfi.c command argument parsing.

14 years agoImprove avrf.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 09:17:17 +0000 (02:17 -0700)]
Improve avrf.c command argument parsing.

14 years agoImprove orion_nand.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 05:33:12 +0000 (22:33 -0700)]
Improve orion_nand.c command argument parsing.

14 years agoImprove davinci_nand.c command argument parsing.
Zachary T Welch [Fri, 23 Oct 2009 05:33:12 +0000 (22:33 -0700)]
Improve davinci_nand.c command argument parsing.

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)