1. 01 Dec, 2009 11 commits
    • Zachary T Welch's avatar
      do not extern 'interp' from command.c · 7b2906de
      Zachary T Welch authored
      Adds 'interp' field to command_context, chasing the few remaining
      references to the global variable outside of the command module.
      7b2906de
    • Zachary T Welch's avatar
      target: avoid using interp global variable · 8e8a359a
      Zachary T Welch authored
      Adds 'interp' to target_event_action structure to avoid using the
      global variable of the same name.
      8e8a359a
    • Zachary T Welch's avatar
      jtag: avoid using interp global variable · e1ee2702
      Zachary T Welch authored
      Adds 'interp' field to jtag_tap_event_action structure to avoid
      using the global variable of same name.
      e1ee2702
    • Zachary T Welch's avatar
      fix foo command group help messages · be65f497
      Zachary T Welch authored
      Splits the old help strings to provide proper usage as well.
      be65f497
    • Zachary T Welch's avatar
      make syntax errors respond with 'usage' · 5dd6457d
      Zachary T Welch authored
      The 'help' text will become more verbose, so its entire text will be
      far more than desired when you only borked your syntax.  The usage
      still allows the commands to be looked up for more help.
      5dd6457d
    • Zachary T Welch's avatar
      move improperly located documentation · 3d204ec6
      Zachary T Welch authored
      Somehow, the comment block for command handlers ended up associated
      with the output_handler.  Move it to the command_handler_t declaration.
      3d204ec6
    • Zachary T Welch's avatar
      improve command_done() API and docs · bc9ae740
      Zachary T Welch authored
      command_done() does not need to return an error, but it needed
      Doxygen comment.  Provide some for copy_command_context as well.
      
      Note: this audit revealed some potential bugs with the command context
      implementation.  There was a reason that commands were added at the
      end of the list.  Shallow copying of command_context means that
      the list is shared between them.  And commands added at the top-level
      before the pre-existing commands will not be available in the shared
      context as they were before.  Yikes!
      
      Fortunately, this does not seem to occur in general use, as
      'add_help_text' gets registered in startup.tcl and claims the first slot
      in my own test cases.  Thus, it seems that we have been masking the issue
      for now, but it shows the need for further architectural improvement in
      the core command module.
      bc9ae740
    • Zachary T Welch's avatar
      only display usable commands in help · c0630d8a
      Zachary T Welch authored
      With the ability to defer 'init', users can access the help system while
      still in CONFIG mode.  This patch omits commands from the help and usage
      list when they cannot be run in the current command mode, making it much
      easier to see what can be done at a given time.
      c0630d8a
    • Zachary T Welch's avatar
      allow deferal of init · cee1f39f
      Zachary T Welch authored
      Adds 'noinit' command to prevent OpenOCD from running 'init' at the end
      up startup, allowing it to be given from telnet or TCL.  This provides
      the old behavior by default, and users can add this command to their
      scripts to get the new behavior.
      cee1f39f
    • Zachary T Welch's avatar
      move server_init() to openocd_main() · 64653b0b
      Zachary T Welch authored
      Moves the telnet and TCL server startup to server_init(), moving their
      respective command registration in to server_register_commands().
      Adds proper error checking for these particular startup processes.
      
      Moves the core server startup to openocd_main(), improving related error
      checking and preparing to defer 'init'.
      64653b0b
    • Zachary T Welch's avatar
      improve gdb_init() sequence · ec6c1962
      Zachary T Welch authored
      Rework gdb_init to create flexible APIs (gdb_target_add_{one,all}) and
      static helper (gdb_target_start) for starting GDB services.  Eliminates
      duplicated code and provides general mechanisms for adding GDB services.
      The 'init' command is updated to call the new API, and later patches can
      decouple its policy of adding all targets therein.
      
      Provides the new capability to use both piped and TCP servers when
      multiple targets are defined.  The first target fills the pipe, and
      others will be started on TCP ports (unless disabled, i.e. gdb_port=0).
      ec6c1962
  2. 30 Nov, 2009 1 commit
  3. 29 Nov, 2009 7 commits
  4. 28 Nov, 2009 21 commits
    • lementec fabien's avatar
      fix s3c24xx device command helper · b0858e89
      lementec fabien authored
      Returns the common structure for the s3c24xx device, which was
      somehow nuked during past cleaning efforts.
      b0858e89
    • David Brownell's avatar
      Cortex-M3: don't chain "struct arm" commands · a398c85d
      David Brownell authored
      
      
      Those commands presume support for the "classic" set of CPU
      modes (FIQ, supervisor, IRQ, etc) ... which aren't supported
      by the ARMv7-M or ARMv6-M architectures.  They also presume
      a "struct arm" base type, which this code doesn't use.
      
      We haven't cleaned up the register handling enough to be able
      to share any of those "base" methods.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      a398c85d
    • Zachary T Welch's avatar
      add 'nonce' nand driver · 01f93137
      Zachary T Welch authored
      The nonce NAND driver provides a no-op implementation useful for
      testing the system independently of any driver side-effects.
      01f93137
    • Zachary T Welch's avatar
      add more stub handlers to testee target · cdfdcb28
      Zachary T Welch authored
      Prevent everything from crashing when exercising various commands.
      cdfdcb28
    • Zachary T Welch's avatar
      explode tcl_target_func into many handlers · 070259ca
      Zachary T Welch authored
      Eliminate the monolithic tcl_target_func by registering each of its
      commands using the new chained command registration mechanism.
      
      Also chains the target's commands under the CPU command, though these
      may not work properly without some further modification.
      070259ca
    • Zachary T Welch's avatar
      split jim_target into multiple handlers · cb8d567b
      Zachary T Welch authored
      The 'target' command group was implemented using its own command
      dispatching, which can be eliminated by using the new chained command
      registration mechanism.  This patch splits the jim_target() function
      into individual handlers, which makes them to be visible to the help and
      usage commands.  These one-trick handlers are much easier to understand.
      cb8d567b
    • Zachary T Welch's avatar
      split jim_newtap_cmd into pieces · f8a62fb9
      Zachary T Welch authored
      Moves the ID and IR-related option parsing to static helpers, removing
      two levels of indent.
      f8a62fb9
    • Zachary T Welch's avatar
      improve jtag_tap_configure · 7124be82
      Zachary T Welch authored
      Splits bulk of the jtag_tap_configure into jtag_tap_configure_event,
      removing three or four levels of indentation in the process.
      The resulting code was stylistically improved in other ways, but it
      should be functionally identical.
      7124be82
    • Zachary T Welch's avatar
      improve jtag_tap_handle_event indentation · 4ff5eda5
      Zachary T Welch authored
      Use 'continue' to reduce identation levels and superfluous logic.
      4ff5eda5
    • Zachary T Welch's avatar
      begin moving JTAG jim handlers/helpers · 0377e5b5
      Zachary T Welch authored
      Moves the tertiary jim handlers and required static helpers to the top
      of tcl.c, defining them in a new registration array that is chained in
      both the top-level context and under the jtag command.  The top-level
      commands can be removed at some point in the future to reduce clutter.
      0377e5b5
    • Zachary T Welch's avatar
      split jim_jtag_command into multiple handlers · c4992c6d
      Zachary T Welch authored
      Explodes the 'jtag' into separate command handlers, which are easier
      to understand and extend.  Makes the code much easier to understand,
      though further simplifications are possible.  This patch tries to
      minimize the noise when viewed with 'git diff -w'.
      
      Gives these commands improved built-in help and usage information.
      c4992c6d
    • Zachary T Welch's avatar
      remove redundant 'rm' command handler · 2da28646
      Zachary T Welch authored
      Two 'rm' commands were implemented and registered.  This removes the
      version that would have never been called prior to refactoring the
      command registration.
      2da28646
    • Zachary T Welch's avatar
      add error checking in command_new · 8795b8f9
      Zachary T Welch authored
      Adds checks for memory allocation failures.  Started to use calloc()
      instead of malloc()/memset(), but I got carried away.  This kind of work
      should be done throughout the tree, but it's almost hopeless at present.
      8795b8f9
    • Zachary T Welch's avatar
      include mode information in help text. · 42e00bb3
      Zachary T Welch authored
      Extends the help output to list the valid modes for each commands.
      Fixes a memory leak of the returned command_name() string.
      42e00bb3
    • Zachary T Welch's avatar
      refactor command mode detection · fd343bea
      Zachary T Welch authored
      Splits the check for a command's ability to run into a helper.
      
      This also fixes a bug whereby commands that specified COMMAND_EXEC
      were allowed to run during the configuration stage.  This allowed
      problematic commands to be called before 'init', defeating the intention
      of specifying that command mode.  With this change, the run_command()
      helper denies access to handlers that should run only after 'init'
      during the configuration stage.
      fd343bea
    • Zachary T Welch's avatar
      add command private data setter/accessor · 933b4579
      Zachary T Welch authored
      Presently, commands registration taks a static handler data pointer.
      This patch adds support for commands that require a dynamic pointer,
      such as those registered in a dynamic context (e.g. subcommands for a
      user-created 'foo.cpu' command).  The command_set_handler_data will
      update a command (group) to use a new context pointer, while the
      CMD_DATA macro allows command handlers to access the value.
      Jim handlers should find this value in interp->cmdPrivData.
      933b4579
    • Zachary T Welch's avatar
      add 'command mode' introspective handler · 3b5751a4
      Zachary T Welch authored
      Allows scripts to behave different depending on the current mode.
      Also allows introspection of the mode required for commands.
      3b5751a4
    • Zachary T Welch's avatar
      remove unknown handler · 89fa493a
      Zachary T Welch authored
      Updates command registration to provide top-level handlers for all
      commands, rather than falling back onto the 'unknown' command. Instead,
      that same handler is registered for placeholders, providing the same
      functionality under the root verb command name instead.  This permits
      users to implement their own 'unknown' function, and it resolves some
      mind-bending breakage related to function object lookup while recursing.
      
      Changes 'ocd_bounce' to call 'ocd_command' and 'ocd_help' from the
      wrapper directly, rather than bouncing through their wrappers. This
      prevents endless recursion caused by the above changes, whereby the
      'command' wrapper's type check would blow the stack to hell and gone.
      89fa493a
    • Zachary T Welch's avatar
      improve command handler wrapper script · df22f0f9
      Zachary T Welch authored
      Adds 'ocd_bouncer' in startup.tcl that is called as a helper for
      all command handlers, shrinking the embedded C wrapper to a mere stub.
      
      Jim handlers are called directly, simple handlers get called with the
      wrapper to capture and discard their output on error, and placeholders
      call help directly (though the unknown handler still does this too).
      It attempts to improve the quality of the error messages as well.
      df22f0f9
    • Zachary T Welch's avatar
      add 'command type' introspective handler · 37dd5a68
      Zachary T Welch authored
      Adds the 'command' group handler, with the 'type' command producing
      a string that tells whether the given command is 'native' (for Jim-based
      command handlers), 'simple' (for simple built-in commands), 'group'
      for command group placeholders, and 'unknown' if not found in the
      command registration tables (e.g. core built-ins functions).
      37dd5a68
    • David Brownell's avatar
      ARM11: fix warning on amd64 · 5f022342
      David Brownell authored
      
      
      Previous version of JTAG_DEBUG() macro hid this bug.
      Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
      5f022342