summaryrefslogtreecommitdiff
path: root/src/jtag/core.c
Commit message (Collapse)AuthorAgeFilesLines
* TRANSPORT: Supported transport names lists are now declared by ↵Tomek CEDRO2011-06-251-1/+1
| | | | src/transport.h and defined by src/transport.c. Multiple definitions of 'jtag_only' were removed and code was updated to use 'oocd_transport_jtag_only' (also updated headers if necessary) as defined by src/transport.
* transport: move files over to transport folderØyvind Harboe2011-06-131-1/+1
| | | | | | as we introduce swd and jtag as two transports, we want to start up with a new transport folder to organize the code a bit.
* Silence -O3 warningØyvind Harboe2011-06-071-1/+1
|
* adapter speed: require init script setting and centralize activation from ↵Jonas Hörberg2011-05-011-4/+11
| | | | | | drivers to core.c Signed-off-by: Jonas Hörberg <jhorberg@sauer-danfoss.com>
* jtag: clarify jtag->init() and jtag->quit() definitionsØyvind Harboe2011-04-191-6/+7
| | | | | | | | | only set jtag global pointer if jtag->init() succeeds. Less code, more clear what the rules are. Fix nit that error value from init() was not propagated unmodified. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: clean up jtag_sleep, handle short sleeps correctly via usleepØyvind Harboe2011-03-151-1/+8
| | | | | | | | | | | short sleeps are handled via usleep, longer sleeps we round up to nearest ms. There was a bug in jtag_sleep() in that it would round *down* to nearest ms, thus making all <1ms sleeps 0. Found by inspection rather than symptom. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* str9xpec: Find flash controller from the chain.Santeri Salko2011-01-141-1/+1
| | | | | | | | | | | Find the flash controller by position since it is before the core, not after it. This fixes the problem that str9xpec enable_turbo (or any other str9xpec command) did not work. (See my post in http://forum.sparkfun.com/viewtopic.php?f=18&t=25542) Signed-off-by: Santeri Salko <santeri.salko@gmail.com>
* error handling: the error number is not part of the user interfaceØyvind Harboe2011-01-031-1/+1
| | | | | | | | Do not propagate error number to user. This is for internal programming purposes only. Error messages to the user is reported as text via LOG_ERROR(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* initial SWD transport (SWD infrastructure #2)David Brownell2010-12-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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(-)
* Fix for segmentation fault from freed memory access in ↵Paul Richards2010-12-101-13/+9
| | | | jtag_unregister_event_callback()
* jtag: getting the JTAG speed can failØyvind Harboe2010-12-081-10/+17
| | | | | | | | | | | If the JTAG speed has not been set, then it has no defined value, add code to propagate the error. No change to actual behavior as no new failure paths have been introduced. This is a no-op patch to make subsequent patches smaller. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* Remove duplicated initializationAlexander Stein2010-09-081-1/+0
| | | | | | | | | | | I a mail conversation with Øyvind we stated that speed may not be set at all on case CLOCK_MODE_KHZ and CLOCK_MODE_RCLK. Also there isn't proper error propagation adapter_khz_to_speed or jtag_rclk_to_speed. So jtag_get_speed may need some rewrite for error propagation. CC: Øyvind Harboe <oyvind.harboe@zylin.com> Signed-off-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* warning: fix silly -O3 warningØyvind Harboe2010-09-071-1/+1
| | | | | | | Some versions of GCC don't pick up that local variables are set in all code paths. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: fix regression with dummy driver and when starting OpenOCD with target ↵Øyvind Harboe2010-09-031-5/+13
| | | | | | | | | | | | | | | | powered down Do not fail startup if communication with target is not possible. OpenOCD supports launching without a target connected or the target powered down. The user will typically power up the target and issue a "reset init" + load his application after OpenOCD is started then. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: add jtag_flush_queue_sleep debug commandØyvind Harboe2010-08-021-0/+17
| | | | | | | | 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>
* jtag: fix shadow issues in adapter_initSpencer Oliver2010-07-121-1/+0
| | | | | | Use global jtag_only rather than local static. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* transport: fix bug/typo in transport_register cmdSpencer Oliver2010-07-091-3/+1
| | | | Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* initial "transport" frameworkDavid Brownell2010-07-021-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the guts of a transport framework with initialization, which should work with current JTAG-only configurations (tested with FT2232). Each debug adapter can declare the transports it supports, and exactly one transport is initialized. (with its commands) in any given OpenOCD session. * Define a new "struct transport with init hooks and a few "transport" subcommands to support it: "list" ... list the transports configured (just "jtag" for now) "select" ... makes the debug session use that transport "init" ... initializes the selected transport (internal) * "interface_transports" ... declares transports the current interface can support. (Some will do this from C code instead, when there are no hardware versioning (or other) issues to prevent it. Plus some FT2232 tweaks, including a few to streamline upcoming support for an SWD transport (initially for Luminary adapters). Eventually src/jtag should probably become src/transport, moving jtag-specific stuff to transport/jtag. Signed-off-by: David Brownell <db@helium.(none)>
* jtag: retire jtag_get_error()Øyvind Harboe2010-06-211-7/+4
| | | | | | | This fn is an implementation detail of jtag_execute_queue() that is not to be exposed externally. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: retire jtag_get/set_end_state()Øyvind Harboe2010-03-191-20/+0
| | | | | | | Voila! This get rids of mysteries about what what state the TAP is in. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: cut down on usage of unintended modification of global end stateØyvind Harboe2010-03-181-2/+3
| | | | | | | | | | | | | jtag_get/set_end_state() is now deprecated. There were lots of places in the code where the end state was unintentionally modified. The big Q is whether there were any places where the intention was to modify the end state. 0.5 is a long way off, so we'll get a fair amount of testing. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* rename jtag_nsrst_assert_width as adapter_nsrst_assert_widthDavid Brownell2010-03-151-5/+5
| | | | | | | | | | | 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-5/+5
| | | | | | | | | | | 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-5/+5
| | | | | | | | | | | 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-6/+12
| | | | | | | 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>
* jtag: simplify jtag_add_plain_ir/dr_scanØyvind Harboe2010-03-081-6/+8
| | | | | | | These fn's now clearly just clock out/in bits. No mystical fields are involved. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* jtag: jtag_add_ir_scan() now takes a single fieldØyvind Harboe2010-03-081-14/+17
| | | | | | | | 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-17/+15
| | | | | | | | | | | | | | | | | 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>
* jtag: the post TAP state is now passed to the driversØyvind Harboe2010-03-011-1/+1
| | | | | | | | | | after clocking out a tms sequence, then the TAP will be in some state. This state is now handed to the drivers. TAP_INVALID is a possible state after a TMS sequence if switching to SWD. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* interface: define TMS sequence commandDavid Brownell2010-02-271-0/+29
| | | | | | | | | | | | | | | | | | | | | | | For support of SWD we need to be able to clock out special bit sequences over TMS or SWDIO. Create this as a generic operation, not yet called by anything, which is split as usual into: - upper level abstraction ... here, jtag_add_tms_seq(); - midlayer implementation logic hooking that to the lowlevel code; - lowlevel minidriver operation ... here, interface_add_tms_seq(); - message type for request queue, here JTAG_TMS. This is done slightly differently than other operations: there's a flag saying whether the interface driver supports this request. (In fact a flag *word* so upper layers can learn about other capabilities too ... for example, supporting SWD operations.) That approach (flag) lets this method *eventually* be used to eliminate pathmove() and statemove() support from most adapter drivers, by moving all that logic into the mid-layer and increasing uniformity between the various drivers. (Which will in turn reduce subtle bugginess.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* JTAG: fix bug when no interface connectedSpencer Oliver2010-02-031-0/+7
| | | | | | - fix coredump when OpenOCD is started without a jtag interface connected. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* core arm11: Silence logs at level 3 if there is no activityEdgar Grimberg2010-01-251-4/+6
| | | | | | | | If the target and openocd are idling, the log should normally be silent at level 3. (Given no verbose logging options.) Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag: add '-ignore-version' optionDavid Brownell2009-12-141-2/+11
| | | | | | | | | | 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>
* minidriver: fix inline capability of minidriverØyvind Harboe2009-12-081-27/+0
| | | | | | | | | | | Low latency low CPU processing power systems(embedded) will benefit greatly from being able to inline certain jtag_add_xxx() fn's. The trick is that this has to be done in such a way as to allow implementing an OpenOCD API with a shared library(eventually) on a PC hosted OpenOCD. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* misc code review updatesDavid Brownell2009-12-051-2/+1
| | | | | | | | | More updates from the code review by Steve Grubb <sgrubb@redhat.com>. The Jim float-comparision bug just gets a comment not a fix, though. Cc: Steve Grubb <sgrubb@redhat.com>. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* separate Jim from jtag/core.cZachary T Welch2009-12-041-11/+0
| | | | | | 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.
* do not extern 'interp' from command.cZachary T Welch2009-11-301-1/+1
| | | | | Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
* JTAG: fix autoprobe failure.David Brownell2009-11-161-2/+10
| | | | | | | 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>
* JTAG: no LOG_WARNING() for taps without IDCODEDavid Brownell2009-11-161-1/+1
| | | | Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* move ARRAY_SIZE macro to types.hZachary T Welch2009-11-161-1/+1
| | | | | | | | 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).
* 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-4/+4
| | | | Remove misleading typedef and redundant suffix from struct command_context.
* jtag_event_callback_t -> struct jtag_event_callbackZachary T Welch2009-11-131-13/+19
| | | | | Remove useless typedef and redundant suffix from jtag_event_callback. Add documentation for the structure.
* jtag_interface_t -> struct jtag_interfaceZachary T Welch2009-11-131-2/+2
| | | | Remove useless typedef and redundant suffix from struct jtag_interface.
* scan_field_t -> struct scan_fieldZachary T Welch2009-11-131-15/+15
| | | | Remove useless structure typedef.
* jtag_tap_t -> struct jtag_tapZachary T Welch2009-11-131-21/+21
| | | | | Search and destroy the jtag_tap_t typedef. This also cleans up a layering violation, removing the declaration from types.h.
* finish removing deprecated/obsolete commandsDavid Brownell2009-11-091-7/+0
| | | | | | | | | | | | | | | | | | | | 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>
* JTAG: simple autoprobingDavid Brownell2009-10-261-12/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds basic autoprobing support for the JTAG scan chains which cooperate. To use, you can invoke OpenOCD with just: - interface spec: "-f interface/...cfg" - possibly with "-c 'reset_config ...'" for SRST/TRST - possibly with "-c 'jtag_khz ...'" for the JTAG clock Then set up config files matching the reported TAPs. It doesn't declare targets ... just TAPs. So facilities above the JTAG and SVF/XSVF levels won't be available without a real config; this is almost purely a way to generate diagnostics. Autoprobe was successful with most boards I tested, except ones incorporating C55x DSPs (which don't cooperate with this scheme for IR length autodetection). Here's what one multi-TAP chip reported, with the "Warn:" prefixes removed: clock speed 500 kHz There are no enabled taps. AUTO PROBING MIGHT NOT WORK!! AUTO auto0.tap - use "jtag newtap auto0 tap -expected-id 0x2b900f0f ..." AUTO auto1.tap - use "jtag newtap auto1 tap -expected-id 0x07926001 ..." AUTO auto2.tap - use "jtag newtap auto2 tap -expected-id 0x0b73b02f ..." AUTO auto0.tap - use "... -irlen 4" AUTO auto1.tap - use "... -irlen 4" AUTO auto2.tap - use "... -irlen 6" no gdb ports allocated as no target has been specified The patch tweaks IR setup a bit, so we can represent TAPs with undeclared IR length. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* JTAG: jtag_tap_init() bugfixesDavid Brownell2009-10-251-9/+18
| | | | | | | Stop allocating three bytes per IR bit, and cope somewhat better with IR lengths over 32 bits. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* jtag_add_statemove() always uses TLR to get to RESETDavid Brownell2009-10-191-5/+7
| | | | | | | As decided a while back, this isn't a transition we want to chance. Whenever someone wants to got to RESET, force it. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>