Commit Graph

3589 Commits (c9e448222cc5d1162f5e495cdfd327732c50a484)

Author SHA1 Message Date
Zachary T Welch df22f0f9ca improve command handler wrapper script
Adds 'ocd_bouncer' in startup.tcl that is called as a helper for
all command handlers, shrinking the embedded C wrapper to a mere stub.

Jim handlers are called directly, simple handlers get called with the
wrapper to capture and discard their output on error, and placeholders
call help directly (though the unknown handler still does this too).
It attempts to improve the quality of the error messages as well.
2009-11-28 13:00:38 -08:00
Zachary T Welch 37dd5a685a add 'command type' introspective handler
Adds the 'command' group handler, with the 'type' command producing
a string that tells whether the given command is 'native' (for Jim-based
command handlers), 'simple' (for simple built-in commands), 'group'
for command group placeholders, and 'unknown' if not found in the
command registration tables (e.g. core built-ins functions).
2009-11-28 12:58:35 -08:00
David Brownell 5f0223423d ARM11: fix warning on amd64
Previous version of JTAG_DEBUG() macro hid this bug.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 11:55:00 -08:00
David Brownell 30f6142fc8 ARM11: fix dbgtap JTAG_DEBUG
There is no DEBUG() macro; don't call one!  Always at
least *parse* debug code, to help prevent such errors.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 11:28:17 -08:00
David Brownell acbe054a38 target: uplevel add_{break,watch}point() error checks
In target_type.h it's documented that the target must be
halted for add_breakpoint() ... and with slight ambiguity,
also for its add_watchpoint() sibling.  So rather than
verifying that constraint in the CPU drivers, do it in the
target_add_{break,watch}point() routines.

Add minor paranoia on the remove_*point() paths too:  save
the return value, and print it out in in the LOG_DEBUG message
in case it's nonzero.

Note that with some current cores, like all ARMv7 ones I've
looked at, there's no technical issue preventing watchpoint or
breakpoint add/remove operations on active cores.  This model
seems deeply wired into OpenOCD though.

ALSO:  the ARM targets were fairly "good" about enforcing that
constraint themselves.  The MIPS ones were relied on other code
to catch such stuff, but it's not clear such code existed ...
keep an eye out for new issues on MIPS.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 10:40:26 -08:00
David Brownell 68889ea02f target: remove unused TARGET_EVENT_OLD_* symbols
Just two *_OLD_* symbols left...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-28 10:36:32 -08:00
David Brownell 5782999f60 NEWS: mention new reset-assert event
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:53:43 -08:00
David Brownell ddce517e3a omap3530.cfg: use new "reset-assert" event
Replaces previous "reset-assert-pre" workaround.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:31 -08:00
David Brownell e0cb27df6b Cortex-A8: support "reset-assert" event
Use the new "reset-assert" event; else SRST; else fail.
Tested on an OMAP3, using the event.

NOTE:  still doesn't handle "reset halt".  For some reason
neither VCR nor PRCR seemed effective; they held the value
that was written, but VCR didn't trigger debug entry when
the reset vector fired (maybe the vector needs configuring?)
and PRCR refused to hold the chip in reset until deassert()
could force the core into debug state.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:26 -08:00
David Brownell 4e56a2303b target: groundwork for "reset-assert" event
This defines a "reset-assert" event and a supporting utility
routine, and documents both how targets should implement it
and how config scripts should use it.  Core-specific updates
are needed to make this work.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:50:20 -08:00
David Brownell 4d2750e571 ARM11: write_memory() avoids increment check
When writing to a chip's "reset yourself" register, the ARM11 code
was reporting a spurious failure.  Just don't bother checking for
correctly incremented pointers given single-unit writes ... it's
a bit faster that way too.  (Reads should likely do the same thing.
For that matter, such checks are usually just a waste...)

Shrink an overlong parameter name, and associated lines'o'code.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-27 18:40:37 -08:00
Zachary T Welch 77aa7ca8d6 fix regression causing duplicated output
The command refactoring caused subcommand handlers to produce duplicate
output when run.  The problem was introduced by failing to ensure all
such invocations went through a top-level "catcher" script, prefixing
the command name with the 'ocd_' prefix and consuming its results.

The fix is to ensure such a top-level "catcher" script gets created
for each top-level command, regardless of whether it has a handler.
Indeed, this patch removes all command registrations for sub-commands,
which would not have worked in the new registration scheme anyway.

