Commit Graph

293 Commits

Author SHA1 Message Date
Zachary T Welch
73c6e3bb18 change command_find helper interface
Avoid requiring double pointers where a single would suffice.
2009-11-20 14:52:56 -08:00
Zachary T Welch
67c29d9935 factor script_command argv allocation
Splits argument allocation out from script command, reusing free() code.
2009-11-20 14:52:56 -08:00
Zachary T Welch
c0d14dc7f1 remove fast command and jim_global_long
Removing the fast command eliminates the fast_and_dangerous global,
which was used only by arm7_9_common as an initializer.  The command
is not called in the tree; instead, more explicit commands are used.

The jim_global_long function was not used anywhere in the tree.
2009-11-18 15:51:07 -08:00
Zachary T Welch
4d8d1d32d0 change all bool parsers to accept any value
This patch changes the behavior of all boolean parsing callers to
accept any one of "true/enable/on/yes/1" or "false/disable/off/no/0".

Since one particular pair will be most appropriate in any given
situation, the specific macros should continue to be used in
order to display the most informative error messages possible.
2009-11-18 15:51:07 -08:00
Zachary T Welch
7e4adfe1c5 add handle_command_parse_bool command helper
Rewrite arm11_handle_bool to provide a generic on/off command helper.

Refactors COMMAND_PARSE_BOOL to use new command_parse_bool helper,
which gets reused by the new command_parse_bool_any helper.
This later helper is called by the new command helper function to
accepts any on/off, enable/disable, true/false, yes/no, or 0/1 parameter.
2009-11-18 15:51:07 -08:00
Zachary T Welch
5e229bbf87 pass startup_tcl to command_init
Removes external linkage from helper module, making the startup
code a parameter to a new command context's initialization routine.
2009-11-18 07:22:22 -08:00
Zachary T Welch
cfaf7bdd0a remove unused variable from run_command 2009-11-17 11:40:21 -08:00
Zachary T Welch
cffc98ad80 add CMD_NAME variable in command_invocation
Update CMD_NAME from its migratory home in CMD_ARGV[-1] to cmd->name.
Allows CMD_ARGV++ idiom to be used safely in command handlers.
2009-11-17 11:40:21 -08:00
Zachary T Welch
be084414ba add struct command_invocation for COMMAND_HANDLER
Adds the command_invocation structure to encapsulate parameters for
all COMMAND_HANDLER routines.  Rather than passing several arguments
to each successive subroutine, a single pointer may be passed around.

Changes the CMD_* macros to reference the new fields.

Updates run_command to create an instance and pass it to the handler.
2009-11-17 11:40:21 -08:00
Zachary T Welch
23402315ce command_handler: change 'args' to CMD_ARGV
This patch converts all instances of 'args' in COMMAND_HANDLER routines
to use CMD_ARGV macro.
2009-11-17 11:38:07 -08:00
Zachary T Welch
7bf1a86e47 command_handler: change to 'argc' to CMD_ARGC
This patch converts all instances of 'argc' in COMMAND_HANDLER routines
to use CMD_ARGC.
2009-11-17 11:38:06 -08:00
Zachary T Welch
df9b12695f use Jim_CmdProc in jim_register
The jim_register command just needed to use the type defined by jim.h.
2009-11-16 15:47:08 -08:00
Zachary T Welch
ef746e27c5 command_t -> struct command
Remove misleading typedef and redundant suffix from struct command.
2009-11-13 13:30:50 -08:00
Zachary T Welch
98723c4ecd command_context_t -> struct command_context
Remove misleading typedef and redundant suffix from struct command_context.
2009-11-13 13:25:47 -08:00
Zachary T Welch
f973320cbb command_handler_t: make cmd an indirect parameter
This patch removes 'cmd' from the list of direct parameters, moving
that pointer to args[-1] (by way of the new CMD_NAME macro).
2009-11-13 10:56:55 -08:00
Zachary T Welch
deede35c27 command_handler_t: make args parameter const
This patch prevents command handlers from modifying the strings passed
in the 'args' array.
2009-11-13 10:55:27 -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
ddb6138ed4 add command_handler_t type
This patch adds new typedefs for command handler callback functions.
Users of this type signature were updated to use these new types.
It uses the new __COMMAND_HANDLER macro to prevent duplication.
2009-11-13 10:51:45 -08:00
Zachary T Welch
1ae4d93c3c add command_output_handler_t
Add a typedef for command output handler function type, simplifying
the appearance of functions that use it and eliminating duplicate code.
2009-11-13 10:51:45 -08:00
Zachary T Welch
158698e333 improve command registration
Eliminate duplicate code for linking commands into a list.

