Commit Graph

504 Commits

Author SHA1 Message Date
Zachary T Welch
b1de5eb9a0 reg_param_t -> struct reg_param
Remove misleading typedef and redundant suffix from struct reg_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
6c965a3da9 mem_param_t -> struct mem_param
Remove misleading typedef and redundant suffix from struct mem_param.
2009-11-13 11:58:09 -08:00
Zachary T Welch
42ef503d37 jtag_tap_t -> struct jtag_tap
Search and destroy the jtag_tap_t typedef.  This also cleans up a
layering violation, removing the declaration from types.h.
2009-11-13 11:58:04 -08:00
Zachary T Welch
9f212b01be fileio_t -> struct fileio
Remove useless structure typedef.
2009-11-13 11:58:04 -08:00
Zachary T Welch
a585bdf726 add CMD_NAME macro for command handlers
By introducing the CMD_NAME macro, this parameter may be integrated
as args[-1] in command.[ch], without touching any other call sites.
2009-11-13 10:55:00 -08:00
Zachary T Welch
5b6df55a1e use CALL_COMMAND_HANDLER instead of direct calls
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.
2009-11-13 10:51:46 -08:00
Zachary T Welch
63a26b421b use COMMAND_HELPER for command helper functions
Define the numerous helpers that inherit command handler parameters
using the COMMAND_HELPER macro.
2009-11-13 10:51:45 -08:00
Zachary T Welch
cfc4d5c6b7 use COMMAND_HANDLER macro to define all commands 2009-11-13 10:51:45 -08:00
Zachary T Welch
ca594adb5a add const keyword to some APIs
Add 'const' keyword to 'char *' parameters to allow command handlers to
pass constant string arguments.  These changes allow the 'args' command
handler to be changed to 'const' in a subsequent patch.
2009-11-11 11:53:22 -08:00
David Brownell
61af6a6816 target: MMU-aware init for memory read/write
Start switching MMU handling over to a more sensible scheme.
Having an mmu() method enables MMU-aware behaviors.  Not having
one kicks in simpler ones, with no distinction between virtual
and physical addresses.

Currently only a handful of targets have methods to read/write
physical memory:  just arm720, arm920, and arm926.  They should
all initialize OK now, but the arm*20 parts don't do the "extra"
stuff arm926 does (which should arguably be target-generic).

Also simplify how target_init() loops over all targets by making
it be a normal "for" loop, instead of scattering its three parts
to the four winds.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 11:58:31 -08:00
David Brownell
2a4d3c03cd Target: minor cleanup
- improve some names -- a "default" prefix is not descriptive
 - add doxygen @todo entries for some issues
 - avr8 isn't ever going to need those MMU hooks

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 02:01:20 -08:00
David Brownell
0df56714a0 Target: fix bad error messages
And shrink a few too-long lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-10 01:33:59 -08:00
Zachary T Welch
ef6387a0c9 target.c: remove useless declarations
This patch removes the last batch of forward references from the tree,
moving the target command registration routines to the end of the file.
2009-11-09 19:24:06 -08:00
David Brownell
7269ba5eb6 Revert "target: add target->type->has_mmu fn"
This patch introduced a bug preventing flash writes from working
on Cortex-M3 targets like the STM32.  Moreover, it's the wrong
approach for handling no-MMU targets.

The right way to handle no-MMU targets is to provide accessors
for physical addresses, and use them everywhere; and any code
which tries to work with virtual-to-physical mappings should use
a identity mapping (which can be defaulted).

And ... we can tell if a target has an MMU by seeing if it's
got an mmu() method.  No such methood means no MMU.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-09 14:46:23 -08:00
David Brownell
d70d9634bf finish removing deprecated/obsolete commands
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>
2009-11-09 13:16:32 -08:00
Zachary T Welch
2689f58f2a Overhaul time support API
This patch changes the duration_* API in several ways.  First, it
updates the API to use better names.  Second, string formatting has
been removed from the API (with its associated malloc).  Finally, a
new function added to convert the time into seconds, which can be
used (or formatted) by the caller.  This eliminates hidden calls to
malloc that require associated calls to free().

This patch also removes the useless extern keyword from prototypes,
and it eliminates the duration_t typedef (use 'struct duration').
These API also allows proper error checking, as it is possible for
gettimeofday to fail in certain circumstances.

The consumers have all been chased to use this new API as well, as
there were relatively few cases doing this type of measurement.
In most cases, the code performs additional checks for errors, but
the calling code looks much cleaner in every case.
2009-11-09 01:21:50 -08:00
David Brownell
a9abfa7d06 target: don't swap MMU/no-MMU work areas
Resolve serious bug inserted by the "target: require working
area for physical/virtual addresses to be specified" patch.
It forced use of (invalid) virtual addresses when the MMU
was disabled, and vice versa.

Observed to break at least Cortex-M3, ARM926, ARM7TDMI whenever
work areas are used, such as during bulk writes to flash, DDR2,
SRAM, and so on.