For now, dispatch of subcommands continues to be handled by the new
'unknown' command handler, which gets fixed here to strip the 'ocd_'
prefix if searching for the top-level command name fails initially.
Some Jim commands may be registered with this prefix, and that situation
seems to require the current fallback approach.  Otherwise, that prefix
could be stripped unconditionally and the logic made a little simpler.
The same problem must be handled by the 'help' command handler too,
so its lookup process works as intended.

Overall, the command dispatching remains more complicated than desired,
but this patch fixes the immediate regressions.
2009-11-27 14:30:26 -08:00
Øyvind Harboe a0d983ab06 zy1000: keep up with new command registration stuff
jim and classic style commands are both supported.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-27 20:41:06 +01:00
Zachary T Welch 6ce3a299f3 update minidummy interface driver command handling
Changes the interface definition field reference from register_commands
to commands, which allows the module to compile.
2009-11-27 11:11:26 -08:00
Zachary T Welch f31dfffdef fix 'nand info' command
Move device argument parsing after check for number of arguments;
otherwise, calling this command without any arguments would access
argv[0] before checking whether it even existed.
2009-11-27 11:11:26 -08:00
Øyvind Harboe 46ed068bac zy1000: keep up with changes to log_init()
fn's and return value for log_init() changed to void.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-27 19:42:38 +01:00
Øyvind Harboe bd3ef5ca3d minidummy: fix compilation error
during refactoring a search and replace error crept in

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-27 09:10:37 +01:00
Dean Glazeski 2221a03744 ARM NAND I/O header documentation update.
Fixed the header file to properly specify the doxygen documentation for the
items defined in it.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:57:56 -08:00
Dean Glazeski 8f3c728273 ARM NAND I/O documentation update.
This updates the functions in the file to all have doxygen comments
describing what they do.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:56:58 -08:00
Dean Glazeski 05a5f682c6 ARM NAND I/O refactor code copying.
Created a function for copying code to the working area on
a target.  The NAND write and read functions are updated to
include use of this function.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:55:40 -08:00
Dean Glazeski ffc704fdeb ARM NAND I/O read function.
Implementation of the NAND read function for ARM NAND I/O that
includes running a local algorithm on a device to increase the
performance of block reads.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:52:52 -08:00
Dean Glazeski 7c9cd47893 NAND Flash documentation update.
Updated doxygen comments for different interface structures for
the NAND interface.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 23:45:41 -08:00
David Brownell fd5f53f035 XScale: add stub {read,write}_phys routines
Just make these fail, instead of letting them write over
potentially random memory.  Users should be able to work
around the lack of real implementations by disbling the
MMU by hand ... until someone provides a Real Fix.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-26 12:00:56 -08:00
Uwe Hermann e07ad30577 update bug reporting information
The Berlios bug-tracker is disabled, bug reports go to the list.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-26 10:12:58 -08:00
Uwe Hermann cfc02ccca2 fix typos in documentation
Fixes some minor typos in the top-level documentation files.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-26 10:12:22 -08:00
Uwe Hermann 1240ae459f fix typos in source files
Correct some spelling errors in source comments and printed output.

Signed-off-by: Zachary T Welch <zw@superlucidity.net>
2009-11-26 10:11:26 -08:00
Øyvind Harboe 060980357d styleguide: add some embedded style rules.
Embedded and pthreads rely on modest and predictable
stack usage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-26 17:35:55 +01:00
Eric Wetzel 3f8aa3cb03 fix 'flash protect' and 'flash erase_sector'
Command upgrading introduced two off-by-one bugs in the flash commands.
This patch fixes the 'flash {protect,erase_sector}' commands to check
that they have been passed the correct number of arguments.

Ammended during commit to fix help text for 'erase_address' too.
2009-11-26 07:57:51 -08:00
David Brownell 2653b80307 target: create and use target_name()
Several of the sites now using target_type_name() really
ought to be using an instance-specific name.  Create a
function called target_name(), accessing the instance's
own (command) name.

Use it in several places that really should be displaying
instance-specific names.  Also in several places which
were already doing so, but which had no wrapper to call.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
David Brownell b715a81f5b target: target_get_name() --> target_type_name()
There are two names that may matter on a per-target basis.
One is a per-instance name (for example, "at91sam7s.cpu").
The other is the name of its type (for example, "arm7tdmi"),
which is shared among multiple targets.