Adds a check to ensure the command does not already exist;
if it does, return that one instead of creating a duplicate.
2009-11-11 13:50:28 -08:00
Zachary T Welch
46d9ba4c8b add help regardless of callback
Add help for commands regardless of whether a handler is involved.
With this, all sorts of new commands can be found in 'help' text.
Hopefully, all of them have been documented....

Sadly, the lsort function appears to handle nested lists poorly, such
that sub-commands do not group with their parents.
2009-11-11 12:15:39 -08:00
Zachary T Welch
a1a3ee579c eliminate duplicate helptext management
Add helpers to manage adding entries to the helptext list.
Adds support for arbitrarily nested commands.
2009-11-11 12:15:39 -08:00
Zachary T Welch
2d3cc1eac1 add command_name helper
The command_name function returns a malloced string for a given
command and its parents.  This can be used to display a message
to the user, but it is used internally to handle registration
and syntax errors.  This helps permit arbitrary command nesting.
2009-11-11 12:15:39 -08:00
Zachary T Welch
e09d8938f5 script_debug(): improve types
Use unsigned type for number of arguments.
2009-11-11 05:40:48 -08:00
Zachary T Welch
c942969377 command.c: make private routines static
This patch also improves the signature of run_command function.
2009-11-11 05:40:48 -08:00
Zachary T Welch
6a2e83c017 log: improve log_callback_fn signature
Use unsigned type for line number in log_callback_fn signature.
2009-11-11 05:40:48 -08:00
Øyvind Harboe
151a270695 tcl: HostOs now picks up eCos as well during compile time
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2009-11-10 08:36:19 +01:00
Zachary T Welch
841721929a command.c: make commands static
Removes useless declarations, moving the handler functions to appear
before their use in the (much bigger) command registriation function.
2009-11-09 21:39:46 -08:00
David Brownell
4882647f3e User's Guide: bugfix global state info
The "$ocd_HOSTOS" variable was wrongly documented.  Fix its
documentation, and its value on Linux.

Shrink a few of the too-long lines.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
2009-11-09 09:40:55 -08:00
oharboe
4b9bdd664a David Brownell <david-b@pacbell.net> Be sure the built-in search paths always go *after* ones provided
on the command line ... matching comment in add_default_dirs().

Without this it's impossible to use a private config file which
happens to have the same name as an installed one.  Say, because
you're bugfixing a private copy...

git-svn-id: svn://svn.berlios.de/openocd/trunk@2649 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-30 17:27:50 +00:00
oharboe
bf5f21e39a Steve Grubb <sgrubb@redhat.com> fix various and sundry leaks
git-svn-id: svn://svn.berlios.de/openocd/trunk@2606 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-08-24 07:53:46 +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
5fe4500e50 try to use tabs instead of spaces
git-svn-id: svn://svn.berlios.de/openocd/trunk@2465 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 08:01:22 +00:00
oharboe
fca8cddc26 human readable error message upon invalid arguments
git-svn-id: svn://svn.berlios.de/openocd/trunk@2464 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-07-06 07:33:38 +00:00
zwelch
c97caebccd Remove whitespace at end of lines, step 2.
- Replace '\s*$' with ''.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2380 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-23 22:50:08 +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
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
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
2d0afa36a8 Ensure range errors are reported only when errno indicates one occurred.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2260 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:31:06 +00:00
zwelch
c0f4495d5e Change parse_type macros to be sed-friendly.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2259 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:52 +00:00
zwelch
d579befc07 Add argument parsing errors in command.h, use in parse_type routines.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2258 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:44 +00:00
zwelch
0e28997989 Move definition of parse_type helpers to command.c:
- Add declarations in header file.
- Improve wrapper implementations to check for underflow.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2257 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:36 +00:00
zwelch
06a1bb335e Convert core parse_type implementations to check for underflow errors.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2256 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:29 +00:00
zwelch
a830197f59 Add improved support for parsing signed integers.
git-svn-id: svn://svn.berlios.de/openocd/trunk@2255 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:30:20 +00:00
zwelch
8b16068941 Improve definitions of parse_ulong and parse_ullong:
- Use macro to eliminate duplicate body definitions.
- Rename okay as is_okay; add parenthesis to help "clarify" logic.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2253 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-17 00:29:56 +00:00
zwelch
cdd8f23b9b David Brownell <david-b@pacbell.net>:
Currently the "debug_level 3" command tracing ignores commands
that could return values to TCL scripts (by plugging in to a
slightly lower level of the interpreter stack).

