]> git.sur5r.net Git - openocd/log
openocd
14 years agofix segfault at startup
Zachary T Welch [Wed, 18 Nov 2009 19:56:24 +0000 (11:56 -0800)]
fix segfault at startup

The previous changes to move the startup TCL code resulted in segfaults
during startup.  This seemingly innocuous patch fixes the problem.
I would explain why changing from 'foo[]' to '*foo' caused this issue,
but the difference seems superficial.  For now, this hot fix will do,
but this issue might bear further scrutiny.

14 years agopass startup_tcl to command_init
Zachary T Welch [Tue, 17 Nov 2009 17:15:09 +0000 (09:15 -0800)]
pass startup_tcl to command_init

Removes external linkage from helper module, making the startup
code a parameter to a new command context's initialization routine.

14 years agosplit startup.tcl file across modules
Zachary T Welch [Tue, 17 Nov 2009 16:29:20 +0000 (08:29 -0800)]
split startup.tcl file across modules

Moves definitions for each layer into their own file, eliminating
layering violations in the built-in TCL code.  Updates src/Makefile.am
rules to include all files in the final startup.tcl input file, and
others Makefile.am rules to distribute the new files in our packages.

14 years agomove startup.c to libopenocd
Zachary T Welch [Tue, 17 Nov 2009 16:30:51 +0000 (08:30 -0800)]
move startup.c to libopenocd

Moves the creation of startup_tcl.c from src/helper/ to src/.
Prepares to split the startup.tcl file into its per-module parts.

14 years agofix regression in md/mw commands
Zachary T Welch [Wed, 18 Nov 2009 11:34:52 +0000 (03:34 -0800)]
fix regression in md/mw commands

The recent migration broke them, the fixes broken them in a new way,
but this should restore them to working order.  Eliminates the
temporary variable, as the CMD_NAME macro can once again be use
in routines that increment CMD_ARGV without nasty side-effects.

14 years agojtag-api: get rid of unecessary buf_set_u23() that make code obtuse.
Øyvind Harboe [Tue, 17 Nov 2009 20:59:01 +0000 (21:59 +0100)]
jtag-api: get rid of unecessary buf_set_u23() that make code obtuse.

Also, this is on the path to increasing the word size for
bit vectors from 8 to something wider(32? natural host machine
width?)

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM: add is_arm_mode()
David Brownell [Wed, 18 Nov 2009 07:50:26 +0000 (23:50 -0800)]
ARM: add is_arm_mode()

Add a new is_arm_mode() predicate, and use it to replace almost
all calls to current armv4_5_mode_to_number().

Eventually those internal mode numbers should vanish... along
with their siblings in the armv7a.c file.

Remove a handful of superfluous checks ... e.g. the mode number
was just initialized, or (debug entry methods) already validated.

Move one of the macros using internal mode numbers into the only
file which uses that macro.  Make the tables manipulated with
those numbers be read-only and, where possible, static so they're
not confused with part of the generic ARM interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: add arm_mode_name()
David Brownell [Wed, 18 Nov 2009 07:50:23 +0000 (23:50 -0800)]
ARM: add arm_mode_name()

Add and use arm_mode_name() to map from PSR bits to user
meaningful names.   It uses a new table which, later, can
be used to hold other mode-coupled data.

Add definitions for the "Secure Monitor" mode, as seen on
some ARM11 cores (like ARM1176) and on Cortex-A8.  The
previous mode name scheme didn't understand that mode.

Remove the old mechanism ... there were two copies, caused
by Cortex-A8 needing to add "Secure Monitor" mode support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: only use one set of dummy FPA registers
David Brownell [Wed, 18 Nov 2009 07:50:17 +0000 (23:50 -0800)]
ARM: only use one set of dummy FPA registers

All ARM cores need to provide obsolete FPA registers in their
GDB register dumps.  (Even though cores with floating point
support now generally use some version of VFP...)

Clean up that support a bit by sharing the same dummy registers,
and removing the duplicate copies.  Eventually we shouldn't need
to export those dummies.