Currently target_get_name() returns the type name, which is
misleading and is rarely appropriate for target diagnostics.
Rename that as target_type_name().

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:38:08 -08:00
David Brownell ac06d41fc7 omap3530.cfg: yes we have SRAM!
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:19:53 -08:00
David Brownell cc53ad81d3 ARM: minor armv4/armv5 cleanup
Lines of 300+ characters are still bad; debug tweaks.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:18:22 -08:00
David Brownell 21378f58b6 ARM: comment tweaks in ADIv5
"OptimoDE DESS" is ARM's semicustom DSPish stuff.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:14:45 -08:00
David Brownell 5d244b85e2 ARM7/9: shrink run_algorithm_inner() lines
300+ characters is unreasonable.  So is half that.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:11:26 -08:00
David Brownell 83568b6b62 NEWS updates
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-25 16:05:35 -08:00
Zachary T Welch 49036463db update NEWS with recent developments
Mention changes to flash bank command syntax, 'nand verify' command,
command error handling and reporting, and help/usage command upgrades.
2009-11-25 12:08:06 -08:00
Zachary T Welch 4946925bea use ARRAY_SIZE macro
Search and destroy lingering cases where the ARRAY_SIZE macro should
be used to convey more intrinsic meaning in the OpenOCD code.
2009-11-25 10:32:00 -08:00
Zachary T Welch a3d81eed4d support OPENOCD_DEBUG_LEVEL environment setting
Detect the OPENOCD_DEBUG_LEVEL setting in log_init(), allowing the
very early startup phases to be debugged.
2009-11-25 10:29:06 -08:00
Zachary T Welch be482a5335 log: improve initialization
Removes redundant assignment of start_ms from log_register_commands().
Eliminates command_context parameter and return value.
Adds Doxygen comment block for this API call.
2009-11-25 10:29:06 -08:00
Zachary T Welch ed90b6659f update command handler documentation
Adds sections on command registration and chaining, giving an overview
to developers that want to use these features.
2009-11-25 10:29:06 -08:00
Zachary T Welch 9d4c89f37f add 'testee' target type
Alliteration aside, this should provide the final piece of the puzzle
for developers that want to get started writing a new target type.
In this way, it also seeks to complement the 'dummy' interface driver
and 'faux' NOR flash driver.
2009-11-25 10:29:06 -08:00
Zachary T Welch a93b404161 improve command handling examples
Removes hello and foo commands from top-level registration.  Instead,
the dummy interface driver and faux flash driver have been augmented
to register these commands as sub-commands.
2009-11-25 10:29:05 -08:00
Zachary T Welch d89c631014 add script_command_run helper
Eliminates duplicated code in script_command and handle_unknown_command.
Fixes bug with duplicated help output generated by placeholder commands.
2009-11-25 10:29:05 -08:00
Zachary T Welch 9e5d8a94f1 encapsulate and re-use log capture, retval setup
Factors log capture while running script commands, eliminating
duplicated code between script_command and jim_capture.  Factors
setting a command's Jim "retval" into a new helper as well.

Using these new helpers in the new unknown command handler's
fixes possible regressions caused by these bits being missing.
2009-11-25 10:29:05 -08:00
Zachary T Welch 910bb250c4 combine help and usage command handlers
Remove duplicated handler code by checking the running command name.
2009-11-25 10:29:05 -08:00
Zachary T Welch c297a14f70 improve usage and help command output
Rewrite formatting code in C, removing last remenants of TCL help code.
Sinificantly improves the readability by using smarter indent and wrap.
2009-11-24 21:37:37 -08:00
Zachary T Welch 6b066cd170 allow scripts to update usage information
The add_usage_text command uses the same C handler, which was updated
to support its new polymorphic role.  This patch updates the two script
commands that needed this support: 'find' and 'script'.
2009-11-24 21:37:37 -08:00
Zachary T Welch 8f5ff3ddcf httpd: use register_commands()
Updates httpd_start() to use register_commands() for 'readform' and
'writeform' commands.  Adds server/httpd.h to export the new signatures
for this function (and httpd_stop), which allows removing the obsoleted
declarations inside openocd.c.
2009-11-24 21:37:37 -08:00
Zachary T Welch 17a9dea53a add jim_handler to command_registration
Adding jim_handler field to command_registration allows removing the
register_jim helper.  All command registrations now go through the
register_command{,s}() functions.
2009-11-24 21:37:37 -08:00
Zachary T Welch cd7e76ebf0 refactor command_new to use command_registration
Save stack space: use a struct.  Makes it easier to add new parameters.
2009-11-24 21:37:37 -08:00