Fix that by abstracting the tracing command and starting to
make some of those previously-untraced commands use this new
mechanism.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2224 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 22:06:02 +00:00
zwelch
5af1bdcff4 Simplify handle_sleep_command:
- Use new parse_ulong to ensure duration parses as a valid number.
- Rework logic to improve readability and seliminate uperfluous braces.
- Change whitespace to improve style.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2207 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:39:51 +00:00
zwelch
5c123481a1 Add new parse_uinttype wrappers for strtoul in src/helper/command.[ch].
- Used to improve command argument parsing of unsigned integers values.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2206 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-12 01:39:44 +00:00
zwelch
5bb0f1d29a David Brownell <david-b@pacbell.net>:
Minor bugfix:  command_print_sameline() is what the
headers declare; make the code match.

Minor improvement:  make the printf format params always be const.


git-svn-id: svn://svn.berlios.de/openocd/trunk@2205 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-06-11 21:55:43 +00:00
zwelch
2e55b68360 David Brownell <david-b@pacbell.net>:
The "Illegal mode for command" diagnostic is deeply useless.
Say "Command '%s' only runs during configuration stage" instead,
letting users know what the real issue is.


git-svn-id: svn://svn.berlios.de/openocd/trunk@1908 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-24 20:57:53 +00:00
oharboe
a8daf2251d Remove unecessary(and poptentially harmful?) "" around arguments
passed in to "eval" in command.c


git-svn-id: svn://svn.berlios.de/openocd/trunk@1811 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-18 13:55:38 +00:00
oharboe
4dcd58724a Less wrong handling of JIM_EMBEDDED, follow Jim Tcl doc's and only use JIM_EMBEDDED in a single .c file. Still broken w/-fno-common(i.e. Mac OS).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1794 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-15 20:35:53 +00:00
zwelch
8a5b25790f Audit and eliminate redundant helper #include directives.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1706 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-11 03:59:02 +00:00
oharboe
a83583e926 remove extra newline before prompt
git-svn-id: svn://svn.berlios.de/openocd/trunk@1605 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-05 12:06:26 +00:00
oharboe
1f378efbf0 Mariano Alvira <mar@devl.org> fixes warning as error about a signed vs. unsigned comparison by casting the local unsigned variable as (long long).
git-svn-id: svn://svn.berlios.de/openocd/trunk@1600 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-05-04 11:03:40 +00:00
duane
7a731eb637 Added HostOS variable
git-svn-id: svn://svn.berlios.de/openocd/trunk@1400 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2009-03-07 15:19:21 +00:00
oharboe
498c87bf02 fix broken -c/f options where it would silently terminate for scripts that did not set the return value.
git-svn-id: svn://svn.berlios.de/openocd/trunk@1246 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-16 10:22:24 +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
ntfreak
00b3eb5fed - fix illegal memory access in unregister_command function
git-svn-id: svn://svn.berlios.de/openocd/trunk@1224 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-12-10 17:47:16 +00:00
oharboe
6e2e706d7e friendlier error messages
git-svn-id: svn://svn.berlios.de/openocd/trunk@1185 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-26 13:42:02 +00:00
oharboe
ded28546f8 Fixes (more or less) random SEGFAULT upon invoking script_command().
git-svn-id: svn://svn.berlios.de/openocd/trunk@1156 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-11-11 14:47:01 +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
c2120ba28a Added telnet_async command to enable/disable asynchronous
messages.