(This makes the ARMv7-M support include the armv4_5 header, and
cleans up related #includes, but doesn't yet use anything from
there except those dummies.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoallow documentation to be configured
Zachary T Welch [Tue, 17 Nov 2009 14:54:56 +0000 (06:54 -0800)]
allow documentation to be configured

Add --disable-doxygen-html and --enable-doxygen-pdf options to the
configure script, allowing user to change the defaults.  These
update the proess of munging the Doxygen configuration file to
use the settings thusly provided.  Add options in README.

14 years agoupdate doxygen configuration to produce a PDF
Zachary T Welch [Tue, 17 Nov 2009 14:04:03 +0000 (06:04 -0800)]
update doxygen configuration to produce a PDF

A single PDF file for the developer manual allows accessing a single
index, browsing, and searching.  It takes significantly more time to
build this way, but this patch allows others to look at the results.

Migration Tip: If you have previously built the HTML Doxygen
documentatation, rename your 'doxygen' directory to 'doxygen/html'
to prevent needlessly rebuilding those files.

14 years agoupdate command_handler documentation
Zachary T Welch [Tue, 17 Nov 2009 13:38:17 +0000 (05:38 -0800)]
update command_handler documentation

Improve the developer manual and primer sections which talk about
writing command handlers.  Notably, it documents the new CMD_* macros.

14 years agoremove unused variable from run_command
Zachary T Welch [Mon, 16 Nov 2009 23:45:17 +0000 (15:45 -0800)]
remove unused variable from run_command

14 years agoadd CMD_NAME variable in command_invocation
Zachary T Welch [Mon, 16 Nov 2009 13:46:15 +0000 (05:46 -0800)]
add CMD_NAME variable in command_invocation

Update CMD_NAME from its migratory home in CMD_ARGV[-1] to cmd->name.
Allows CMD_ARGV++ idiom to be used safely in command handlers.

14 years agoadd struct command_invocation for COMMAND_HANDLER
Zachary T Welch [Sun, 15 Nov 2009 12:21:17 +0000 (04:21 -0800)]
add struct command_invocation for COMMAND_HANDLER

Adds the command_invocation structure to encapsulate parameters for
all COMMAND_HANDLER routines.  Rather than passing several arguments
to each successive subroutine, a single pointer may be passed around.

Changes the CMD_* macros to reference the new fields.

Updates run_command to create an instance and pass it to the handler.

14 years agocommand_handler: change 'cmd_ctx' to CMD_CTX
Zachary T Welch [Sun, 15 Nov 2009 13:57:37 +0000 (05:57 -0800)]
command_handler: change 'cmd_ctx' to CMD_CTX

Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.

14 years agocommand_handler: change 'args' to CMD_ARGV
Zachary T Welch [Sun, 15 Nov 2009 16:15:59 +0000 (08:15 -0800)]
command_handler: change 'args' to CMD_ARGV

This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.

14 years agocommand_handler: change to 'argc' to CMD_ARGC
Zachary T Welch [Sun, 15 Nov 2009 12:57:12 +0000 (04:57 -0800)]
command_handler: change to 'argc' to CMD_ARGC

This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.

14 years agoadd more command_handler conversion macros
Zachary T Welch [Sun, 15 Nov 2009 12:18:51 +0000 (04:18 -0800)]
add more command_handler conversion macros

Add additional macros to allow command handling to be migrated easily:
CMD_CTX, CMD_ARGC, and CMD_ARGV.  Updates CMD_NAME to use CMD_ARGV.

In addition to making the remaining patches of this series cleaner,
this introduces easily sed-able symbols that could allow us to retire
these once the command handler infrastructure matures (i.e. pre-1.0).

14 years agotarget: simplify register get/set ops
David Brownell [Tue, 17 Nov 2009 17:06:45 +0000 (09:06 -0800)]
target: simplify register get/set ops

No need to indirect from registered integers to pointers.
Just stash the pointers directly in the register struct,
and don't even bother registering.

This is a small code shrink, speeds register access just
a smidgeon, and gets rid of another rude exit() path.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agojtag_registers: Avalon bridge flushing tweaks
Øyvind Harboe [Tue, 17 Nov 2009 10:03:55 +0000 (11:03 +0100)]
jtag_registers: Avalon bridge flushing tweaks

The code is now much more explicit. It flushes every
N writes. For now flush every time, but tinkering with
the bridge FIFO size and how often we flush clearly
points in the direction of the Avalon write FIFO full
being the culprit.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: revC UART forwarding
Øyvind Harboe [Tue, 17 Nov 2009 10:00:02 +0000 (11:00 +0100)]
zy1000: revC UART forwarding

Name of serial device differs between revB/C.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: add version command to print FPGA version and timestamps
Øyvind Harboe [Fri, 13 Nov 2009 12:54:20 +0000 (13:54 +0100)]
zy1000: add version command to print FPGA version and timestamps

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: fix bug when running on non-arm CPU
Øyvind Harboe [Thu, 12 Nov 2009 09:10:11 +0000 (10:10 +0100)]
zy1000: fix bug when running on non-arm CPU

Shifting by more than 32 is undefined for 32 bit integers according
to the C standard. Robust solution is conditional code.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agozy1000: fix trivial syntax error introduced by latest refactorings
Øyvind Harboe [Tue, 17 Nov 2009 13:51:09 +0000 (14:51 +0100)]
zy1000: fix trivial syntax error introduced by latest refactorings

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
14 years agoARM9TDMI: remove now-needless "struct arm9tdmi"
David Brownell [Tue, 17 Nov 2009 09:09:50 +0000 (01:09 -0800)]
ARM9TDMI: remove now-needless "struct arm9tdmi"

And move the rest of the vector_catch stuff into the C file;
it's not part of the module interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM7TDMI: remove now-needless "struct arm7tdmi"
David Brownell [Tue, 17 Nov 2009 09:09:06 +0000 (01:09 -0800)]
ARM7TDMI: remove now-needless "struct arm7tdmi"

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: remove some more duplicate includes
David Brownell [Tue, 17 Nov 2009 09:06:16 +0000 (01:06 -0800)]
target: remove some more duplicate includes

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7-A: no exit() calls
David Brownell [Tue, 17 Nov 2009 01:58:58 +0000 (17:58 -0800)]
ARMv7-A: no exit() calls

Also, switch integrity check over to the correct magic number,
and remove duplicate v4/v5 #define.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-A8: no exit() calls, add missing v7-A init
David Brownell [Tue, 17 Nov 2009 01:57:12 +0000 (17:57 -0800)]
Cortex-A8: no exit() calls, add missing v7-A init

Eventually there should be a v7a init routine, but for now
all that is inlined here.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoXScale: fewere exit() calls
David Brownell [Tue, 17 Nov 2009 01:55:49 +0000 (17:55 -0800)]
XScale: fewere exit() calls

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoMIPS: no exit() calls
David Brownell [Tue, 17 Nov 2009 01:55:30 +0000 (17:55 -0800)]
MIPS: no exit() calls

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7-M: no exit() calls
David Brownell [Tue, 17 Nov 2009 01:54:51 +0000 (17:54 -0800)]
ARMv7-M: no exit() calls

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv4/ARMv5: no exit() calls
David Brownell [Tue, 17 Nov 2009 01:52:50 +0000 (17:52 -0800)]
ARMv4/ARMv5: no exit() calls

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: fewer exit() calls
David Brownell [Tue, 17 Nov 2009 01:51:55 +0000 (17:51 -0800)]
ARM11: fewer exit() calls

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoCortex-M3: don't exit()
David Brownell [Tue, 17 Nov 2009 00:42:51 +0000 (16:42 -0800)]
Cortex-M3: don't exit()

Get rid of undesirable and needless exit() calls
from the Cortex-M3 support.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARMv7A: use standard disassembler
David Brownell [Tue, 17 Nov 2009 00:36:21 +0000 (16:36 -0800)]
ARMv7A: use standard disassembler

We no longer need v7A-specific code for this.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: register (most) standard ARM commands
David Brownell [Tue, 17 Nov 2009 00:36:12 +0000 (16:36 -0800)]
ARM11: register (most) standard ARM commands

Have ARM11 register the "standard" ARM commands.  For now, only
disassembly really works.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: "armv4_5" command prefix becomes "arm"
David Brownell [Tue, 17 Nov 2009 00:36:09 +0000 (16:36 -0800)]
ARM: "armv4_5" command prefix becomes "arm"

Rename the "armv4_5" command prefix to straight "arm" so it makes
more sense for newer cores.  Add a simple compatibility script.

Make sure all the commands give the same "not an ARM" diagnostic
message (and fail properly) when called against non-ARM targets.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoJTAG: fix autoprobe failure.
David Brownell [Tue, 17 Nov 2009 00:36:03 +0000 (16:36 -0800)]
JTAG: fix autoprobe failure.

Fix bug noted by Øyvind: terminate the IR length autoscan when
the IR is too long, or otherwise broken.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agofileio: improve API types
Zachary T Welch [Fri, 13 Nov 2009 22:44:53 +0000 (14:44 -0800)]
fileio: improve API types

Use size_t instead of uint32_t when specifying file sizes.  Update all
consumers up through the layers to use size_t when required.  These
changes should be safe, but the higher-levels will need to be updated
further to receive the intended benefits (i.e. large file support).

Add error checking for fileio_read and file_write.  Previously, all
errors were being silently ignored, so this change might cause some
problems for some people in some cases.  However, it gives us the chance
to handle any errors that do occur at higher-levels, rather than burying
our heads in the sand.

14 years agostruct fileio: improve member types
Zachary T Welch [Fri, 13 Nov 2009 22:22:21 +0000 (14:22 -0800)]
struct fileio: improve member types

Add const keyword to file url and cast to free().

Make size an ssize_t and chase all format strings that use it.

14 years agohelper/log: improve API parameter types
Zachary T Welch [Sun, 15 Nov 2009 11:42:45 +0000 (03:42 -0800)]
helper/log: improve API parameter types

Uses unsigned type to pass line numbers.

Use uint64_t to pass sleep routines their milliseconds.  Updates sleep
routines to use this type and improve whitespace.

14 years agouse Jim_CmdProc in jim_register
Zachary T Welch [Sun, 15 Nov 2009 12:05:33 +0000 (04:05 -0800)]
use Jim_CmdProc in jim_register

The jim_register command just needed to use the type defined by jim.h.

14 years agoimprove constness of open_file_from_path
Zachary T Welch [Fri, 13 Nov 2009 22:21:56 +0000 (14:21 -0800)]
improve constness of open_file_from_path

14 years agomake command line options const
Zachary T Welch [Sun, 15 Nov 2009 11:53:19 +0000 (03:53 -0800)]
make command line options const

The getopt_long call allows a const struct option, so mark ours
const too.

14 years agoARM: standard disassembler uses Thumb2 entry
David Brownell [Mon, 16 Nov 2009 23:29:14 +0000 (15:29 -0800)]
ARM: standard disassembler uses Thumb2 entry

Tweak "standard" ARM disassembler diagnostics to fail if the target
is not "an ARM" (vs. not "an ARMV4/5"), so it makes more sense for
cores inheriting this as the "generic" disassembler.

Also, to use the Thumb2 entry instead of the original Thumb entry.
This makes it work better for both newer cores (which support those
added instructions) and for BL and BLX instructions on older cores.
(Those instructions are 32-bits, which requires curious state-aware
code to go through a 16-bit decode interface...)

Plus minor cleanups, notably to have fewer exit paths and to make
sure they all return failure codes.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: don't include "log.h" from "armv4_5.h"
David Brownell [Mon, 16 Nov 2009 23:27:40 +0000 (15:27 -0800)]
target: don't include "log.h" from "armv4_5.h"

No point in multiple includes, and that file doesn't
use its functions any more.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: move mode functions out of header
David Brownell [Mon, 16 Nov 2009 23:27:36 +0000 (15:27 -0800)]
ARM: move mode functions out of header

They're really too big to inline, at least for code that's
not in any performance-critical loops.

Also move the associated string table to the rodata section.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoJTAG: no LOG_WARNING() for taps without IDCODE
David Brownell [Mon, 16 Nov 2009 23:18:55 +0000 (15:18 -0800)]
JTAG: no LOG_WARNING() for taps without IDCODE

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agobinarybuffer: regression fix
David Brownell [Mon, 16 Nov 2009 22:50:07 +0000 (14:50 -0800)]
binarybuffer: regression fix

The "improve inline binarybuffer helpers" mis-handled bytes
with the high bit set; treat them as unsigned, not signed.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years ago"types.h" doxygen fix
David Brownell [Mon, 16 Nov 2009 18:42:01 +0000 (10:42 -0800)]
"types.h" doxygen fix

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: less implicit inclusion of "etm.h"
David Brownell [Mon, 16 Nov 2009 18:19:33 +0000 (10:19 -0800)]
target: less implicit inclusion of "etm.h"

Don't include it in more headers than necessary; just
use it in the few files that actually need it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agomove ARRAY_SIZE macro to types.h
Zachary T Welch [Mon, 16 Nov 2009 11:29:30 +0000 (03:29 -0800)]
move ARRAY_SIZE macro to types.h

The ARRAY_SIZE macro was defined in several target files, so move it
to types.h.

This patch also removes two other identical macros: DIM (from jtag.h)
and asizeof (from arm11.h).

14 years agoarmv7m: make core reg read/write use unsigned
Zachary T Welch [Mon, 16 Nov 2009 11:33:22 +0000 (03:33 -0800)]
armv7m: make core reg read/write use unsigned

Eliminate redundant check that gets covered by using unsigned type.
Created to eliminate noise from subsequent patches, but this kind of
conversion will be beneficial in similar ways throughout the tree.

14 years agoremove TAP_SCAN_BYTES macro
Zachary T Welch [Mon, 16 Nov 2009 11:12:45 +0000 (03:12 -0800)]
remove TAP_SCAN_BYTES macro

Use DIV_ROUND_UP(n, 8) instead of TAP_SCAN_BYTES macro.

14 years agorename CEIL as DIV_ROUND_UP
Zachary T Welch [Mon, 16 Nov 2009 10:53:57 +0000 (02:53 -0800)]
rename CEIL as DIV_ROUND_UP

Improves the name of this macro, moves it to types.h, and adds a block
of Doxygen comments to describe what it does.

14 years agomove container_of to types.h
Zachary T Welch [Mon, 16 Nov 2009 10:29:09 +0000 (02:29 -0800)]
move container_of to types.h

The container_of macro is useful as a general solution.  It belongs
in types.h, rather than target.h where it was introduced.  Requires
the offsetof macro, which comes from <stddef.h> (moved as well).

14 years agonand_command_get_device_by_num: make COMMAND_HELPER
Zachary T Welch [Sun, 15 Nov 2009 15:20:19 +0000 (07:20 -0800)]
nand_command_get_device_by_num: make COMMAND_HELPER

Use COMMAND_HELPER macro to define nand_command_get_device_by_num.
Use CALL_COMMAND_HANDLER to invoke it.

14 years agoflash_command_get_bank_by_num: make COMMAND_HELPER
Zachary T Welch [Sun, 15 Nov 2009 14:48:20 +0000 (06:48 -0800)]
flash_command_get_bank_by_num: make COMMAND_HELPER

Use COMMAND_HELPER macro to declare flash_command_get_bank_by_num.
This is required for COMMAND_PARSE_NUMBER macro.

14 years agocleanup jtag minidrivers
Zachary T Welch [Mon, 16 Nov 2009 12:29:45 +0000 (04:29 -0800)]
cleanup jtag minidrivers

Remove two vestigial externs from our JTAG minidriver source files.
Also, removes many extra blank lines from the minidummy driver.

14 years agoAdd 'nand verify' command
Zachary T Welch [Sun, 8 Nov 2009 05:20:45 +0000 (21:20 -0800)]
Add 'nand verify' command

Add the 'nand verify' command to perform a dump and fake-write
simultaneously, checking the read bits against those generated by the
write process.  Appropriate user documentation for this command has
been added to the user guide as well.

The algorithm presently makes a relatively naive comparison.  Some chips
that use ECC may not verify correctly using this implementation, but the
new documentation provides details about this limitation.

14 years agoAdd FILEIO_NONE access mode.
Zachary T Welch [Sun, 8 Nov 2009 06:37:39 +0000 (22:37 -0800)]
Add FILEIO_NONE access mode.

In some cases, the FILEIO_NONE access mode may be useful as a parameter
to indicate that file access should be disabled.  High-level routines can
use it to skip file access calls, as 'fileio_open' will fail presently
if called to open a file using this mode.

14 years agoUse nand_fileio_* in write/dump commands.
Zachary T Welch [Fri, 6 Nov 2009 03:45:24 +0000 (19:45 -0800)]
Use nand_fileio_* in write/dump commands.

This patch eliminates duplicated code in the the NAND 'dump' and 'write'
by using the new static helper functions.

These changes also fix a possible memory leak in nand dump command, in
the case that the dump file failed to open.

Overall, the changes should be functionally equivalent, but the
resulting code will be easier to improve and extend further.

14 years agoAdd nand_fileio_* helper APIs.
Zachary T Welch [Sun, 8 Nov 2009 10:06:34 +0000 (02:06 -0800)]
Add nand_fileio_* helper APIs.

This patch provides helpers APIs that will eliminate duplicated code in
the the NAND 'dump' and 'write' commands by factoring their common code
into static helper functions.  These helpers may be useful for creating
new commands, as shown in the final patch to 'verify' flash from a file.

Several previously unreported error conditions now generate messages and
propogate the return codes, such as when the file fails to open and bad
arguments are given.  These changes will fix a possible memory leak in
nand dump command, in the case that the dump file failed to open.

Overall, the changes should be functionally equivalent, but the
resulting code will be easier to improve and extend consistently.

14 years agobinarybuffer: add API documentation
Zachary T Welch [Mon, 16 Nov 2009 09:10:46 +0000 (01:10 -0800)]
binarybuffer: add API documentation

Adds Doxygen documentation for a number of the binarybuffer APIs,
including "unexpected" behavior exposed during review on the list.

14 years agoimprove inline binarybuffer helpers
Zachary T Welch [Sat, 14 Nov 2009 14:26:55 +0000 (06:26 -0800)]
improve inline binarybuffer helpers

Use void*, unsigned, and bool types with inline helpers.

14 years agoimprove buf_set_buf helper
Zachary T Welch [Sat, 14 Nov 2009 18:44:37 +0000 (10:44 -0800)]
improve buf_set_buf helper

Use void * and unsigned types for buffer and their sizes.
Allows it to be used with more than uint8_t * without casts.

14 years agoimprove buf_set_ones
Zachary T Welch [Sat, 14 Nov 2009 18:41:35 +0000 (10:41 -0800)]
improve buf_set_ones

Use memset instead of loop. Improve types, using void * and unsigned.

14 years agoimprove buf_cpy helper
Zachary T Welch [Sat, 14 Nov 2009 18:36:57 +0000 (10:36 -0800)]
improve buf_cpy helper

Use memcpy for bulk of copy, improve final byte handling.
Improve types by using void * for buffers and unsigned for size.

14 years agoimprove buf_cmp and buf_cmp_mask helpers
Zachary T Welch [Sat, 14 Nov 2009 18:27:34 +0000 (10:27 -0800)]
improve buf_cmp and buf_cmp_mask helpers

Rewrite buf_cmp to use memcpy for bulk of comparison.  Add static
helper to perform comparison of trailing byte, which uses another
static helper to perform a maksed comparison.  The masked comparison
helper is used by the buf_cmp_mask to simplify its loop.
Improve types to use void *, unsigned, and return bool.

14 years agoimprove str_to_buf and buf_to_str helpers
Zachary T Welch [Sat, 14 Nov 2009 18:14:04 +0000 (10:14 -0800)]
improve str_to_buf and buf_to_str helpers

Improve types: use void * and unsigned.  Move all variables to point of
first use.  Move radix guessing logic to new str_radix_guess helper.

14 years agobinarybuffer: move variables to point of first use
Zachary T Welch [Sat, 14 Nov 2009 16:19:24 +0000 (08:19 -0800)]
binarybuffer: move variables to point of first use

Reduce some noise from subsequent patches.

14 years agobinarybuffer: fix whitespace related issues
Zachary T Welch [Sat, 14 Nov 2009 16:10:22 +0000 (08:10 -0800)]
binarybuffer: fix whitespace related issues

Add inter-operator whitespace.  Improve existing documentation.

14 years ago#include "target.h" less wildly
David Brownell [Mon, 16 Nov 2009 08:35:24 +0000 (00:35 -0800)]
#include "target.h" less wildly

Don't include "target.h" from more headers than necessary.  This
avoids needless interdependencies and duplicated include paths.

Don't needlessly include it in source files, either.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: no implicit #includes of "register.h"
David Brownell [Mon, 16 Nov 2009 08:35:14 +0000 (00:35 -0800)]
target: no implicit #includes of "register.h"

Same deal:  "register.h" got needlessly included all over the
place because of being in a few widely included headers.

So take it out of the header files which included it, and put
it in files which use it ... reduce needless interdependencies.

Also, don't need that extra "types.h" inclusion.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: less implicit inclusion of "command.h"
David Brownell [Mon, 16 Nov 2009 08:35:11 +0000 (00:35 -0800)]
target: less implicit inclusion of "command.h"

Lots of files still include it, often through needless
duplicate inclusion of "log.h"; sigh.

This cleans up the inclusion graph a bunch, so there are
fewer inclusion paths, but it doesn't change much otherwise.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: don't implicitly include "algorithm.h"
David Brownell [Mon, 16 Nov 2009 08:35:05 +0000 (00:35 -0800)]
target: don't implicitly include "algorithm.h"

Most files in the tree seem to have ended up including this,
and *quite* needlessly ... only code implementing or using
downloadable algorithms actually needs these declarations.

So take it out of the header files which included it, and put
it in files which use it ... reduce needless interdependencies.

Also: "algorithm.h" doesn't need to include "types.h" again;
it already comes from a different header.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: don't implicitly include "breakpoint.h"
David Brownell [Mon, 16 Nov 2009 08:34:57 +0000 (00:34 -0800)]
target: don't implicitly include "breakpoint.h"

Most files in the tree seem to have ended up including this,
and *quite* needlessly ... only code implementing or using
breakpoints actually needs these declarations.

So take it out of the header files which included it, and put
it in files which use it ... reduce needless interdependencies.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: use now-generic memory utils
David Brownell [Sun, 15 Nov 2009 18:35:47 +0000 (10:35 -0800)]
ARM11: use now-generic memory utils

Now the ARM11 cores can use the renamed arm_checksum_memory()
and arm_blank_check_memory() routines ... do so.

Sanity checked with "flash erase_check" of both NOR banks on an
OMAP2420 ... the algorithm code dumped four lines of of "poll"
status after each of almost 520 blocks (yes, *very* annoying) but
gave plausible results after producing that spam.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: fixup method table
David Brownell [Sun, 15 Nov 2009 18:35:41 +0000 (10:35 -0800)]
ARM11: fixup method table

Three changes:  remove ARM11_HANDLER() in favor of normal structure
initialization syntax; fix goofy indentation in that structure; and
don't needlessly export arm11_register_commands(), it's only called
through that method table.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM: memory utils aren't ARM7/ARM9 dependent
David Brownell [Sun, 15 Nov 2009 18:35:34 +0000 (10:35 -0800)]
ARM: memory utils aren't ARM7/ARM9 dependent

The arm7_9_checksum_memory() and arm7_9_blank_check_memory()
routines are not actually specific to the ARM7 and ARM9 core
generations ... they can work for any core which can run
algorithms using basic ARM (not Thumb) instructions.

Rename them; move the declarations to a more generic site;
likewise move the code (and tidy it a bit in the process).

NOTE:  the blank_check() method falsely returned a success
status (0) on one error path, when the algorithm failed.
Fixed this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agotarget: make "examined" flag be per-target
David Brownell [Sun, 15 Nov 2009 18:35:25 +0000 (10:35 -0800)]
target: make "examined" flag be per-target

Previously this flag was stored in "target_type", so that for example
if there were two ARM7TDMI targets in a scan chain, both would claim
to have been examined although only the first one actually had its
examine() method called.

Move this state to where it should have been in the first place, and
hide a method that didn't need exposure ... the flag is write-once.

Provide some doxygen.  The examine() method is confusing, since it
isn't separating one-time setup from the after-each-reset stuff.  And
the ARM7/ARM9 version is, somewhat undesirably, not leaving the debug
state alone after reset ... probably more of an issue for trace setup
than for watchpoints and breakpoints.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoarm-jtag-ew,jlink: switch to COMMAND_HANDLER
Zachary T Welch [Sun, 15 Nov 2009 17:12:44 +0000 (09:12 -0800)]
arm-jtag-ew,jlink: switch to COMMAND_HANDLER

These drivers were overlooked during the recent upgrade.  Convert them,
moving their registration routines to eliminate their declarations.

14 years agorlink: fix overzealous sed
Zachary T Welch [Sun, 15 Nov 2009 17:11:29 +0000 (09:11 -0800)]
rlink: fix overzealous sed

Fix an instance where my cleanup when awry.

14 years agoremove unused arm_jtag_buf_to_* helpers
Zachary T Welch [Sat, 14 Nov 2009 14:48:30 +0000 (06:48 -0800)]
remove unused arm_jtag_buf_to_* helpers

Removes unused arm_jtag_buf_* helpers from arm_jtag.[ch].  These could
reappear if patches are provided to conver the tree to use them, but
this code should not be in the master tree until that series is ready.

14 years agoremove unused buf_to_u32_handler
Zachary T Welch [Sat, 14 Nov 2009 14:41:58 +0000 (06:41 -0800)]
remove unused buf_to_u32_handler

Purge an unused routine from the tree and remove a layering violation.
If this code is needed, it should reappear somwhere in src/jtag/,
where struct scan_field gets defined.

14 years agostruct scan_field_s -> struct scan_field
Zachary T Welch [Sat, 14 Nov 2009 14:30:02 +0000 (06:30 -0800)]
struct scan_field_s -> struct scan_field

Remove obsolete suffix from struct scan_field.  Somehow, these
definitions did not get updated but did not cause any errors.

14 years agoFix for md* commands, similar to mw*.
Krzysztof Dziuba [Sat, 14 Nov 2009 19:59:56 +0000 (20:59 +0100)]
Fix for md* commands, similar to mw*.

14 years agolpc2900.h -- remove from Makefile.am too
David Brownell [Sat, 14 Nov 2009 22:58:14 +0000 (14:58 -0800)]
lpc2900.h -- remove from Makefile.am too

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoflash: remove needless lpc2900.h header
David Brownell [Sat, 14 Nov 2009 22:53:19 +0000 (14:53 -0800)]
flash: remove needless lpc2900.h header

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoremove annoying $URL$ startup message
David Brownell [Sat, 14 Nov 2009 20:42:50 +0000 (12:42 -0800)]
remove annoying $URL$ startup message

It's completely unused; the obnoxious "DANGER!!!" comments
don't even explain what it was doing (shorthand SVN magic).

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoInvalid command syntax errors with MWW.
Dean Glazeski [Sat, 14 Nov 2009 18:39:08 +0000 (12:39 -0600)]
Invalid command syntax errors with MWW.

This fixes an issue due to the new command handler syntax caused by the mw handler playing with the args pointer before
using the CMD_NAME macro.  Fix is to move this call above the lines changing args.

14 years agoadd openocd.h for top-level declarations
Zachary T Welch [Sat, 14 Nov 2009 15:29:16 +0000 (07:29 -0800)]
add openocd.h for top-level declarations

Create src/openocd.h to hold declarations previously made internally
by src/main.c and src/server/server.c.  This ensures all functions
are verified to be in-sync at compile time (rather than at link),
making it easier to track down bugs.

14 years agocompile with cygwin (32-bit)
Ferdinand Postema [Thu, 12 Nov 2009 22:21:33 +0000 (23:21 +0100)]
compile with cygwin (32-bit)

Changed some printf format strings..

[dbrownell@users.sourceforge.net: shrink lines, fix indents]

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: ETM + ETB support
David Brownell [Sat, 14 Nov 2009 00:58:14 +0000 (16:58 -0800)]
ARM11: ETM + ETB support

Kick in ETM (and ETB) support for ARM11.  Tested on OMAP 2420,
so update that configuration.  (That's an ARM1136ejs, ETB,
OpenGL ES1.1, C55x DSP, etc.)

Also update the other ARM11 ETM + ETB targets in the tree
to set up these modules.  (Not tested.)

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM11: revert etmr/etmw commands
David Brownell [Sat, 14 Nov 2009 00:56:11 +0000 (16:56 -0800)]
ARM11: revert etmr/etmw commands

These aren't desirable, given "standard" ETM support.
Also remove the now-unused arm11_find_target().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoiMX2* + ETB targets: hook up ETM and ETB
David Brownell [Sat, 14 Nov 2009 00:56:11 +0000 (16:56 -0800)]
iMX2* + ETB targets: hook up ETM and ETB

ARM9 cores with an ETB will have a matching ETM.
Hook them both up by default.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoARM7/ARM9: use shared examine() method
David Brownell [Sat, 14 Nov 2009 00:26:39 +0000 (16:26 -0800)]
ARM7/ARM9: use shared examine() method

No point in having two identical examine methods for the
ARM7TDMI and ARM9TDMI drivers; move, rename, shrink, share.

Add a bit of doxygen; stop needlessly exporting a method.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
14 years agoETM: simplify ETM initialization code paths
David Brownell [Sat, 14 Nov 2009 00:26:39 +0000 (16:26 -0800)]
ETM: simplify ETM initialization code paths

Return NULL from etm_build_reg_cache() not ERROR_OK; and share
code on that fault path.

Let ETM code handle any tracking of its cache -- not callers.

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