Also, fix overlong lines and whitespace goofs.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-06 14:57:21 -08:00
Zachary T Welch
653ea7b25c Improve target.c command argument parsing.
Passes cmd_ctx into parse_load_image_command_args for reporting the
parsing errors therein.
2009-11-05 18:03:18 -08:00
Øyvind Harboe
051eaf7950 target: fix ordering of arguments to mcr and mrc commands
Now matches machine code syntax and old arm11 syntax.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:57:49 +01:00
Øyvind Harboe
4e3c2676f1 target: check args to mrc/mcr.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:57:49 +01:00
Øyvind Harboe
b64503e37f target: Only register mrc mcr commands when one of the targets support them.
This avoids polluting help for targets that can never support mrc/mcr

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 23:56:37 +01:00
David Brownell
98788d7a75 watchpoint_add() cleanup
Fail watchpoint_add() if it's the same address but the
parameters are different ... don't just assume having
the same address means the same watchpoint!  (Note that
overlapping watchpoints aren't detected...)

Handle unrecognized return codes more sanely; don't exit()!
And describe command params right.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-05 01:47:44 -08:00
Øyvind Harboe
d269122f91 target: add target->type->has_mmu fn.
improve default target->read/write_phys_memory, produce
more sensible error messages if the mmu interface
functions have not been implemented yet vs. will
not be implemented(e.g. cortex m3).

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-05 09:53:31 +01:00
Øyvind Harboe
972924b2ad Make default implementation of mdw/mmw phys return error 'not implemented' 2009-11-05 09:26:08 +01:00
Øyvind Harboe
b5ce7fe812 target: require working area for physical/virtual addresses to be specified
Fixed bug: if virtual address for working memory was not specified
and MMU was enabled, then address 0 would be used.

Require working address to be specified for both MMU enabled
and disabled case.

For some completely inexplicable reason this fixes the regression
in svn 2646 for flash write in arm926ejs target. The logs showed
that MMU was disabled in the case below:

https://lists.berlios.de/pipermail/openocd-development/2009-November/011882.html

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-03 11:56:05 +01:00
Øyvind Harboe
cb854323c9 Remove debug output that could cause compile warnings. 2009-10-23 13:09:16 +02:00
Øyvind Harboe
0a1356c9cc mcr/mrc interface work. Implemented for arm926ejs and arm720t. mcr/mrc commands added. 2009-10-23 12:39:00 +02:00
David Brownell
f593ff0a3d have "reg" command print cache names too
When dumping over 100 registers (as on most ARM9 + ETM cores),
aid readability by splitting them into logical groups.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-22 12:05:04 -07:00
Øyvind Harboe
2783cba810 Added target_read/write_phys_memory() fn's. mdX/mwX commands updated to support phys flag to specify bypassing of MMU. 2009-10-21 14:45:39 +02:00
Yauheni Kaliuta
bc0cc62afd Do not replace virt2phys with the default one if it was assigned
Signed-off-by: Yauheni Kaliuta <y.kaliuta@gmail.com>
2009-10-13 17:55:44 +02:00
Øyvind Harboe
86cbbe8a4a Propagate error from assert, deassert and halt on tcl target object. 2009-10-13 12:10:23 +02:00
Øyvind Harboe
c8d935ab7c If halt times out, stop GDB. Allows e.g. manual reset via monitor commands. 2009-10-12 09:27:27 +02:00
David Brownell
a8234af06c prevent abort via polling during jtag_reset
Observed:

  openocd: core.c:318: jtag_checks: Assertion `jtag_trst == 0' failed.

The issue was that nothing disabled background polling during calls
from the TCL shell to "jtag_reset 1 1".  Fix by moving the existing
poll-disable mechanism to the JTAG layer where it belongs, and then
augmenting it to always pay attention to TRST and SRST.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-10-08 11:14:00 -07:00
Øyvind Harboe
f525f2ef0d Stop GDB when polling fails, srst assert or powerdropout is detected 2009-10-08 14:53:25 +02:00
dbrownell
86a7d813a1 Remove annoying end-of-line whitespace from most src/*
files; omitted src/httpd


git-svn-id: svn://svn.berlios.de/openocd/trunk@2742 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-21 18:40:55 +00:00
dbrownell
0c4b119d3f Debug message updates:
- Shrink messaging during resets, primarily by getting rid of
   "nothing happened" noise that hides *useful* information.

 - Improve: the "no IDCODE" message by identifying which tap only
   supports BYPASS; and the TAP event strings.

Related minor code updates:

 - Remove two needless tests when examining the chain:  we know
   we have a TAP, and that all TAPs have names.

 - Clean up two loops, turning "while"s into "for"s which better
   show what's actually being done.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2736 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-20 07:55:11 +00:00
dbrownell
2d3bcddf04 Minor behavior fixes for the two JTAG reset events (C/internal,
and Tcl/external):

 - Reorder so *both* paths (TCK/TMS or TRST) can enable TAPs with
   ICEpick ... first C code flags TAPs that got disabled, then call
   any Tcl code that might want to re-enable them.

 - Always call the C/internal handlers when JTAG operations can be
   issued; previously that wasn't done when TRST was used. 

Plus some small cleanups (whitespace, strings, better messaging
during debug and on some errors) to reset-related code.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2730 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-19 06:49:40 +00:00
oharboe
00e900f8a1 Nicolas Pitre <nico@cam.org> Dragonite support
git-svn-id: svn://svn.berlios.de/openocd/trunk@2693 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 08:03:46 +00:00
oharboe
f89d1cbfd6 spelling mistake
git-svn-id: svn://svn.berlios.de/openocd/trunk@2692 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 07:46:50 +00:00
oharboe
58b78818e0 registering a target event twice caused infinite loop. Same bug as in jtag/core.c copy & pasted.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2690 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-11 06:58:49 +00:00
oharboe
3bade442b1 Alexei Babich <a.babich@rez.ru> fix problems with unecessary tailend byte accesses. Use 16 bit access on tailend of a memory read if possible.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2684 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-09-10 13:17:05 +00:00
oharboe
d879faa3cb David Brownell <david-b@pacbell.net> start phasing out integers as target IDs
git-svn-id: svn://svn.berlios.de/openocd/trunk@2650 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 17:30:14 +00:00
oharboe
bd7cbd01e8 David Brownell <david-b@pacbell.net> Accomodate targets which don't support various target-specific
reset operations.  Maybe they can't; or it's a "not yet" thing.

Note that the assert/deassert operations can't yet trigger for
OMAP3 because resets currently include JTAG reset in all cases,
resetting the ICEpick and thus disabling the TAP for Cortex-A8.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2620 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 19:52:02 +00:00
oharboe
d11c8e3c8e Ferdinand Postema <ferdinand@postema.eu> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@2615 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-25 07:14:05 +00:00
oharboe
18d8ac5267 David Brownell <david-b@pacbell.net>Fix some command helptext:
- spell "address" right
 - list bp/wp params as optional

And make those source lines wrap at sane margins.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2596 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-19 06:31:44 +00:00
ntfreak
69dd81dcf8 David Brownell [david-b@pacbell.net]:
Simplify dumping of register lists by only printing cached values
if they are marked as valid.  Most of the time, they are invalid;
so printing *any* value is just misleading.

Note that for ARM7 and ARM9 most EmbeddedICE registers (except for
debug status) could be cached most of the time; and their register
cache isn't maintained properly (many accesses seem to bypass that
cache code).

git-svn-id: svn://svn.berlios.de/openocd/trunk@2594 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-18 19:55:01 +00:00
oharboe
8b994145b8 Andreas Fritiofson <andreas.fritiofson@gmail.com> UTF8 fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2549 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-17 19:54:25 +00:00
oharboe
56944ac1c8 Fix regression in "step" command introduced in 2190
git-svn-id: svn://svn.berlios.de/openocd/trunk@2478 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 13:42:11 +00:00
duane
2378eaadef Remove extra newline from debug log message
git-svn-id: svn://svn.berlios.de/openocd/trunk@2411 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 03:09:15 +00:00
duane
9ab9786f67 Refactor code, create target_state_name()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2409 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-28 02:40:08 +00:00
zwelch
2e77919853 Remove whitespace at end of lines, step 1.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2379 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:49:23 +00:00
zwelch
c493543fc9 - Replace '){' with ') {'.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2378 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:49:06 +00:00
zwelch
dc575dc5bf Remove whitespace that occurs before ')'.
- Replace '[ \t]*[)]' with ')'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2377 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:47:42 +00:00
zwelch
f90d8fa45f Remove whitespace that occurs after '('.
- Replace '([ \t]*' with '('.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2376 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:46:23 +00:00
zwelch
6d1d58a1fc - Fixes '[<>]' whitespace
- Replace ')\([<>]\)(' with ') \1 ('.
- Replace ')\([<>]\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\([<>]\)(' with '\1 \2 ('.
- Replace '\(\w\)\([<>]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2375 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:45:47 +00:00
zwelch
fb1a9b2cb2 - Fixes '[|]' whitespace
- Replace ')\([|]\)(' with ') \1 ('.
- Replace ')\([|]\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\([|]\)(' with '\1 \2 ('.
- Replace '\(\w\)\([|]\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2374 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:45:15 +00:00
zwelch
8959de9f67 - Fixes '+' whitespace
- Replace ')\(+\)(' with ') \1 ('.
- Replace ')\(+\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(+\)(' with '\1 \2 ('.
- Replace '\(\w\)\(+\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2373 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:44:17 +00:00
zwelch
84df52f9ea - Fixes '=' whitespace
- Replace ')\(=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2372 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:54 +00:00
zwelch
3813fda44a - Fixes '==' whitespace
- Replace ')\(==\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(==\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:42:03 +00:00
zwelch
0e2c2fe1d1 - Fixes '>>' whitespace
- Replace ')\(>>\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(>>\)(' with '\1 \2 ('.
- Replace '\(\w\)\(>>\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2369 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:40:42 +00:00
zwelch
4ce93ac479 - Fixes '>=' whitespace
- Replace ')\(>=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(>=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2367 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:40:10 +00:00
zwelch
128a733428 - Fixes '&&' whitespace
- Replace ')\(&&\)(' with ') \1 ('.
- Replace '\(\w\)\(&&\)(' with '\1 \2 ('.
- Replace '\(\w\)\(&&\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2366 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:47 +00:00
zwelch
d61714f4d5 - Fixes '[+]=' whitespace
- Replace '\(\w\)\([+]=\)(' with '\1 \2 ('.
- Replace '\(\w\)\([+]=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2364 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:39:18 +00:00
zwelch
53d605e12c - Fixes '!=' whitespace
- Replace ')\(!=\)\(\w\)' with ') \1 \2'.
- Replace '\(\w\)\(!=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(!=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:38:12 +00:00
zwelch
5e98c71436 - Fixes '-=' whitespace
- Replace '\(\w\)\(-=\)(' with '\1 \2 ('.
- Replace '\(\w\)\(-=\)\(\w\)' with '\1 \2 \3'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2362 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:56 +00:00
zwelch
95d2a23724 - Replace 'for(' with 'for ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2360 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:37:21 +00:00
zwelch
9af5e445b7 - Replace 'switch(' with 'switch ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2359 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:36:56 +00:00
zwelch
50c086ffb9 - Replace 'while(' with 'while ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2358 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:36:11 +00:00
zwelch
e43979e702 - Replace 'if(' with 'if ('.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2357 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:35:09 +00:00
zwelch
bed9c62f9e Oleksandr Tymoshenko <gonzo@bluezbox.com>:
Resume command works only if resume address is provided.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2348 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 04:58:53 +00:00
duane
afc3eb1dc1 C99 printf() -Werror fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@2325 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-21 03:17:33 +00:00
zwelch
9eb3181cc8 Paulius Zaleckas <paulius.zaleckas@gmail.com>:
This is minimal patch to support FA526 ARMv4 compatible core.
Since it is very similar to ARM920T I tried to reuse as much
code as possible.

CPU and board configs will follow soon.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2292 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-19 22:39:35 +00:00
zwelch
3c2eabd20f Transform 'u32' to 'uint32_t' in src/target
- Replace '\([^_]\)u32' with '\1uint32_t'.
- Replace '^u32' with 'uint32_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2279 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:09:35 +00:00
zwelch
f876d5e9c7 Transform 'u16' to 'uint16_t'
- Replace '\([^_]\)u16' with '\1uint16_t'.
- Replace '^u16' with 'uint16_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2277 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:07:59 +00:00
zwelch
86173cdbdd Transform 'u8' to 'uint8_t' in src/target
- Replace '\([^_]\)u8' with '\1uint8_t'.
- Replace '^u8' with 'uint8_t'.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2274 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-18 07:04:08 +00:00
zwelch
6ba0b46cec David Brownell <david-b@pacbell.net>:
Fix parsing bugs for "$target_name mww addr data [count]" ... it was
always requiring the count, instead of just defaulting it to one.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2263 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 06:40:39 +00:00
zwelch
a0c10dd29b David Brownell <david-b@pacbell.net>:
Extend the internal JTAG event handlers to cover enable/disable,
and use those events to make sure that targets get "examined" if
they were disabled when the scan chain was first set up:

 - Remove "enum jtag_tap_event", merge with "enum jtag_event",
   so C code can now listen for TAP enable/disable events.

 - Report those events so they can trigger callbacks.

 - During startup, make target_examine() register a handler to
   catch ENABLE events for any then-disabled targets.

This fixes bugs like "can't halt target after enabling its TAP".

One class of unresolved bugs:  if the target has an ETM hooked
up to an ETB, nothing activates the ETB.  But starting up the
ETM without access to the ETB registers fails...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2251 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 12:17:18 +00:00
zwelch
14f88acaf6 David Brownell <david-b@pacbell.net>:
Fix some polling issues:

 - Don't background-poll disabled TAPs ... this was just a bug
   waiting to happen.  (And then it happened!)

 - Don't fail command line polls of disabled taps; that's not any
   kind of error, it's just that you can't do much.  But do show
   that tap-disabled status.

 - Spell "continuous" correctly in the variable name.  ;)

Not resolved by this patch:  the need for an interlock whereby
other code (like the JTAG layer) can block all other access to
the JTAG layer, e.g. while enabling or disabling TAPs.  And
that interlock needs to be timer-safe...


git-svn-id: svn://svn.berlios.de/openocd/trunk@2247 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-16 00:23:13 +00:00
zwelch
0ffbc60333 Factor load_image argument parsing to parse_load_image_command_args:
- Make fast_load_image use the helper coverage the standard load_image.
- Improve whitespace in the moved lines.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2239 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:31 +00:00
zwelch
af52480a45 Improve handle_profile_command argument parsing:
- Use parse_uint to ensure timeout value parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2238 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:24 +00:00
zwelch
b7c5e630ea Improve handle_virt2phys_command argument parsing:
- Use parse_u32 to ensure virtual address parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2237 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:17 +00:00
zwelch
f7afcfe23f Cleanup and improve handle_wp_command and handle_rwp_command:
- Simplify argument parsing logic using switch statement.
- Use parse_u32 to ensure all values parse properly.
- Return syntax error when mode argument fails to parse.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2236 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:10 +00:00
zwelch
d0a300e0a0 Improve and simplify handle_bp_command and handle_rbp_command:
- Bug fix: return syntax error if remove called without one argument.
- Use parse_u32 to ensure address and length arguments parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2235 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:34:03 +00:00
zwelch
16c77cf3ca Improve handle_verify_image_command_internal command argument handling:
- Use parse_u32 to ensure address parses properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2234 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:55 +00:00
zwelch
890973acc4 Improve handle_dump_image_command argument parsing:
- Use parse_u32 to ensure address and size parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2233 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:48 +00:00
zwelch
bb37adadab Improve handle_load_image_command argument parsing:
- Use parse_u32 to ensure base/min/max addresses parse properly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2232 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:42 +00:00
zwelch
6f9aac1892 Improve handle_mw_command argument handling:
- Change: All local variable types are now unsigned.
- Use parse_u32 to ensure address and value parse properly.
- Use parse_uint to ensure count parses properly.
- Move variables to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2231 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:34 +00:00
zwelch
08128b572a Improve handle_md_command argument handling:
- Use parse_u32 and parse_uint for address and count, respectively.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2230 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:25 +00:00
zwelch
71f95de8a6 Use parse_u32 in handle_resume_command and handle_step_command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2229 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:18 +00:00
zwelch
5d0cdf4d94 Cleanup and improve handle_halt_command:
- Make argument check use parse_uint to ensure value parses properly.
- Move variable declarations to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2228 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:11 +00:00
zwelch
fad8521a87 Cleanup and fi handle_wait_halt_command:
- Use unsigned type for delay variable.
- Use parse_uint to ensure delay argument parses properly.
- Bug fix: Return syntax error if more than one argument is given.
- Bug fix: Return syntax error when argument fails to parse.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2227 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:33:01 +00:00
zwelch
45ec363c4a Use parse_uint in handle_reg_command to ensure reg number parses properly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2226 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:32:54 +00:00
zwelch
2343245090 Use parse_uint in get_target to ensure target id is parsed properly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2225 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-13 00:32:40 +00:00
oharboe
1b2c1c6ff0 fix ordering of arguments to fwrite()
git-svn-id: svn://svn.berlios.de/openocd/trunk@2197 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 13:00:08 +00:00
zwelch
538050c146 Factor handle_bp_command into pieces:
- Bug fix: return a syntax error if the wrong number of arguments are given.
- Add handle_bp_command_list() and handle_bp_command_set().
- Use temporary addr variable to eliminate redundant strtoul() calls.
- Place variable declarations at their point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2196 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:43:07 +00:00
zwelch
8e899d43ef Factor target_timer_callbacks_check_time into pieces:
- Add target_timer_callback_periodic_restart and target_call_timer_callback.
- Clean up and simplify logic that determines whether to call each callback. 
- Move variable declarations to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2195 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:43:00 +00:00
zwelch
7c892082c9 Simplify and clean handle_virt2phys_command:
- Add a doxygen block to simplify logic.
- Move declarations to point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2194 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:54 +00:00
zwelch
57612ecf1d Simplify and fix target handle_rwp_command routine:
- Return syntax error unless exactly one argument is passed.
- Move variable declaration to point of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2193 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:47 +00:00
zwelch
d7ada2457e Simplify and fix handle_reset_command:
- Return syntax error if more than one argument is given.
- Move variables to location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2192 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:40 +00:00
zwelch
e4850d7159 Simplify handle_resume_command:
- Eliminate redundant calls to target_resume with addr temp variable.
- Place variables at location of first use.
- Fix minor whitespace issues.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2191 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:33 +00:00
zwelch
78cf92166a Simplify and fix handle_step_command:
- Bug fix: return syntax error when more than one argument is given.
- Eliminate redundant calls to step callback with addr temp variable.
- Place variables at location of first use.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2190 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 11:42:26 +00:00
oharboe
c1995bb08f disable polling continuous polling during reset
git-svn-id: svn://svn.berlios.de/openocd/trunk@2183 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 06:19:37 +00:00
zwelch
bdb7dd5e0f Move the documentation for the "poll" command up with
other server configuration.  Explain what it's about;
reference the related "$target_name curstate" method.

Update "poll" output to report whether background polling
is enabled or not.

Also fix a small typo; PC's have "complementary" tools.
Some have also "complimentary" ones; but not all.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2178 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-10 04:06:25 +00:00
oharboe
e468797e41 David Brownell <david-b@pacbell.net> Bugfix: $target_name cget/configure -work-area-backup commands
should return the "is it backed up?" flag, not the work area size.

git-svn-id: svn://svn.berlios.de/openocd/trunk@2108 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 06:18:13 +00:00
oharboe
a405fd1581 David Brownell <david-b@pacbell.net>
- Don't let disabled TAPs be set as the current target

 - Improve "targets" output:
    * Remove undesirable "chain position" number; we discourage using them
    * TAP and Target column updates:
       + make them long enough for current usage
       + improve labels, removing guesswork
       + "TapName" label patches scan_chain output
    * Highlight the "current" target
    * Display "tap disabled" as a new pseudo-state
    * Update docs accordingly

git-svn-id: svn://svn.berlios.de/openocd/trunk@2107 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-08 06:16:43 +00:00
zwelch
695c6c0960 David Brownell <david-b@pacbell.net>:
Let disabled targets be ignored during normal operation:

 - In target_examine(), ignore disabled TAPs

 - Reset handling must not poke at them either:
     * fail $target_name arp_* operations on disabled TAPs
     * in startup.tcl, don't even issue the arp_* wait ops 

ZW: removed superfluous braces from the patch to target.c.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2100 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:35:29 +00:00
zwelch
733dfb288f Fix regression in mdw output; identified by Magnus Lundin.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2098 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-07 23:20:30 +00:00
oharboe
a49faa206d remove unused include file: inttypes.h
git-svn-id: svn://svn.berlios.de/openocd/trunk@2071 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 06:37:21 +00:00
zwelch
7db5839608 Eliminate MixedCaps symbol from public JTAG TAP API:
- Purely mechanical transformations to the source files.
- Rename 'jtag_TapByJimObj' as 'jtag_tap_by_jim_obj.'


git-svn-id: svn://svn.berlios.de/openocd/trunk@2066 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-05 00:43:12 +00:00
oharboe
414245c9ce fix warning for a variable that GCC thought might be uninitialized(which it can't be).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1979 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-01 19:06:11 +00:00
zwelch
74df79d4d8 Final step in isolating target_type_s structure:
- Move definition of 'struct target_type_s' into new 'target_type.h' file.
- Forward delclaration remains in target.h, with comment pointing to new file.
- Replaces #define with #include in source files.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1971 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 12:38:28 +00:00
zwelch
818aa27a9d First step in hiding target_type_s from public interface:
- Add DEFINE_TARGET_TYPE_S symbol in files that need it defined.
- Forward declare 'struct target_type_s' only, unless that symbol is defined.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1969 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:32:28 +00:00
zwelch
4deb42ed00 Add target_examine_one wrapper:
- replaces all calls to target->type->examine.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1968 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:32:10 +00:00
zwelch
d00ac17e8e Add target breakpoint and watchpoint wrapper:
- replaces all calls to target->type->{add,remove}_{break,watch}point.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1967 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:52 +00:00
zwelch
0de78ed02c Add target_get_name wrapper:
- replaces all accesses to target->type->name.
- add documentation in target_s to warn not to access field directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1966 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:27 +00:00
zwelch
17fa4de854 Add target_step wrapper:
- replaces all calls to target->type->step.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1965 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:31:11 +00:00
zwelch
df4cf0615f Add target_get_gdb_reg_list wrapper:
- replaces all calls to target->type->get_gdb_reg_list.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1964 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 11:30:59 +00:00
zwelch
11edf22776 Add target_bulk_write_memory wrapper:
- replaces all calls to target->type->bulk_write_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1963 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:39:04 +00:00
zwelch
9cb3af610a Add wrappers for target->type->examined:
- replace all checks of target->type->examined with target_was_examined().
- replace all setting of target->type->examined with target_set_examined().
- replace clearing of target->type->examined with target_reset_examined().
- add documentation in target_s to warn not to access field directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1962 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:38:43 +00:00
zwelch
fbe8cf72a5 Add target_run_algorithm wrapper:
- replaces all calls to target->type->run_algorithm.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1961 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:38:20 +00:00
zwelch
95e13054ca Add target_write_memory wrapper:
- replaces all calls to target->type->write_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1960 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:37:57 +00:00
zwelch
b6db182c00 Add target_read_memory wrapper:
- replaces all calls to target->type->read_memory.
- add documentation in target_s to warn not to invoke callback directly.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1959 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 09:37:35 +00:00
zwelch
6785193118 Simplify the handle_md_command routine in target.c:
- fix buffer overrun in mdw; final '\0' would overflow the output buffer.
 - return ERROR_COMMAND_SYNTAX_ERROR instead of ERROR_OK if:
   - less than one argument is provided
   - the command is called with a name other than mdb, mdh, or mdw.
 - factor all command output into new handle_md_output function


git-svn-id: svn://svn.berlios.de/openocd/trunk@1958 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 06:00:28 +00:00
zwelch
55f21192b0 Make nvp_target_event static; remove its external declaration.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1957 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 04:58:51 +00:00
zwelch
12df0f0090 Make target_buffer_get_uXX interfaces work with constant buffers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1956 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-31 02:18:26 +00:00
zwelch
58e31916de Eliminate duplicated code in the handle_mw_command memory write loop.
- wordsize will always be 1, 2, or 4 due to preceeding switch statement.
- move call to keep_alive after successful writes, not upon failures


git-svn-id: svn://svn.berlios.de/openocd/trunk@1953 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-30 23:57:30 +00:00
zwelch
570631454d David Brownell <david-b@pacbell.net>: This patch adds annotations to
the key command_*() helper functions, fixng the bugs that turned up.

Several of these bugs were from misuse of PRIi64; that's for 64-bit
integers, NOT for "long long" or "u64" (which work best with %lld).


git-svn-id: svn://svn.berlios.de/openocd/trunk@1873 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 09:28:57 +00:00
kc8apf
4b992717b5 Author: Øyvind Harboe <oyvind.harboe@zylin.com>
- Allow target_read/write_buffer of size 0


git-svn-id: svn://svn.berlios.de/openocd/trunk@1870 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-21 05:12:32 +00:00
kc8apf
c977616cda Consolidate target selection code into single get_target() that handles both names and numbers. Provided by David Brownell <david-b@pacbell.net>
git-svn-id: svn://svn.berlios.de/openocd/trunk@1804 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 04:44:28 +00:00
oharboe
41826d5bd9 fix array2mem/mem2array when used as a "method" on a target.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1801 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-17 13:00:36 +00:00
oharboe
b3b0ff60c2 take #2: dump_image now works for addresses not divisible by 4
git-svn-id: svn://svn.berlios.de/openocd/trunk@1786 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 19:00:35 +00:00
oharboe
a74d911412 dump_image now works for addresses not divisible by 4
git-svn-id: svn://svn.berlios.de/openocd/trunk@1785 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 18:56:41 +00:00
oharboe
c5e51bca0a propagate error in dump_image. If an error occurs during dump_image, a tcl exception is thrown.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1782 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-14 08:44:09 +00:00
zwelch
03f3296046 Audit and eliminate redundant #include directives in core target files.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1713 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 04:38:18 +00:00
zwelch
490e271290 Remove redundant sys/types.h #include directives (now in types.h).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1700 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 02:27:16 +00:00
oharboe
7a93100c2d Dirk Behme <dirk.behme@googlemail.com> Add minimalist Cortex A8 file
git-svn-id: svn://svn.berlios.de/openocd/trunk@1602 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 18:44:12 +00:00
zwelch
8c1ec4f0e1 Add static keywords to core target source file data and functions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1579 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-30 09:49:38 +00:00
oharboe
e784db4fdd SimonQian <simonqian@simonqian.com> AVR wip
git-svn-id: svn://svn.berlios.de/openocd/trunk@1540 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-27 10:32:13 +00:00
kc8apf
0f3ab30087 Fix use of wrong format conversion for size_t (%zu instead of %u)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1502 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-22 07:31:16 +00:00
oharboe
5dbf973910 Zach Welch <zw@superlucidity.net>fix unused return value warnings (3 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1482 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:35:10 +00:00
oharboe
4f0bd8e8e1 Zach Welch <zw@superlucidity.net> fix -Wformat-security warnings (1 of 4)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1481 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-21 05:33:47 +00:00
oharboe
40580e2d71 Zach Welch <zw@superlucidity.net> fix -Werror warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1472 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-04-19 20:51:16 +00:00
duane
fb59d0fa55 Commands: reg, profile, ocd_mem2array, ocd_array2mem, fast_load, etc only work *IF* there is an actual target
git-svn-id: svn://svn.berlios.de/openocd/trunk@1404 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-08 21:14:35 +00:00
oharboe
86c0f4cafc Nicolas Pitre <nico@cam.org> fix "halt 0" to only halt and not to poll/wait afterwards. This follows the intention in the docs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1398 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-05 06:55:35 +00:00
oharboe
8d772cad7a test code for elf parsing.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1396 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-03 12:05:49 +00:00
oharboe
39d80bad9b tinkered a bit with performance for Cortex flash programming. Mainly make it easier to profile as a start.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-02-23 21:26:11 +00:00
oharboe
ce1a29725f chain position is now required when creating a target
git-svn-id: svn://svn.berlios.de/openocd/trunk@1363 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-01-28 13:08:06 +00:00
oharboe
f4d82deb36 Uwe Hermann <uwe@hermann-uwe.de> One of them is fixing a few compiler warnings (see attached patch) and
likely also one (non-cosmetic) bug (the 'id_buff' change, which seems to
be a buffer overflow).

git-svn-id: svn://svn.berlios.de/openocd/trunk@1293 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-28 21:40:39 +00:00
ntfreak
47d0449347 - add ability for openocd to communicate to gdb using pipes (stdin/stdout).
- this is enabled by new command line option option --pipe.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1242 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-15 09:43:26 +00:00
oharboe
459d03e3bb fast_load profiling tool moved to target.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1241 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-15 09:05:16 +00:00
ntfreak
0cba0d4df3 - remove target specific variant and use target->variant member
- fix build warning in cortex_m3
- code cleanup - remove trailing lf and convert c++ comments

git-svn-id: svn://svn.berlios.de/openocd/trunk@1238 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-13 12:44:39 +00:00
duane
a28eaa85f7 jtag newtap change & huge manual update
git-svn-id: svn://svn.berlios.de/openocd/trunk@1194 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-30 22:25:43 +00:00
oharboe
3a636951eb Rick Altherr <kc8apf@kc8apf.net> retire obsolete syntax
git-svn-id: svn://svn.berlios.de/openocd/trunk@1190 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-27 14:58:49 +00:00
ntfreak
271bb81d6d - fixes segfault using the targets cmd if multiple targets defined
git-svn-id: svn://svn.berlios.de/openocd/trunk@1187 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-26 16:43:01 +00:00
oharboe
e3462b228c jtag_get_device() now returns NULL and reports error instead of invoking exit()
git-svn-id: svn://svn.berlios.de/openocd/trunk@1176 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-19 08:22:47 +00:00
oharboe
3de3de0b37 execute reset init upon power restore / srst deassert
git-svn-id: svn://svn.berlios.de/openocd/trunk@1150 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-10 10:16:13 +00:00
oharboe
71c7306885 fix telnet async messages. retired telnet_async command - no user serviceable parts inside.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1135 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-05 08:48:50 +00:00
oharboe
bbafcb3758 disable continous polling while srst is asserted and power dropout is detected
git-svn-id: svn://svn.berlios.de/openocd/trunk@1134 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-05 07:45:31 +00:00
oharboe
fbbf6640ae Rick Alterr - The attached patch makes the target syntax parsing much more robust and makes the variant optional again.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1129 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-04 08:02:06 +00:00
oharboe
199ebae564 Rick Altherr <kc8apf@kc8apf.net> - fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@1126 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-03 07:22:14 +00:00
oharboe
e3eff88550 invoke target_create() once
git-svn-id: svn://svn.berlios.de/openocd/trunk@1124 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-02 21:16:41 +00:00
oharboe
7b78e59192 step command now propagates error
git-svn-id: svn://svn.berlios.de/openocd/trunk@1123 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-02 20:55:07 +00:00
oharboe
f8cd20e284 Rick Altherr <kc8apf@kc8apf.net> - fix support for old target syntax
git-svn-id: svn://svn.berlios.de/openocd/trunk@1108 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-28 08:06:07 +00:00
oharboe
df77b45054 Kees Jongenburger <kees.jongenburger@gmail.com> old" syntax target command appears to be broken
this patch addresses this issue

git-svn-id: svn://svn.berlios.de/openocd/trunk@1107 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-27 20:57:17 +00:00
oharboe
ed9c257551 Laurentiu Cocanu - more help text
git-svn-id: svn://svn.berlios.de/openocd/trunk@1087 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-22 09:30:33 +00:00
oharboe
ccc2e3fe76 Laurentiu Cocanu - memory read/write and exit() error path fixes
git-svn-id: svn://svn.berlios.de/openocd/trunk@1064 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-15 11:44:36 +00:00
oharboe
af41e6aac8 김운식 <donari75@gmail.com> spotted a bug in target_write_u8
git-svn-id: svn://svn.berlios.de/openocd/trunk@1063 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-15 07:08:18 +00:00
oharboe
08058e72d9 reset cleanup. Remove obsolete events that are not needed for compatibility.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1053 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-14 07:30:45 +00:00
oharboe
3600e7c6e0 reset cleanup
git-svn-id: svn://svn.berlios.de/openocd/trunk@1048 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-14 06:21:02 +00:00
oharboe
fe41e273e3 Retired old reset code according to plan.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1047 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-13 20:38:58 +00:00
oharboe
bc25d4fa5e Fixed gaffes in reset script handling + improved error
messages a bit. The file and line # of the syntax error
in a reset script is now printed.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1042 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-13 10:30:33 +00:00
oharboe
0a3b6213bb Laurentiu Cocanu <laurentiu.cocanu@zylin.com> - Added additional error checks mostly to src/target/target.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@1041 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-13 06:52:05 +00:00
oharboe
4eadb146c1 file not found SEGFAULT fix
git-svn-id: svn://svn.berlios.de/openocd/trunk@1030 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-08 11:06:44 +00:00
oharboe
7fd9ba22ba Centralize error handling for buggy register handling
git-svn-id: svn://svn.berlios.de/openocd/trunk@1019 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-06 12:09:27 +00:00
oharboe
316c9b9698 GDB alive fixes for verify_image
git-svn-id: svn://svn.berlios.de/openocd/trunk@1014 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-03 13:25:33 +00:00
oharboe
f9a3c36cf2 fix noise in gdb console when single stepping. Remove printing of log before processing halted event.
git-svn-id: svn://svn.berlios.de/openocd/trunk@994 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-24 09:43:31 +00:00
ntfreak
68c598e88d - added myself to copyright on files i remember adding large contributions for over the years
- cleaned up headers to match rest of code
- added missing svn props for previously added files

git-svn-id: svn://svn.berlios.de/openocd/trunk@987 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-20 10:50:53 +00:00
oharboe
d28931c2d4 follow up to keep_alive() fix. process target events before returning from reset procedure.
git-svn-id: svn://svn.berlios.de/openocd/trunk@986 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-12 10:53:10 +00:00
oharboe
9b6853bc4c - Fixed regression introduced in 890 when "fixing warnings" for target_call_timer_callbacks_now().
target_call_timer_callbacks_now() did the same as target_call_timer_callbacks().

- Reduced keep_alive()'s job to only deal with GDB keep  alive problems.

git-svn-id: svn://svn.berlios.de/openocd/trunk@985 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-12 07:09:38 +00:00
oharboe
0ae7f962f8 Duane Ellis: target_process_reset is now implemented in tcl. This allows better control from target configuration scripts.
git-svn-id: svn://svn.berlios.de/openocd/trunk@984 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-12 06:56:00 +00:00
oharboe
2ccb9ed44c fixed keep_alive fix gaffe introduce in previous commit.
git-svn-id: svn://svn.berlios.de/openocd/trunk@983 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-08 12:14:33 +00:00
oharboe
a5c4ef92b0 Duane Ellis has made highly non-trivial changes to both the target handling and command system.
git-svn-id: svn://svn.berlios.de/openocd/trunk@977 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-01 21:22:20 +00:00
oharboe
5ac8036b7f Removed target->reset_mode, no longer used
git-svn-id: svn://svn.berlios.de/openocd/trunk@976 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-01 07:24:14 +00:00
oharboe
ef1cfb2394 Duane Ellis: "target as an [tcl] object" feature.
git-svn-id: svn://svn.berlios.de/openocd/trunk@975 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-09-01 07:20:21 +00:00
oharboe
7df08fc385 fixed gaffe in last release w/target number.
git-svn-id: svn://svn.berlios.de/openocd/trunk@965 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-25 11:30:46 +00:00
oharboe
8d73c2a9b0 duan ellis target tcl work in progress
converts a number of 'simple string lookup tables' into NVP tables.
  These NVP tables will be used by various commands coming in the next patch.


git-svn-id: svn://svn.berlios.de/openocd/trunk@962 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-24 18:20:49 +00:00
drath
2feac34e3f - fix a off-by-one error in the buffer read/write code that checks for a address wrap
git-svn-id: svn://svn.berlios.de/openocd/trunk@957 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-22 12:08:47 +00:00
oharboe
c4567145ae fix BUG: keep_alive() error messages
git-svn-id: svn://svn.berlios.de/openocd/trunk@949 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-20 07:14:45 +00:00
oharboe
ea0270e38e make target_wait_state() usable from other places, made LOG_USER() output LOG_DEBUG() output. Avoids flooding logs in certain cases and OpenOCD will output error message if the halt fails.
git-svn-id: svn://svn.berlios.de/openocd/trunk@944 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-19 16:42:58 +00:00
oharboe
0960cbeedd added some alive_sleep()'s
git-svn-id: svn://svn.berlios.de/openocd/trunk@940 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-19 13:53:43 +00:00
oharboe
c45225dd11 propagate error code in case of "reset" failing.
git-svn-id: svn://svn.berlios.de/openocd/trunk@906 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-11 10:31:13 +00:00
oharboe
bd85f16e39 default reset in help text - run
git-svn-id: svn://svn.berlios.de/openocd/trunk@900 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-08 08:37:41 +00:00
ntfreak
ce16ff901c - fix target_examine declaration
- remove build warnings
- added --enable-gccwarnings to docs
- update mips_m4k_examine function

git-svn-id: svn://svn.berlios.de/openocd/trunk@893 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-06 14:36:37 +00:00
oharboe
f370d70670 Duane Ellis: fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@890 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-05 12:27:18 +00:00
oharboe
1829361253 define resetting the target into the halted or running
state as an atomic operation.

git-svn-id: svn://svn.berlios.de/openocd/trunk@888 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-05 07:11:12 +00:00
oharboe
3a48961820 moves handling of problems with resetting into the halted state
into the target implementation.

Also target_process_reset() is now simpler and has error handling,
e.g. if assert reset fails, then target_process_reset() will propagate
that error.

cmd_ctx was passed in to examine(), which is wrong - removed that.

git-svn-id: svn://svn.berlios.de/openocd/trunk@887 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-05 06:18:26 +00:00
oharboe
75ba7397b2 wait up to 1 second for halted state upon reset init/halt.
git-svn-id: svn://svn.berlios.de/openocd/trunk@884 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-31 15:52:01 +00:00
oharboe
0f18744a87 fixed gaffe mea culpa
git-svn-id: svn://svn.berlios.de/openocd/trunk@878 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-28 14:25:03 +00:00
oharboe
e2b6de3d66 retired reset run_and_init/halt
git-svn-id: svn://svn.berlios.de/openocd/trunk@877 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-28 06:08:05 +00:00
oharboe
b82a189c4e add check for target_read/write_buffer 32 bit wrap.
git-svn-id: svn://svn.berlios.de/openocd/trunk@875 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-26 19:12:30 +00:00
ntfreak
53590217ee - merged mips target into svn trunk
git-svn-id: svn://svn.berlios.de/openocd/trunk@874 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-26 10:32:11 +00:00
oharboe
6f0000e5ce minimum address and maximum length argument to load_image. Used in lieu of reset init script when executable w/reset init sequence is available.
git-svn-id: svn://svn.berlios.de/openocd/trunk@873 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-25 14:09:00 +00:00
oharboe
526fe3d83e added yours sincerely for files where I feel that I've made non-trivial contributions.
git-svn-id: svn://svn.berlios.de/openocd/trunk@872 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-25 06:54:17 +00:00
oharboe
06d501a192 wait 500ms for target to halt upon connect.
git-svn-id: svn://svn.berlios.de/openocd/trunk@865 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-24 06:07:55 +00:00
ntfreak
bf58fe6509 - fix typo
git-svn-id: svn://svn.berlios.de/openocd/trunk@862 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-23 20:18:56 +00:00
oharboe
dfbb9f3e89 - jtag_khz/speed are now single parameter only. These are used
from pre/post_reset event scripts. Adding the second parameter was
a mistake seen in retrospect. this gives precise control in post_reset
for *when* the post reset speed is set. The pre_reset event was
added *after* the second parameter to jtag_khz/speed
- the target implementations no longer gets involved in the reset mode
scheme. Either they reset a target into a halted mode or not.
target_process_reset()
detects if the reset halt failed or not.
- tcl target event names are now target_N_name.  Mainly internal
at this early stage, but best to get the naming right now.
- added hardcoded reset modes from gdb_server.c. I don't know precisely what
these defaults should be or if it should be made configurable. Perhaps some
hardcoded defaults will do for now and it can be made configurable later.
- bugfix in cortex_m3.c for reset_run_and_xxx?
- issue syntax error upon obsolete argument in target command instead of
printing message that will surely drown in the log

git-svn-id: svn://svn.berlios.de/openocd/trunk@849 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-21 15:59:41 +00:00
oharboe
6c0553c8c5 openocd@duaneellis.com fix naming confusion. Use ocd_ prefix for ocd API consistently.
git-svn-id: svn://svn.berlios.de/openocd/trunk@839 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-20 17:04:58 +00:00
oharboe
35e84a2a25 "reset" without arguments now execute a "reset run".
the reset mode argument to the target command is deprecated(ignored w/error message).

git-svn-id: svn://svn.berlios.de/openocd/trunk@832 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 14:43:29 +00:00
ntfreak
60ba4476df - fix incorrectly registered function openocd_array2mem
- removed unused variables
- reformatted lpc288x.[ch]
- fixed helper/Makefile.am dependencies
- add correct svn props to added files

git-svn-id: svn://svn.berlios.de/openocd/trunk@829 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 11:38:23 +00:00
oharboe
722fcb8d61 resume is now asynchronous
git-svn-id: svn://svn.berlios.de/openocd/trunk@828 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 11:18:35 +00:00
oharboe
94e75e0c06 1. GDB will print cryptic error messages if it is not fed keep-alive packets
within the last 2000ms.

To fix this, add keep_alive() if you are spending >1000ms in an algorithm
thus holding up the server loop.

target_call_timer_callbacks() invokes keep_alive().

2. post_reset script is now executed at normal JTAG speed and not
reset speed.

3. Resume is now synchronous again. Hopefully it will work this time.



git-svn-id: svn://svn.berlios.de/openocd/trunk@826 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 10:20:10 +00:00
oharboe
679592d42e Charles Hardin <ckhardin@gmail.com> move tcl stuff nearer to where it belongs.
git-svn-id: svn://svn.berlios.de/openocd/trunk@824 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 06:24:57 +00:00
ntfreak
6af107855d - reverted resume_target to old behaviour
git-svn-id: svn://svn.berlios.de/openocd/trunk@817 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-17 07:15:14 +00:00
oharboe
396d73ad0c better error messages for target event scripts.
git-svn-id: svn://svn.berlios.de/openocd/trunk@810 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-16 07:22:17 +00:00
ntfreak
a6a65f17f3 - only check normal resume, not debug resume
git-svn-id: svn://svn.berlios.de/openocd/trunk@777 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-09 12:46:40 +00:00
ntfreak
876297c25c - target_resume is now synchronous with 5sec timeout
git-svn-id: svn://svn.berlios.de/openocd/trunk@775 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-09 10:33:30 +00:00
oharboe
f0f5157e09 tcl regression fixes.
git-svn-id: svn://svn.berlios.de/openocd/trunk@774 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-08 16:05:59 +00:00
ntfreak
6ed75d476e - removed target_process_events as only used in handle_resume_command and events will be called anyway by poll
git-svn-id: svn://svn.berlios.de/openocd/trunk@772 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-08 11:19:03 +00:00
ntfreak
46b3e72528 - fix pre_resume script not being called
git-svn-id: svn://svn.berlios.de/openocd/trunk@771 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-08 10:49:58 +00:00
oharboe
9103bbbcb5 reset event is synonym for post_reset event.
git-svn-id: svn://svn.berlios.de/openocd/trunk@769 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-07 21:06:22 +00:00
ntfreak
655e4f88a6 - fixed build issues with win32
- fixed build warnings for last commit
- set svn props for last commit

git-svn-id: svn://svn.berlios.de/openocd/trunk@760 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-06 23:22:17 +00:00
oharboe
dc796a2091 src/helper/configuration.h
- Log output handlers now get a "const char *line"
	- Added "const" to parameter.

src/helper/command.c
src/helper/command.h
	- New function:  'command_output_text()'
	- Log output handlers now get a "const char *line"
 
src/helper/options.c
	- Log output handlers now get a "const char *line"

src/server/telnet_server.c
	- DO not transmit NULL bytes via TELNET.
	- Log output handlers now get a "const char *line"
	
src/server/gdb_server.c
	- Log output handlers now get a "const char *line"
	
	*** THIS INCLUDES PORTIONS OF A PATCH FROM Oyvind sent 
	previously to the mailing list for TCL users try

src/target/target.c
	*** THIS INCLUDES PORTIONS OF A PATCH FROM Oyvind sent 
	previously to the mailing list for TCL users try
	
src/target/target.h
	*** THIS INCLUDES PORTIONS OF A PATCH FROM Oyvind sent 
	previously to the mailing list for TCL users try

src/openocd.c
    - **MAJOR** Work: New TCL/Jim function: mem2array
	- **MAJOR** Work: Redirect Tcl/Jim stdio output to remote users.
	- Previously: TCL output did not go to GDB.
	- Previously: TCL output did not go to TELNET
	- Previously: TCL output only goes to control console.
	- This fixes that problem.
	+ Created callbacks:
		+openocd_jim_fwrite()	
		+openocd_jim_fread()
		+openocd_jim_vfprintf()
		+openocd_jim_fflush()
		+openocd_jim_fgets()

src/Makefile.am
	- New TCL files.
	- Future note: This should be more automated.  As the list of
	  'tcl' files grows maintaning this list will suck.

src/Jim.c
	- ** THIS INCLUDES A PREVIOUS PATCH I SENT EARLIER **
	- that impliments many [format] specifies JIM did not support.
	- Jim_FormatString() - **MAJOR** work.
	- Previously only supported "%s" "%d" and "%c"
	- And what support existed had bugs.
	- NEW: *MANY* formating parameters are now supported.
	- TODO: The "precision" specifier is not supported.

	** NEW ** This patch.
	
	- Jim_StringToWide() test if no conversion occured.
	- Jim_StringToIndex() test if no conversion occured.
	- Jim_StringToDouble() test if no conversion occured.

	** NEW ** This Patch. Major Work.
	- Previously output from JIM did not get sent to GDB
	- Ditto: Output to Telnet session.
	- Above items are now fixed - By introducing callbacks
	  new function pointers in the "interp" structure.

	- Helpers that call the callbacks.
	
	- New function: Jim_fprintf()
	- New function: Jim_vfprintf()
	- New function: Jim_fwrite()
	- New function: Jim_fread()
	- New function: Jim_fflush()
	- New function: Jim_fgets()

	By default: the output is to STDIO as previous.
	The "openocd.c" - redirects the output as needed.
	
	- Jim_Panic() - Send panic to both STDERR and the interps
	specified STDERR output as a 2nd choice.

	- Now JIM's "stdin/stdout/stderr" paramters are "void *"
	and are no longer "FILE *".

src/Jim.h
	- **MAJOR**
	-  New JIM STDIO callbacks in the "interp" structure.
	-  change: "stdin/stdout/stderr" are now "void *" cookies.
	-  New JIM stdio helper functions.



git-svn-id: svn://svn.berlios.de/openocd/trunk@755 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-06 19:17:43 +00:00
ntfreak
4d858f7136 - allocate target_type_t structure for each target, fixes issue when multiple targets of the same type are located on the jtag chain
- Thanks Michel Pollet

git-svn-id: svn://svn.berlios.de/openocd/trunk@738 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-02 07:51:41 +00:00
oharboe
c5df3ce144 Fixed bogus error message and plugged memory leak for the case when there was no reset script.
git-svn-id: svn://svn.berlios.de/openocd/trunk@728 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-06-25 19:23:55 +00:00
oharboe
7e36e461a4 added pre/post_reset scripts based on Pieter Conradie's ideas.
git-svn-id: svn://svn.berlios.de/openocd/trunk@726 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-06-25 08:47:19 +00:00
ntfreak
938e01d0c3 - moved flash erase_check target code to target.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@694 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-27 21:23:47 +00:00
ntfreak
222b5c179a - fixed typo in wp command
git-svn-id: svn://svn.berlios.de/openocd/trunk@692 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-27 17:57:41 +00:00
oharboe
d8de4b9bab moved srst_pulls_trst check into arm7_9_common.c. Not tested yet, if it is broken it should "only" print bogus warnings or not print a warning when it should have.
git-svn-id: svn://svn.berlios.de/openocd/trunk@670 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-21 07:28:33 +00:00
oharboe
a76c3433e1 print out an error if srst_pulls_trst is not specified for
e.g. at91fr40008. Could possibly show bogus false positives in log without any other side effects.

git-svn-id: svn://svn.berlios.de/openocd/trunk@666 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-19 18:58:47 +00:00
oharboe
552244724c Michael Fischer found and Edgar Grimberg fixed generic crash in timers reproduceable with at91fr40008
git-svn-id: svn://svn.berlios.de/openocd/trunk@663 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-19 08:44:57 +00:00
oharboe
52377759a2 Michael Fischer spotted a problem in the reset routines for srst_pulls_trst. It is a bit of a mystery why this was only visible w/LPC2148.
Embedded ICE registers are now set up after SRST pulls TRST.

git-svn-id: svn://svn.berlios.de/openocd/trunk@650 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-09 18:38:51 +00:00
oharboe
e18e23e1b6 Added checks for target->type->read/write_memory, soft_reset_halt and run_algorithm that the target has been examined.
git-svn-id: svn://svn.berlios.de/openocd/trunk@581 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-15 18:08:36 +00:00
oharboe
5aa93a5e8a target read/write is no longer attempted for target_xxx() functions when the target has not been examined(fails w/error).
git-svn-id: svn://svn.berlios.de/openocd/trunk@580 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-15 17:03:13 +00:00
oharboe
d300ecfc8e fixed gaffe for default examine implementation
git-svn-id: svn://svn.berlios.de/openocd/trunk@567 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-11 15:49:31 +00:00
oharboe
c4a2fdbc39 Reset wip. Just adding hooks. This is just to reduce the size of the actual change, no change in behaviour.
git-svn-id: svn://svn.berlios.de/openocd/trunk@565 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-11 14:06:42 +00:00
oharboe
0d7d64b5e9 Wip - split target setup and target examination
git-svn-id: svn://svn.berlios.de/openocd/trunk@564 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-11 11:19:17 +00:00
oharboe
7805be1b3a added target->type->examine(). Eventually this will allow for bringing up telnet/gdb *before* jtag chain has been validated + it might fix some reset halt problems seen as examine() needs to run after TRST has been asserted.
git-svn-id: svn://svn.berlios.de/openocd/trunk@563 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-11 06:52:52 +00:00
oharboe
a064722743 - added "init" command. "init" and "reset" at end of startup script is equivalent
to daemon_startup(still supported).
- print warning if srst and trst change state at the same time when srst_and_trst
is seperate
- reset now performs a trst, examines and validates the jtag chain before targets
assert reset
- if startup fails to examine and validate the jtag chain, try a reset before
trying again


git-svn-id: svn://svn.berlios.de/openocd/trunk@552 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-09 05:50:34 +00:00
oharboe
2b7504c279 - only if "reset halt" or "reset init" are issued will the reset vector be set up
- If communication fails during assert between assert/deassert and during
assert, warnings are printed. The warning suggests using srst_only if the
clock locks up as that would allow the reset vector to be set up before
asserting reset.

git-svn-id: svn://svn.berlios.de/openocd/trunk@544 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-07 10:48:44 +00:00
oharboe
381dc0efab - the reset mode parameter is now DEPRECATED. It is implemented
as an optional parameter with default reset_init. This is to streamline
things w.r.t. the target library.


git-svn-id: svn://svn.berlios.de/openocd/trunk@540 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-04 14:09:03 +00:00
oharboe
35b3c95299 - reverted some of the changes that possibly broke arm926ejs. Waiting
for a bit more info before I can tell with confidence whether or not
this would have any effect.
- worked on error propagation and output for flash

git-svn-id: svn://svn.berlios.de/openocd/trunk@539 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-04 13:47:38 +00:00
oharboe
d3f0549f08 - Work on fixing erase check. Many implementations are plain broken.
Wrote a default flash erase check fn which uses CFI's target algorithm
w/fallback to memory reads. 
- "flash info" no longer prints erase status as it is stale. 
- "flash erase_check" now prints erase status. erase check can take a 
*long* time. Work in progress
- arm7/9 with seperate srst & trst now supports reset init/halt
after a power outage. arm7/9 no longer makes any assumptions
about state of target when reset is asserted.
- fixes for srst & trst capable arm7/9 with reset init/halt
- prepare_reset_halt retired. This code needs to be inside
assert_reset anyway
- haven't been able to get stm32 write algorithm to work. Fallback
flash write does work. Haven't found a version of openocd trunk
where this works.
- added target_free_all_working_areas_restore() which can
let be of restoring backups. This is needed when asserting
reset as the target must be assumed to be an unknown state.
Added some comments to working areas API
- str9 reset script fixes
- some guidelines
- fixed dangling callbacks upon reset timeout 


git-svn-id: svn://svn.berlios.de/openocd/trunk@536 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-03 14:00:17 +00:00
oharboe
b174a5b6a3 optional count argument to mwX
git-svn-id: svn://svn.berlios.de/openocd/trunk@532 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-02 06:21:24 +00:00
oharboe
86d3e74464 target_call_timer_callbacks_now() now invokes periodic callbacks immediately
git-svn-id: svn://svn.berlios.de/openocd/trunk@529 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-31 19:34:01 +00:00
ntfreak
d47e1b8f36 - rename log functions to stop conflicts under win32 (wingdi)
git-svn-id: svn://svn.berlios.de/openocd/trunk@523 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-25 15:45:17 +00:00
ntfreak
4622cb15a9 - armv7m control register now set as dirty when switching context
- armv7m added core_mode to cortex_m3_debug_entry DEBUG msg
- cortex_m3 changed WARNINGS to DEBUG msg in cortex_m3_resume

git-svn-id: svn://svn.berlios.de/openocd/trunk@519 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-21 12:53:29 +00:00
oharboe
3b2a068ea9 added profile command. It was added to simplify evaluation by testers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@516 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-14 11:20:46 +00:00
oharboe
7de7bc80fc - adds two speeds to jtag_speed. reset and post reset speed. Default
is post reset = reset speed.
- removed infinite loop's and exit()'s upon poor arm7/9 communication
- cleaned up error messages a bit. Push ERROR() up into fn's that
  fail and can say something meaningful about what failed.


git-svn-id: svn://svn.berlios.de/openocd/trunk@511 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-13 10:14:41 +00:00
oharboe
0424155dfc - Fixed various error handling when looking for memory leaks
- Fixed memory leak in gdb_server.c
- pushed "Error:" statements up into fn's that know something about what went wrong
- load_image now fails if target_write_memory() fails
- only issue an asynchronous halt() upon connect of GDB. Synchronous halt/reset
  doesn't really work as what's required to initialize the target might involve a
  special monitor sequence for the target in question
- syntax error handling improved(fewer exit()'s)


git-svn-id: svn://svn.berlios.de/openocd/trunk@482 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-10 12:11:07 +00:00
oharboe
c78b4fe426 - Improves error handling upon GDB connect
- switch to synchronous halt during connect. This fixes the bug
  where poll() was not invoked between halt() and servicing the
  'g' register packet
- halt() no longer returns error code when target is already halted, just
  logs a warning. Only the halt() implementation can say anything
  meaningful about why a halt() failed, so error messages are pushed
  up to halt()
- fixed soft_reset_halt infinite loop bug in arm7_9_common.c. The rest
  of the implementations are still busted.
- by using USER() instead of command_print() the log gets the 
  source + line #. Nice.
- no longer invoke exit() if soft_reset_halt fails. A reset can often 
  fix the problem.

git-svn-id: svn://svn.berlios.de/openocd/trunk@475 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-07 21:49:16 +00:00