git-svn-id: svn://svn.berlios.de/openocd/trunk@1117 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-31 13:40:02 +00:00
oharboe
358b472ab8 sleep command now prints out target debugmsgs w/anything like usable performance
git-svn-id: svn://svn.berlios.de/openocd/trunk@1076 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-16 19:44:05 +00:00
oharboe
cd9e0e3115 added capture command to capture log output. Useful when wanting to capture log output from tcl procedures that invoke openocd commands
git-svn-id: svn://svn.berlios.de/openocd/trunk@1069 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-16 12:21:02 +00:00
oharboe
d798871a99 added busy sleep (for testing purposes)
git-svn-id: svn://svn.berlios.de/openocd/trunk@1033 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-10-09 08:08:29 +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
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
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
000f17c137 use alive_sleep() from sleep command
git-svn-id: svn://svn.berlios.de/openocd/trunk@939 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-19 12:18:00 +00:00
oharboe
835cfb82c9 Johannes Stezenbach <js@sig21.net> fix warnings
git-svn-id: svn://svn.berlios.de/openocd/trunk@929 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-18 18:27:09 +00:00
oharboe
1ee637287e fix error output a bit: do not repeat output printed during execution in case of error.
git-svn-id: svn://svn.berlios.de/openocd/trunk@905 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-11 10:30:36 +00:00
oharboe
7e02ebfd62 place event loop inside #ifdef JIM_EMBEDDED.
git-svn-id: svn://svn.berlios.de/openocd/trunk@903 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-11 08:27:04 +00:00
oharboe
c76b0618d7 David Kuehling <dvdkhlng@gmx.de> - added jim-eventloop.c
git-svn-id: svn://svn.berlios.de/openocd/trunk@898 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-08-07 16:37:20 +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
1ac48e7500 OpenOCD commands w/prefix ocd_ now set the primary Tcl return value instead of messing with ocd_output local variable. Much more straightforward and expected behaviour. The side effect is that the ocd_xxx commands will print output twice(once immediately and once upon completion of command). This is a strange, expected and intentional behaviour.
git-svn-id: svn://svn.berlios.de/openocd/trunk@871 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-24 20:46:15 +00:00
oharboe
74eb754abc more error message cleanup. invalid args & syntax errors both now print arguments of command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@870 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-24 14:50:41 +00:00
oharboe
91a16a3810 Better handling of OpenOCD command invocation result/context.
git-svn-id: svn://svn.berlios.de/openocd/trunk@866 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-24 10:16:44 +00:00
oharboe
2637bbccaf handle end of line comments to improve compatibility with event scripts
git-svn-id: svn://svn.berlios.de/openocd/trunk@860 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-23 16:04:45 +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
310300261b This allows overriding builtin openocd commands.
git-svn-id: svn://svn.berlios.de/openocd/trunk@834 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-18 16:25:15 +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
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
oharboe
0ebb33b185 Charles Hardin ckhardin at gmail.com Instead of stashing the context in a global variable, just use the "context"
associated with the interp structure being passed around

And fixed the message referring to mem2array in the array2mem function


git-svn-id: svn://svn.berlios.de/openocd/trunk@821 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-17 17:31:07 +00:00
oharboe
5fefa83d07 Collect output from openocd commands into openocd_output local variable
git-svn-id: svn://svn.berlios.de/openocd/trunk@820 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-17 12:02:55 +00:00
oharboe
44928321e6 Charles Hardin <ckhardin@gmail.com> and Øyvind Harboe
This patch just uses the command.c interface to create tcl commands for the root level commands and avoids a bit of the "TCL" bleed into the rest of the openocd code.

Multilevel commands also supported.


git-svn-id: svn://svn.berlios.de/openocd/trunk@818 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-17 08:34:14 +00:00
oharboe
d0eef63f68 print syntax for command upon syntax error.
git-svn-id: svn://svn.berlios.de/openocd/trunk@811 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-16 08:49:05 +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
oharboe
173a43ff15 help is now implemented in startup.tcl/help
git-svn-id: svn://svn.berlios.de/openocd/trunk@797 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-11 19:30:54 +00:00
oharboe
69c6f1f7ea work in progress to improve help
git-svn-id: svn://svn.berlios.de/openocd/trunk@792 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-11 15:07:58 +00:00
oharboe
c5b718f5e8 - retired variable stuff.
- drscan is now a low level tcl command:
 execute DR scan <device> <num_bits> <value> <num_bits1> <value2> 
