summaryrefslogtreecommitdiff
path: root/src/jtag/tcl.c
Commit message (Collapse)AuthorAgeFilesLines
* jtag: add wait_srst_deassert commandØyvind Harboe2011-02-251-0/+51
| | | | | | Useful to do something *real quick* after a SRST deassert. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* nit: more LOG_* \n fixesEric Wetzel2011-01-091-1/+1
| | | | | | | | | Remove extra \n from LOG_DEBUG, LOG_INFO, and LOG_WARNING messages Remove LOG_INFO_N LOG_INFO_N was only used once and had a \n at the end Change LOG_USER_N calls that end with \n to LOG_USER
* initial SWD transport (SWD infrastructure #2)David Brownell2010-12-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This piggy backs on JTAG so it's not yet pretty, but that seems unavoidable so far given today's OpenOCD internals. SWD init and data transfer are unfinished and untested, but that should cause no regressions, and will be addressed by the time drivers start using this infrastructure. Checking in whould get the code working better sooner, and turn up any structural/architectural issues while they're easier to fix. The debug adapter drivers will provide simple SWD driver structs with methods that kick in as needed (instead of JTAG). So far just one adapter driver has been updated (not yet ready to use or circulate). The biggest issues are probably - fault handling, where the ARM Debug Interface V5 pipelining needs work in both JTAG and SWD modes and - missing rewrite of block I/O code to work on both of our Cortex-ready transports (Current code is hard-wired to JTAG); relates also to the pipelining issue. - omitted support to activate/deactivate SWO/SWV trace (this is technically trivial, but configuring what to trace is NOT. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> ---- doc/openocd.texi | 17 ++ src/jtag/core.c | 3 src/jtag/interface.h | 4 src/jtag/jtag.h | 2 src/jtag/swd.h | 114 +++++++++++++++++++ src/jtag/tcl.c | 2 src/target/adi_v5_swd.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++-- src/target/arm_adi_v5.c | 8 + src/target/arm_adi_v5.h | 3 9 files changed, 425 insertions(+), 9 deletions(-)
* jim tests: use installedØyvind Harboe2010-10-291-14/+19
| | | | Delete obsolete jim that comes with OpenOCD.
* jtag: fix handling of 'tap enable' errorThomas Koeller2010-08-121-2/+2
| | | | | | | | if a tap could not be _enabled_, the error message was 'failed to disable tap'. Fixed that. Also, display the failing tap's name. Signed-off-by: Thomas Koeller <thomas.koeller@baslerweb.com>
* jtag: add jtag_flush_queue_sleep debug commandØyvind Harboe2010-08-021-0/+24
| | | | | | | | it can be useful to throttle performance: test differences in behavior, test performance effect of long roundtrips. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* command context: fix errors when running certain commands on startupØyvind Harboe2010-05-051-2/+2
| | | | | | | | | | | Various commands, e.g. "arm mcr xxxx" would fail if invoked upon startup since it there was no command context defined for the jim interpreter in that case. A Jim interpreter is now associated with a command context(telnet, gdb server's) or the default global command context. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* buildfixDavid Brownell2010-04-031-1/+2
| | | | | | | | | | Without this, a system using gcc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu4) aborts builds after reporting: tcl.c: In function ‘handle_irscan_command’: tcl.c:1168: warning: passing argument 1 of ‘buf_set_u32’ discards qualifiers from pointer target type Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag/tcl.c cleanup -- split out "adapter.c"David Brownell2010-03-271-429/+5
| | | | | | | | | | | | Clean up the jtag/tcl.c file, which was one of the biggest and messiest ones in that directory. Do it by splitting out all the generic adapter commands to a separate "adapter.c" file (leaving the "tcl.c" file holding only JTAG utilities). Also rename the little-used "jtag interface" to "adapter_name", which should have been at least re-categorized earlier (it's not jtag-only). Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag: make out_value constØyvind Harboe2010-03-211-8/+9
| | | | | | Tightens up the jtag_add_xxx_scan() API Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* move "reset_config" out of JTAG command groupDavid Brownell2010-03-151-11/+11
| | | | | | | | | | | | The SRST configuration options are not specific to JTAG, so this command may be needed with non-JTAG debug sessions. Just move the command to a different group. (The TRST options are, however, clearly JTAG-specific, but for compatibility, they're now left alone. The flags they control could later be disabled in non-JTAG sessions.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* rename jtag_nsrst_assert_width as adapter_nsrst_assert_widthDavid Brownell2010-03-151-10/+10
| | | | | | | | | | | Globally rename "jtag_nsrst_assert_width" as "adapter_nsrst_assert_width", and move it out of the "jtag" command group ... it needs to be used with non-JTAG transports Includes a migration aid (in jtag/startup.tcl) so that old user scripts won't break. That aid should Sunset in about a year. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* rename jtag_nsrst_delay as adapter_nsrst_delayDavid Brownell2010-03-151-9/+9
| | | | | | | | | | | Globally rename "jtag_nsrst_delay" as "adapter_nsrst_delay", and move it out of the "jtag" command group ... it needs to be used with non-JTAG transports Includes a migration aid (in jtag/startup.tcl) so that old user scripts won't break. That aid should Sunset in about a year. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* rename jtag_khz as adapter_khzDavid Brownell2010-03-151-10/+11
| | | | | | | | | | | Globally rename "jtag_khz" as "adapter_khz", and move it out of the "jtag" command group ... it needs to be used with non-JTAG transports Includes a migration aid (in jtag/startup.tcl) so that old user scripts won't break. That aid should Sunset in about a year. (We may want to update it to include a nag message too.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* rename jtag_interface_{init,quit}()David Brownell2010-03-141-1/+1
| | | | | | | These routines apply to non-JTAG debug adapters too. To reduce confusion, give them better (non-misleading) names. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* split "interface" commands from "jtag" onesDavid Brownell2010-03-111-5/+21
| | | | | | | | | | | | | | | | | | | | | | | | | We'll need to be able to work with debug adapter interfaces (drivers) even when they're not used for JTAG ... for example, while there are multi-transport drivers which support JTAG *and* several other transports (or just one more, like SWD) there are also adapters with more limited goals (and no JTAG support at all). Start decoupling the two concepts ("debug adapter driver", "jtag") by having two command groups, which initialize separately. This will help us support OpenOCD sessions using only non-JTAG transports, in which JTAG commands should not be registered. Update docs to mention that the JTAG, SVF, and XSVF commands won't work without a JTAG transport. Note that at least commands working with SRST are still inappropriately coupled to JTAG ... inappropriate because (a) SRST is not part of the JTAG standard, for all that many platforms (like ARM) expect it; and also (b) because they're used with non-JTAG debug and programming interfaces, too. They should perhaps become generic "interface" operations at some point. (Similarly with the clock rate to be used by a given adapter.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag: jtag_add_ir_scan() now takes a single fieldØyvind Harboe2010-03-081-1/+10
| | | | | | | | In the code a single field was all that was ever used. Makes jtag_add_ir_scan() simpler and leaves more complicated stuff to jtag_add_plain_ir_scan(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: retire tap fieldØyvind Harboe2010-03-081-5/+3
| | | | | | | | | | | | | | | | | jtag_add_dr/ir_scan() now takes the tap as the first argument, rather than for each of the fields passed in. The code never exercised the path where there was more than one tap being scanned, who knows if it even worked. This simplifies the implementation and reduces clutter in the calling code. use jtag_add_ir/dr_plain_scan() for more fancy situations. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* commands: allow scan_chain command to be executed during configØyvind Harboe2010-01-181-1/+1
| | | | | | | Adding taps and then dumping them is quite reasonable thing to do in a config script. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: return JIM_OK instead of ERROR_OKØyvind Harboe2010-01-111-1/+1
| | | | | | | No change in actual binary as JIM_OK == ERROR_OK, but JIM_OK is correct here. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag/tcl help/usage fixupsDavid Brownell2010-01-091-74/+115
| | | | | | | | | | The usual: expand several helptexts to be more correct and to use full sentences; make the usage messages use the same EBNF as the User's Guide; use function names for their addresses. Also add a comment about that odd jtag_command_handlers_to_move[] thing. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* JTAG: shrink "scan_chain" outputDavid Brownell2009-12-161-8/+8
| | | | | | | | | | Tweak the "scan_chain" output by removing column separators. Also remove the "current instruction" state ... which changes constantly. Now its style resembles the "targets" output, and can even fit on one line in standard terminals and in the PDF docs. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag: add '-ignore-version' optionDavid Brownell2009-12-141-4/+24
| | | | | | | | | | Add a "-ignore-version" to "jtag newtap" which makes the IDCODE comparison logic optionally ignore version differences. Update the "scan_chain" command to illustrate this by showing the "*" character instead of the (ignored) version nibble. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* separate Jim from jtag/core.cZachary T Welch2009-12-041-0/+11
| | | | | | After previous efforts, only one Jim routine remained in jtag/core.c, and moving it to jtag/tcl.c painlessly finishes separating these layers. The headers need separating, but the implementation is clean.
* allow 'jtag init' to be run in any modeZachary T Welch2009-12-041-1/+1
| | | | Help alleviate further potential problems with interactive startup.
* jtag: factor init into 'jtag init'Zachary T Welch2009-12-021-0/+23
| | | | | Adds 'jtag init' command handler, which can be called as part of a fine-grained 'init' process.
* jtag: avoid using interp global variableZachary T Welch2009-11-301-3/+5
| | | | | Adds 'interp' field to jtag_tap_event_action structure to avoid using the global variable of same name.
* 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.
* use ARRAY_SIZE macroZachary T Welch2009-11-251-1/+1
| | | | | Search and destroy lingering cases where the ARRAY_SIZE macro should be used to convey more intrinsic meaning in the OpenOCD code.
* add jim_handler to command_registrationZachary T Welch2009-11-241-16/+27
| | | | | | Adding jim_handler field to command_registration allows removing the register_jim helper. All command registrations now go through the register_command{,s}() functions.
* remove register_callbacks from jtag interfaceZachary T Welch2009-11-241-2/+3
| | | | | | | | Changes the jtag_interface->register_callbacks field to a list of commands to be registered. Changes callback to invocation of register_commands() with that command registration list. Removes all JTAG interface driver register_command callback functions, which the previous commits had converted into identical calls.
* jtag: use register_commands()Zachary T Welch2009-11-241-67/+119
| | | | Use register commands with command registration array.
* use COMMAND_REGISTER macroZachary T Welch2009-11-241-16/+16
| | | | | Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
* allow jtag interfaces to lack commandsZachary T Welch2009-11-211-2/+5
| | | | | Allow JTAG interface drivers to skip registering an register_commands callback when it will just be empty.
* use COMMAND_PARSE_ENABLE macro where appropriateZachary T Welch2009-11-181-12/+6
| | | | | | | | Updates all command parsing of simple "enable" and "disable" arguments. A few case in the tree use a tri-state or extended arguments, which cannot use this simple macro. Simlifies the xscale icache/dcache command handler logic.
* command_handler: change 'cmd_ctx' to CMD_CTXZachary T Welch2009-11-171-21/+21
| | | | Convert all command handler 'cmd_ctx' parameter usage with CMD_CTX.
* command_handler: change 'args' to CMD_ARGVZachary T Welch2009-11-171-47/+47
| | | | | This patch converts all instances of 'args' in COMMAND_HANDLER routines to use CMD_ARGV macro.
* command_handler: change to 'argc' to CMD_ARGCZachary T Welch2009-11-171-30/+30
| | | | | This patch converts all instances of 'argc' in COMMAND_HANDLER routines to use CMD_ARGC.
* rename CEIL as DIV_ROUND_UPZachary T Welch2009-11-161-2/+2
| | | | | Improves the name of this macro, moves it to types.h, and adds a block of Doxygen comments to describe what it does.
* command_context_t -> struct command_contextZachary T Welch2009-11-131-2/+2
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* use struct jtag_tap_event_actionZachary T Welch2009-11-131-2/+2
| | | | Remove useless typedef and redundant suffix from jtag_tap_event_action.
* jtag_interface_t -> struct jtag_interfaceZachary T Welch2009-11-131-1/+1
| | | | Remove useless typedef and redundant suffix from struct jtag_interface.
* scan_field_t -> struct scan_fieldZachary T Welch2009-11-131-4/+4
| | | | Remove useless structure typedef.
* jtag_tap_t -> struct jtag_tapZachary T Welch2009-11-131-12/+12
| | | | | Search and destroy the jtag_tap_t typedef. This also cleans up a layering violation, removing the declaration from types.h.
* add CMD_NAME macro for command handlersZachary T Welch2009-11-131-1/+1
| | | | | By introducing the CMD_NAME macro, this parameter may be integrated as args[-1] in command.[ch], without touching any other call sites.
* use CALL_COMMAND_HANDLER instead of direct callsZachary T Welch2009-11-131-1/+1
| | | | | | By using CALL_COMMAND_HANDLER, parameters can be reordered, added, or even removed in inherited signatures, without requiring revisiting all of the various call sites.