summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* move improperly located documentationZachary T Welch2009-11-301-15/+17
| | | | | Somehow, the comment block for command handlers ended up associated with the output_handler. Move it to the command_handler_t declaration.
* improve command_done() API and docsZachary T Welch2009-11-302-6/+19
| | | | | | | | | | | | | | | | | | command_done() does not need to return an error, but it needed Doxygen comment. Provide some for copy_command_context as well. Note: this audit revealed some potential bugs with the command context implementation. There was a reason that commands were added at the end of the list. Shallow copying of command_context means that the list is shared between them. And commands added at the top-level before the pre-existing commands will not be available in the shared context as they were before. Yikes! Fortunately, this does not seem to occur in general use, as 'add_help_text' gets registered in startup.tcl and claims the first slot in my own test cases. Thus, it seems that we have been masking the issue for now, but it shows the need for further architectural improvement in the core command module.
* only display usable commands in helpZachary T Welch2009-11-301-0/+3
| | | | | | | With the ability to defer 'init', users can access the help system while still in CONFIG mode. This patch omits commands from the help and usage list when they cannot be run in the current command mode, making it much easier to see what can be done at a given time.
* allow deferal of initZachary T Welch2009-11-301-4/+23
| | | | | | | Adds 'noinit' command to prevent OpenOCD from running 'init' at the end up startup, allowing it to be given from telnet or TCL. This provides the old behavior by default, and users can add this command to their scripts to get the new behavior.
* move server_init() to openocd_main()Zachary T Welch2009-11-302-19/+28
| | | | | | | | | Moves the telnet and TCL server startup to server_init(), moving their respective command registration in to server_register_commands(). Adds proper error checking for these particular startup processes. Moves the core server startup to openocd_main(), improving related error checking and preparing to defer 'init'.
* improve gdb_init() sequenceZachary T Welch2009-11-303-35/+49
| | | | | | | | | | | | Rework gdb_init to create flexible APIs (gdb_target_add_{one,all}) and static helper (gdb_target_start) for starting GDB services. Eliminates duplicated code and provides general mechanisms for adding GDB services. The 'init' command is updated to call the new API, and later patches can decouple its policy of adding all targets therein. Provides the new capability to use both piped and TCP servers when multiple targets are defined. The first target fills the pipe, and others will be started on TCP ports (unless disabled, i.e. gdb_port=0).
* zy1000: keep up with changes to command structureØyvind Harboe2009-11-301-0/+1
| | | | | | | | | | | | | Add missing COMMAND_REGISTRATION_DONE. For now the command syntax for zy1000 needs to be compatible across 0.3/0.4, the world outside OpenOCD interfaces to zy1000 using the old syntax. Post 0.4 release(0.4.1 even) I'll switch to subcommand scheme. Switch to subcommands post 0.3 lifecycle. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* XScale: clean up full_context() (#2)David Brownell2009-11-291-39/+30
| | | | | | | Streamline the loop by continuing as soon as we know there's no work to be done; this lets us un-indent almost everything. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* XScale: clean up full_context() (#1)David Brownell2009-11-291-17/+32
| | | | | | | | | When fetching all the registers, XScale was doing various stupid things like calling number_to_mode() a few dozen times instead of just once, and mapping access to each register three times (again, instead of just once). Stop that. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* XScale: debug entry uses new register mappingDavid Brownell2009-11-291-9/+10
| | | | | | | | Use the new mapping interfaces in the debug entry path. SPSR and the banked registers now have smaller and faster accessors ... use them. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* create target/pxa3xx.cfgMarek Vasut2009-11-291-0/+86
| | | | | | [dbrownell@users.sourceforge.net; remove pxa255 comment] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* XScale: initial PXA3xx supportMarek Vasut2009-11-293-11/+40
| | | | | | [dbrownell@users.sourceforge.net: user's guide; variant param is optional] Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: fix warning on cygwinDavid Brownell2009-11-291-9/+22
| | | | | | Previous version of JTAG_DEBUG() macro hid this bug. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* bugfix: 'init' changes state, not main()David Brownell2009-11-281-1/+2
| | | | | | | | Code other than main() may invoke "init". When it does so, customized handlers may need to run ... so make sure the command context state is updated before they do so. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* fix s3c24xx device command helperlementec fabien2009-11-281-1/+4
| | | | | Returns the common structure for the s3c24xx device, which was somehow nuked during past cleaning efforts.
* Cortex-M3: don't chain "struct arm" commandsDavid Brownell2009-11-281-3/+0
| | | | | | | | | | | | Those commands presume support for the "classic" set of CPU modes (FIQ, supervisor, IRQ, etc) ... which aren't supported by the ARMv7-M or ARMv6-M architectures. They also presume a "struct arm" base type, which this code doesn't use. We haven't cleaned up the register handling enough to be able to share any of those "base" methods. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* add 'nonce' nand driverZachary T Welch2009-11-283-0/+83
| | | | | The nonce NAND driver provides a no-op implementation useful for testing the system independently of any driver side-effects.
* add more stub handlers to testee targetZachary T Welch2009-11-281-2/+22
| | | | Prevent everything from crashing when exercising various commands.
* explode tcl_target_func into many handlersZachary T Welch2009-11-281-387/+521
| | | | | | | | Eliminate the monolithic tcl_target_func by registering each of its commands using the new chained command registration mechanism. Also chains the target's commands under the CPU command, though these may not work properly without some further modification.
* split jim_target into multiple handlersZachary T Welch2009-11-281-109/+137
| | | | | | | | The 'target' command group was implemented using its own command dispatching, which can be eliminated by using the new chained command registration mechanism. This patch splits the jim_target() function into individual handlers, which makes them to be visible to the help and usage commands. These one-trick handlers are much easier to understand.
* split jim_newtap_cmd into piecesZachary T Welch2009-11-281-70/+94
| | | | | Moves the ID and IR-related option parsing to static helpers, removing two levels of indent.
* improve jtag_tap_configureZachary T Welch2009-11-281-77/+88
| | | | | | | Splits bulk of the jtag_tap_configure into jtag_tap_configure_event, removing three or four levels of indentation in the process. The resulting code was stylistically improved in other ways, but it should be functionally identical.
* improve jtag_tap_handle_event indentationZachary T Welch2009-11-281-23/+30
| | | | Use 'continue' to reduce identation levels and superfluous logic.
* begin moving JTAG jim handlers/helpersZachary T Welch2009-11-281-227/+236
| | | | | | | Moves the tertiary jim handlers and required static helpers to the top of tcl.c, defining them in a new registration array that is chained in both the top-level context and under the jtag command. The top-level commands can be removed at some point in the future to reduce clutter.
* split jim_jtag_command into multiple handlersZachary T Welch2009-11-281-180/+212
| | | | | | | | | Explodes the 'jtag' into separate command handlers, which are easier to understand and extend. Makes the code much easier to understand, though further simplifications are possible. This patch tries to minimize the noise when viewed with 'git diff -w'. Gives these commands improved built-in help and usage information.
* remove redundant 'rm' command handlerZachary T Welch2009-11-281-27/+0
| | | | | | Two 'rm' commands were implemented and registered. This removes the version that would have never been called prior to refactoring the command registration.
* add error checking in command_newZachary T Welch2009-11-281-20/+30
| | | | | | Adds checks for memory allocation failures. Started to use calloc() instead of malloc()/memset(), but I got carried away. This kind of work should be done throughout the tree, but it's almost hopeless at present.
* include mode information in help text.Zachary T Welch2009-11-281-3/+27
| | | | | Extends the help output to list the valid modes for each commands. Fixes a memory leak of the returned command_name() string.
* refactor command mode detectionZachary T Welch2009-11-281-2/+7
| | | | | | | | | | | Splits the check for a command's ability to run into a helper. This also fixes a bug whereby commands that specified COMMAND_EXEC were allowed to run during the configuration stage. This allowed problematic commands to be called before 'init', defeating the intention of specifying that command mode. With this change, the run_command() helper denies access to handlers that should run only after 'init' during the configuration stage.
* add command private data setter/accessorZachary T Welch2009-11-282-0/+31
| | | | | | | | | | Presently, commands registration taks a static handler data pointer. This patch adds support for commands that require a dynamic pointer, such as those registered in a dynamic context (e.g. subcommands for a user-created 'foo.cpu' command). The command_set_handler_data will update a command (group) to use a new context pointer, while the CMD_DATA macro allows command handlers to access the value. Jim handlers should find this value in interp->cmdPrivData.
* add 'command mode' introspective handlerZachary T Welch2009-11-281-0/+39
| | | | | Allows scripts to behave different depending on the current mode. Also allows introspection of the mode required for commands.
* remove unknown handlerZachary T Welch2009-11-282-36/+38
| | | | | | | | | | | | | | Updates command registration to provide top-level handlers for all commands, rather than falling back onto the 'unknown' command. Instead, that same handler is registered for placeholders, providing the same functionality under the root verb command name instead. This permits users to implement their own 'unknown' function, and it resolves some mind-bending breakage related to function object lookup while recursing. Changes 'ocd_bounce' to call 'ocd_command' and 'ocd_help' from the wrapper directly, rather than bouncing through their wrappers. This prevents endless recursion caused by the above changes, whereby the 'command' wrapper's type check would blow the stack to hell and gone.
* improve command handler wrapper scriptZachary T Welch2009-11-282-3/+26
| | | | | | | | | | 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.
* add 'command type' introspective handlerZachary T Welch2009-11-281-0/+43
| | | | | | | | 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).
* ARM11: fix warning on amd64David Brownell2009-11-281-1/+4
| | | | | | Previous version of JTAG_DEBUG() macro hid this bug. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM11: fix dbgtap JTAG_DEBUGDavid Brownell2009-11-281-2/+2
| | | | | | | 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>
* target: uplevel add_{break,watch}point() error checksDavid Brownell2009-11-286-38/+23
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* target: remove unused TARGET_EVENT_OLD_* symbolsDavid Brownell2009-11-281-2/+0
| | | | | | Just two *_OLD_* symbols left... Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* NEWS: mention new reset-assert eventDavid Brownell2009-11-271-0/+3
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* omap3530.cfg: use new "reset-assert" eventDavid Brownell2009-11-271-2/+2
| | | | | | Replaces previous "reset-assert-pre" workaround. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* Cortex-A8: support "reset-assert" eventDavid Brownell2009-11-271-5/+28
| | | | | | | | | | | | | | 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>
* target: groundwork for "reset-assert" eventDavid Brownell2009-11-273-7/+64
| | | | | | | | | 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>
* ARM11: write_memory() avoids increment checkDavid Brownell2009-11-271-9/+19
| | | | | | | | | | | | 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>
* fix regression causing duplicated outputZachary T Welch2009-11-271-13/+28
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* zy1000: keep up with new command registration stuffØyvind Harboe2009-11-271-42/+46
| | | | | | jim and classic style commands are both supported. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* update minidummy interface driver command handlingZachary T Welch2009-11-271-1/+1
| | | | | Changes the interface definition field reference from register_commands to commands, which allows the module to compile.
* fix 'nand info' commandZachary T Welch2009-11-271-5/+5
| | | | | | 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.
* zy1000: keep up with changes to log_init()Øyvind Harboe2009-11-271-7/+1
| | | | | | fn's and return value for log_init() changed to void. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* minidummy: fix compilation errorØyvind Harboe2009-11-271-2/+2
| | | | | | during refactoring a search and replace error crept in Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* ARM NAND I/O header documentation update.Dean Glazeski2009-11-261-6/+10
| | | | | | | 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>