- removed obsolete partial command text support

git-svn-id: svn://svn.berlios.de/openocd/trunk@791 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-11 12:17:56 +00:00
oharboe
381f9a2e8a .cfg files are now executed as Jim Tcl. Commands that terminate script w/error message.
git-svn-id: svn://svn.berlios.de/openocd/trunk@790 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-11 09:06:36 +00:00
oharboe
66410d2537 "flash banks" is now implemented in Tcl on top of "flash_banks". openocd_throw prefix is no longer required when executing OpenOCD commands from tcl.
git-svn-id: svn://svn.berlios.de/openocd/trunk@779 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-09 15:22:05 +00:00
ntfreak
994396da59 - command_run_line will only search once for the command, and execute if found
git-svn-id: svn://svn.berlios.de/openocd/trunk@766 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-07 12:19:17 +00:00
ntfreak
97c4be68a0 - fix duplicate log entry
git-svn-id: svn://svn.berlios.de/openocd/trunk@762 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-06 23:49:05 +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
0bb7c9d109 fix a few compilation problems.
git-svn-id: svn://svn.berlios.de/openocd/trunk@758 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-06 19:56:15 +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
71460ba9a5 - added search for libdl
- Thanks Charles Hardin

git-svn-id: svn://svn.berlios.de/openocd/trunk@754 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-05 09:57:19 +00:00
oharboe
269c6d8385 utility fn.
git-svn-id: svn://svn.berlios.de/openocd/trunk@742 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-07-04 07:21:31 +00:00
oharboe
b754eac35a hooks to enable experimentation with scripting language support. Reduces patch size, but has no effect on OpenOCD otherwise.
git-svn-id: svn://svn.berlios.de/openocd/trunk@733 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-06-27 06:58:45 +00:00
oharboe
d52d7f69be GDB timeout fix. If a script takes a long time and does not produce any output, ping between every command.
git-svn-id: svn://svn.berlios.de/openocd/trunk@710 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-06-16 18:40:31 +00:00
ntfreak
3642616171 - remove error message on shutdown
git-svn-id: svn://svn.berlios.de/openocd/trunk@672 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-21 19:23:35 +00:00
oharboe
a197e759ff Edgar Grimberg plugged a leak found w/Valgrind.
git-svn-id: svn://svn.berlios.de/openocd/trunk@646 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-05-07 12:15:19 +00:00
oharboe
6510be8b8b added fast option.
git-svn-id: svn://svn.berlios.de/openocd/trunk@604 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-23 05:42:42 +00:00
oharboe
2b16509675 stop using variable sized arrays. That's something that belongs to C++ and not C.
git-svn-id: svn://svn.berlios.de/openocd/trunk@560 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-10 19:44:56 +00:00
oharboe
2585fc3420 Don Porges fixed c99 issues.
git-svn-id: svn://svn.berlios.de/openocd/trunk@553 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-04-09 05:55:23 +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
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
oharboe
d9ac6b1d09 alloc_printf and alloc_vprintf
git-svn-id: svn://svn.berlios.de/openocd/trunk@465 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-07 10:55:59 +00:00
oharboe
6d95014674 * fixed malloc corruption in target->debug_reason
* GDB remote server will now remain online even if the target
	  is in a funny state, e.g. if it requires a reset, it is
	  running while GDB is not in the continue or step packet,
	  e.g. via monitor resume/halt commands in GDB script.
	* Added some _DEBUG_GDB_IO_ debug tools
	* Fixed a couple of GDB server lockups, e.g. when O packets
	  detect a severed connection
	* added ACK upon connection (send +).
	* added keep-alive messages to reset so GDB protocol remains happy.
	* fixed crash when timing out connection to GDB

git-svn-id: svn://svn.berlios.de/openocd/trunk@445 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-03-05 10:28:32 +00:00
oharboe
67e0aea258 Summary: passing of variable argument list reduced, strings sent to logging are now formatted just once - more efficient.
As a result, ugly string malloc+strcpy are not needed anymore.


