summaryrefslogtreecommitdiff
path: root/src/target/target.c
Commit message (Collapse)AuthorAgeFilesLines
* target: -Wshdaow warning fixØyvind Harboe2010-06-151-5/+5
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: fix retval gaffe in mwX commandsØyvind Harboe2010-06-141-1/+1
| | | | | | | | | | | failure to write to memory was not propagated. This is an interesting case of broken error handling: with exceptions we wouldn't have had this at all, and I also wonder if there is a GCC option to warn about these kinds of potential bugs. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* verify: display up to 128 diff'sØyvind Harboe2010-06-081-11/+19
| | | | | | Showing up to 128 differences. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* Change kb/s to KiB/s in messages about kibibytesJon Povey2010-05-161-4/+4
| | | | | | | Change download rate messages about kibibytes from "kb/s" to "KiB/s" units. See: http://en.wikipedia.org/wiki/Data_rate_units Signed-off-by: Jon Povey <jon.povey@racelogic.co.uk>
* flash: stop caching protection stateØyvind Harboe2010-05-051-13/+0
| | | | | | | | | | | | | | There are a million reasons why cached protection state might be stale: power cycling of target, reset, code executing on the target, etc. The "flash protect_check" command is now gone. This is *always* executed when running a "flash info". As a bonus for more a more robust approach, lots of code could be deleted. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* command context: fix errors when running certain commands on startupØyvind Harboe2010-05-051-14/+15
| | | | | | | | | | | 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>
* target: clean up target memory allocation error messagesØyvind Harboe2010-05-041-3/+14
| | | | | | | | | | target memory allocation can be implemented not to show bogus error messages. E.g. when trying a big allocation first and then a smaller one if that fails. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* TARGET: review unused symbolsAntonio Borneo2010-04-101-16/+0
| | | | | | | Remove unused functions: - target_all_handle_event Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* TARGET: review scope of functionsAntonio Borneo2010-04-101-14/+15
| | | | | | | Add "static" qualifier to private functions. Remove unused "extern" in src/ecosboard.c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* Restore deleted '!' characterDavid Brownell2010-04-041-1/+1
| | | | | | | | I'm not sure what caused this significant character to get deleted. it may be related to intermittent Editor or terminal flakes I've been seeing lately (sigh). This fix is trivial. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: are we running algorithm code?David Brownell2010-04-041-1/+8
| | | | | | | | | | | | | | | | | | | | | | Fixing one bug can easily uncover another .... in this case, making sure that we properly invalidate some cached NOR state when resuming arbitrary target code turned up an issue when the code wasn't quite arbitrary (and we couldn't know that, but some parts of OpenOCD assumed the cache would not be invalidated. Specifically: some flash drivers (like CFI) update that state in loops with downloaded algorithms, thus invalidating the state as it's probed. + Add a new target state flag, to record whether the target is running downloaded algorithm code. + Use that flag to add a special case: "trust" downloaded algorithms not to corrupt that cached state, bypassing cache invalidation. Also update some of the documentation to stipulate that this flavor of trustworthiness is now *required* ... not just a fortuitous acident. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* simplify and unconfuse target_run_algorithm()David Brownell2010-04-041-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason there are *two* schemes for interposing logic into the run_algorithm() code path... One is a standard procedural wapper around the target method invocation. the other (superfluous) one hacked the method table by splicing a second procedural wrapper into the method table. Remove it: * Rename its slightly-more-featureful wrapper so it becomes the standard procedural wrapper, leaving its added logic (where it should have been in the first place. Also add a paranoia check, to report targets that don't support algorithms without traversing a NULL pointer, and tweak its code structure a bit so it's easier to modify. * Get rid of the superfluous/conusing method table hacks. This is a net simplification, making it simpler to analyse what's going on, and then interpose logic . ... by ensuring there's only one natural place for it to live. ------------ Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: fix poll offØyvind Harboe2010-03-251-0/+6
| | | | | | | | | | | I don't know when "poll off" broke, but "poll off" didn't stop background polling of target. The polling status flag simply wasn't checked in the handle_target timer callback. All target polling(including power/reset state) is now stopped upon "poll off". Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* gdb: long running "monitor mww" now works w/gdbØyvind Harboe2010-03-171-0/+2
| | | | | | | invoke keep_alive() to make sure that the default 2000ms timeout does not trigger. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: faster mww operationsØyvind Harboe2010-03-171-38/+77
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: mdX/mwX on target were badly brokenØyvind Harboe2010-03-171-7/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - incorrect parsing of arguments - mdX didn't display arguments correctly I don't think anyone ever used that code path :-) Did you know that "target mdw" and mdw are very different? for {set i 0} {$i < 256} {set i [expr $i+1]} {mwb [expr 0x2000000+$i] $i} mdw 0x2000000 0x10 0x02000000: 03020100 07060504 0b0a0908 0f0e0d0c 13121110 17161514 1b1a1918 1f1e1d1c 0x02000020: 23222120 27262524 2b2a2928 2f2e2d2c 33323130 37363534 3b3a3938 3f3e3d3c > zy1000.cpu mdb 0x2000000 0x20 0x02000000 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f ................ 0x02000010 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f ................ > zy1000.cpu mdh 0x2000000 0x20 0x02000000 0100 0302 0504 0706 0908 0b0a 0d0c 0f0e ................ 0x02000010 1110 1312 1514 1716 1918 1b1a 1d1c 1f1e ................ 0x02000020 2120 2322 2524 2726 2928 2b2a 2d2c 2f2e !"#$%&'()*+,-./ 0x02000030 3130 3332 3534 3736 3938 3b3a 3d3c 3f3e 0123456789:;<=>? > zy1000.cpu mdw 0x2000000 0x20 0x02000000 03020100 07060504 0b0a0908 0f0e0d0c ................ 0x02000010 13121110 17161514 1b1a1918 1f1e1d1c ................ 0x02000020 23222120 27262524 2b2a2928 2f2e2d2c !"#$%&'()*+,-./ 0x02000030 33323130 37363534 3b3a3938 3f3e3d3c 0123456789:;<=>? 0x02000040 43424140 47464544 4b4a4948 4f4e4d4c @ABCDEFGHIJKLMNO 0x02000050 53525150 57565554 5b5a5958 5f5e5d5c PQRSTUVWXYZ[\]^_ 0x02000060 63626160 67666564 6b6a6968 6f6e6d6c `abcdefghijklmno 0x02000070 73727170 77767574 7b7a7978 7f7e7d7c pqrstuvwxyz{|}~. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* NOR: invalidate cached state on target resumeDavid Brownell2010-03-031-0/+9
| | | | | | | | | | | | | | | | | | | | The NOR infrastructure caches some per-sector state, but it's not used much ... because the cache is not trustworthy. This patch addresses one part of that problem, by ensuring that state cached by NOR drivers gets invalidated once we resume the target -- since targets may then modify sectors. Now if we see sector protection or erase status marked as anything other than "unknown", we should be able to rely on that as being accurate. (That is ... if we assume the drivers initialize and update this state correctly.) Another part of that problem is that the cached state isn't much used (being unreliable, it would have been unsafe). Those issues can be addressed in later patches. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target_resume() doxygenDavid Brownell2010-03-021-3/+33
| | | | | | | | | | | Add doxygen for target_resume() ... referencing the still-unresolved confusion about what the "debug_execution" parameter means (not all CPU support code acts the same). The 'handle_breakpoints" param seems to have resolved the main issue with its semantics, but it wasn't part of the function spec before. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gdb: restore behavior from 0.3.1 for srst_asserted and power_restoreØyvind Harboe2010-02-011-13/+23
| | | | | | | | srst_asserted and power_restore can now be overriden to do nothing. By default they will "reset init" the targets and halt gdb. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: print reason why GDB haltsØyvind Harboe2010-01-211-0/+10
| | | | | | | | | | | If GDB halts unexpectedly, print reason: srst assert or power out detected. If polling fails, then things are a bit trickier. We do not want to spam telnet or the log with polling failed messages. Leave that case be w/a comment in a code for now. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* target: Fixed format problem for mdhEdgar Grimberg2010-01-211-1/+1
| | | | | | Fixed format problem for mdh. It needs to display 4 chars. Signed-off-by: Edgar Grimberg <edgar.grimberg@zylin.com>
* target: add check_reset hookØyvind Harboe2010-01-131-0/+36
| | | | | | | Allow targets to run checks post reset. Used to check that e.g. DCC downloads have been enabled. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* *SVF: help/usage updatesDavid Brownell2010-01-081-1/+1
| | | | | | | | | | | | Usage messages should use the same EBNF as the User's Guide; no angle brackets. Be more complete too ... some params were missing. Don't use "&function"; its name is its address. Unrelated: fix typo in one "target.c" usage message. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target misc: help/usage updatesDavid Brownell2010-01-071-122/+155
| | | | | | | | | | | | Provide helptext which was sometimes missing; update some of it to be more accurate. Usage syntax messages have the same EBNF as the User's Guide. Don't use "&function"; functions are like arrays, their address is their name. Shrink some overlong lines; remove some empties. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* streamline and document helptext mode displaysDavid Brownell2010-01-021-1/+1
| | | | | | | | | | | | | | | | | | | Most commands are usable only at runtime; so don't bother saying that, it's noise. Moreover, tokens like EXEC are cryptic. Be more clear: highlight only the commands which may (also) be used during the config stage, thus matching the docs more closely. There are - Configuration commands (per documentation) - And also some commands that valid at *any* time. Update the docs to note that "help" now shows this mode info. This also highlighted a few mistakes in command configuration, mostly commands listed as "valid at any time" which shouldn't have been. This just fixes ones I noted when sanity testing. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* ARM7_9: Fix segfaultsAntonio Borneo2009-12-301-0/+5
| | | | | | | | | | | Handlers for commands - arm7_9 semihosting <enable | disable> - $_TARGETNAME arp_reset assert 1 didn't check if target has already been examined, and could segfault when using the NULL pointer "arm7_9->eice_cache". Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* MinGW build fixesFreddie Chopin2009-12-281-1/+1
| | | | | | | | Print "ssize_t" as "%ld" (+ cast to long) not as "%zu". Official MinGW (gcc 3.4.5) doesn't understand "z" flag. Signed-off-by: Freddie Chopin <freddie_chopin@op.pl> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: add basic dsp563xx supportmkdorg@users.sourceforge.net2009-12-151-0/+2
|
* target: further shrink Jim-awarenessDavid Brownell2009-12-131-2/+3
| | | | | | | | | | | | | Don't include <helper/jim.h> from target.h ... not everything which touches targets needs to be able to talk to Jim. Plus, most files include this header by another path. Also, switch the affected files to use the classic sequence for #included files: all <framework/headers.h> first, then the "local_headers.h". This helps prevent growth of problematic layering, by minimizing entanglement. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: remove more exit() callsDavid Brownell2009-12-081-1/+2
| | | | | | | | These were all basically "can't happen" cases ... like having state be corrupted by an alpha particle after the previous check for whether a value was in-range. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: remove needless "extern"sDavid Brownell2009-12-081-5/+5
| | | | | | | | | | Most of these happened to be in the target.h file. Some of those are associated with symbols that could be removed at some point ... e.g. NVP_ASSERT/true and its sibling NVP_DEASSERT/false. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* target: add debug_reason_name()David Brownell2009-12-071-1/+14
| | | | | | | | Provide and use debug_reason_name() instead of expecting targets to call Jim_Nvp_value2name_simple(). Less dependency on Jim, and the code becomes more clear too. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* change #include "jtag.h" to <jtag/jtag.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "jtag.h" the following form should be used. #include <jtag/jtag.h> The exception is from .c files in the same directory.
* change #include "time_support.h" to <helper/time_support.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "time_support.h" the following form should be used. #include <helper/time_support.h> The exception is from .c files in the same directory.
* fix 'target init' command registrationZachary T Welch2009-12-021-6/+6
| | | | | The command handler registration was put at the top level, rather than as a subcommand. Move it to where it belongs.
* target: factor init to 'target init'Zachary T Welch2009-12-021-0/+23
| | | | Adds 'target init' command handler, called as part of 'init'.
* target: factor target_init() into piecesZachary T Welch2009-12-021-69/+84
| | | | | Moves body of target initialization loop into a helper function, cleaning up its visual flow in the process.
* target: "mcr" and "mrc" are ARM-specificDavid Brownell2009-12-011-199/+0
| | | | | | | | | | | | | | Switch "mrc" and "mcr" commands to be toplevel ARM operations, as they should initially have been. Correct the usage message for both commands: it matches ARM documentation (as one wants!) instead of reordering them to match the funky mrc() and mcr() method usage (sigh). For Cortex-A8: restore a line that got accidentally dropped, so the secure monitor mode shadow registers will show again. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* do not extern 'interp' from command.cZachary T Welch2009-11-301-4/+7
| | | | | Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
* target: avoid using interp global variableZachary T Welch2009-11-301-9/+10
| | | | | Adds 'interp' to target_event_action structure to avoid using the global variable of the same name.
* 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.
* target: uplevel add_{break,watch}point() error checksDavid Brownell2009-11-281-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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: groundwork for "reset-assert" eventDavid Brownell2009-11-271-2/+17
| | | | | | | | | 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>
* target: create and use target_name()David Brownell2009-11-251-16/+19
| | | | | | | | | | | | | 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>
* target: target_get_name() --> target_type_name()David Brownell2009-11-251-7/+11
| | | | | | | | | | | | | 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>
* add 'testee' target typeZachary T Welch2009-11-251-0/+2
| | | | | | | 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.
* add jim_handler to command_registrationZachary T Welch2009-11-241-23/+45
| | | | | | 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 target_type register_command callbackZachary T Welch2009-11-241-5/+7
| | | | | | Uses chaining of command_registration structures to eliminate all target_type register_callback routines. Exports the command_handler registration arrays for those target types that are used by others.
* target: use register_commands()Zachary T Welch2009-11-241-104/+201
|