git-svn-id: svn://svn.berlios.de/openocd/trunk@386 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-29 11:16:38 +00:00
oharboe
881dddd84f Michael Bruck:
- fix indentation of multi-level commands
- make help command work with multi-level commands

git-svn-id: svn://svn.berlios.de/openocd/trunk@384 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-29 07:01:43 +00:00
oharboe
0689e3dd67 - Added TARGET_REQ_DEBUGCHAR target_request debugmsg. This
provides a better impeadance match for debug output char fn's, e.g. eCos.
- Line endings are now added at the caller site of command_print*(). command_print()
  still adds a line ending
- echo of commands in scripts are now available via debug_level instead of
  forced echo
- Added a USER_SAMELINE() for printing without a lineend.


git-svn-id: svn://svn.berlios.de/openocd/trunk@364 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-28 08:11:18 +00:00
drath
3d6bcf0792 - convert all files to unix line-ending
git-svn-id: svn://svn.berlios.de/openocd/trunk@347 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-25 17:48:04 +00:00
oharboe
7f1944a478 Pavel Chromy
- multiple log listeners
- added OUTPUT() to replace printf
- fix formatting

git-svn-id: svn://svn.berlios.de/openocd/trunk@346 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-25 17:32:53 +00:00
oharboe
b9bdac0251 - added time command
- changed syntax of time measurements to seconds, e.g. 1.2324s

git-svn-id: svn://svn.berlios.de/openocd/trunk@321 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-23 08:24:59 +00:00
ntfreak
5c0e8efa05 - Fixed bug in pathmove for XScale
- added virtual address to working_area.
- Improved error messages in a number of places
- Added ERROR_COMMAND_SYNTAX_ERROR that commands can return to have syntax printed
- Added help for some config commands
- Added verification of sw breakpoints with ERROR() message
- Removed a couple of exit()'s and replaced with error message
- cosmetic fix to armv4_5.c, easier to read
- added polymorphic(with default) virt2phys and mmu enable query function to target.h
- added virt2phys command that uses target->type->virt2phys() fn
Thanks to Øyvind Harboe

git-svn-id: svn://svn.berlios.de/openocd/trunk@310 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-19 19:26:17 +00:00
ntfreak
f2a5a1ce81 - arg list now correctly released on error. Thanks Øyvind Harboe
git-svn-id: svn://svn.berlios.de/openocd/trunk@306 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-18 16:54:18 +00:00
ntfreak
e7084a0c87 - fix broken JTAG error handling
- Allow all commands to be executed during config stage
- Help now works for config commands
- make var args handling follow the rules more closely
Thanks Øyvind Harboe

git-svn-id: svn://svn.berlios.de/openocd/trunk@305 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-18 15:41:38 +00:00
mifi
2a0317e6f4 - added patch to Improving progress/error output for telnet & GDB monitor
(thanks to Øyvind for the patch)

git-svn-id: svn://svn.berlios.de/openocd/trunk@293 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-02-13 19:02:17 +00:00
ntfreak
5eedf3e1ce - added faster gdb packet handling (thanks to oyvind harboe for the patch)
- code reformat

git-svn-id: svn://svn.berlios.de/openocd/trunk@251 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-01-10 19:29:52 +00:00
mifi
64aac5f7e1 - added patch for faster start of OpenOCD
(thanks to oyvind harboe for the patch)

git-svn-id: svn://svn.berlios.de/openocd/trunk@250 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2008-01-10 19:10:55 +00:00
ntfreak
6c9b804d61 - minimum autoconf 2.59 is now required and verified - due to issues with AS_HELP_STRING
- native win32 now handles WSAECONNRESET - no longer exits openocd
- qCRC packet now works correctly under cygwin (gdb compare-sections command)
- removed __USE_GNU define from gdbserver.c
- gdb qSupported packet is now handled, with this we are able to tell gdb packet size, memory map of target
- added new target script gdb_program_config - called before gdb flash programming
- new gdb server command gdb_memory_map (enable|disable> - default is disable
- new gdb server command gdb_flash_program (enable|disable> - default is disable
- gdb flash programming supported - vFlash packets
- image_elf_read_section now does not clear any remaining data, this was causing the gdb checksum to fail with certain files
- reformat of usbprog.c
- memory leak in command_print fixed
- updated texi doc to include new commands
- added gdb programming section to docs

git-svn-id: svn://svn.berlios.de/openocd/trunk@246 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-12-29 13:51:48 +00:00
mifi
02f3765351 - added patch for new flash functionality like:
flash verify_image and flash erase_address.
- added patch for new parport_write_on_exit command.
Even this patch will fix some memory leaks.

(thanks too oyvind and Spen for these patches)

git-svn-id: svn://svn.berlios.de/openocd/trunk@240 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-12-18 21:20:28 +00:00
mifi
9c999216b1 - Fixing two compiler warnings
- Reducing  stack usage for recursive scripts
- Do not exit on bogus arguments to reset_config. No longer exit the application upon bogus arguments to reset_config, but return errors.

thanks to Øyvind Harboe for these patches.

git-svn-id: svn://svn.berlios.de/openocd/trunk@226 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-12-10 19:46:04 +00:00
drath
22bc5194ae - added support for error handlers to JTAG scan commands (jtag_[plain_][ir|dr]_scan)
- catch apparently broken JTAG IR scan after ARM926EJ-S CP15 operations
- added "arm7_9 dump_etb" command


git-svn-id: svn://svn.berlios.de/openocd/trunk@142 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-04-25 20:15:59 +00:00
drath
5ed126c4f9 - fixed arm926 cp15 command bug (thanks to Vincent Palatin for this patch)
- fixed compiler warnings throughout the code (thanks to Vincent Palatin for this patch)
- added support for accessing ETB (embedded trace buffer) registers


git-svn-id: svn://svn.berlios.de/openocd/trunk@134 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-03-26 21:47:26 +00:00
drath
4fc97d3f27 - fix incorrect parsing of whitespace in command.c (thanks to Magnus Lundin)
- fix infinite recursion in target_init_handler (thanks to jw and Magnus Lundin)
- fix CFI flash handlign with buswidth < 32bit (thanks to Daniele Orio for reporting this)
- add support for reading JTAG device id (currently only as debug output on startup)
- cleaned up handling of EmbeddedICE registers. Supported functionality and register size now determined by EmbeddedICE version number.
- small cleanups/fixes


git-svn-id: svn://svn.berlios.de/openocd/trunk@124 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2007-01-22 14:47:00 +00:00
drath
83440065c0 - correctly enter debug state on a "soft_reset_halt" command
- several small fixes
- retry reading from a FT2232 device on incomplete reads


git-svn-id: svn://svn.berlios.de/openocd/trunk@110 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2006-11-05 17:38:35 +00:00
drath
82d2633b5f - Added support for native MinGW builds (thanks to Spencer Oliver and Michael Fischer) - you still need to install GiveIO (not part of OpenOCD)
- Added state-move support to ftd2xx and bitbang JTAG drivers (required for XScale, possibly useful for other targets, too)
- various fixes


git-svn-id: svn://svn.berlios.de/openocd/trunk@78 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2006-07-17 14:13:27 +00:00
drath
b9628accd6 - the 'help' command now takes an optional argument to display help only on a certain command (thanks to Andrew Dyer for this enhancement)
- OpenOCD now includes the ability to diassemble instructions on its own (only ARM for now, Thumb might follow). 
The command is "armv4_5 disassemble <address> <count> ['thumb']" (thumb is currently unsupported).
I've compared the produced disassembly against GDB/GNU Objdump output, and it seems to be correct, but there may still be some bugs left.


git-svn-id: svn://svn.berlios.de/openocd/trunk@68 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2006-06-12 16:49:49 +00:00
drath
335f667d44 - fixed some spelling errors (thanks to Andrew Dyer)
git-svn-id: svn://svn.berlios.de/openocd/trunk@67 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2006-06-05 14:36:39 +00:00
drath
8b4e882a16 - prepare OpenOCD for branching, created ./trunk/
git-svn-id: svn://svn.berlios.de/openocd/trunk@64 b42882b7-edfa-0310-969c-e2dbd0fdcd60
2006-06-02 10:36:31 +00:00