summaryrefslogtreecommitdiff
path: root/src/openocd.c
Commit message (Collapse)AuthorAgeFilesLines
* transport: fix segfault in setup_command_handler()Stacey Sheldon2010-07-051-0/+1
| | | | | | | | Commit 93f2afa45f4c dropped the sentinel off the end of the command_registrants[] array. The loop immediately following the initialization will walk right off the end. Signed-off-by: Stacey Sheldon <stac@solidgoldbomb.org>
* initial "transport" frameworkDavid Brownell2010-07-021-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the guts of a transport framework with initialization, which should work with current JTAG-only configurations (tested with FT2232). Each debug adapter can declare the transports it supports, and exactly one transport is initialized. (with its commands) in any given OpenOCD session. * Define a new "struct transport with init hooks and a few "transport" subcommands to support it: "list" ... list the transports configured (just "jtag" for now) "select" ... makes the debug session use that transport "init" ... initializes the selected transport (internal) * "interface_transports" ... declares transports the current interface can support. (Some will do this from C code instead, when there are no hardware versioning (or other) issues to prevent it. Plus some FT2232 tweaks, including a few to streamline upcoming support for an SWD transport (initially for Luminary adapters). Eventually src/jtag should probably become src/transport, moving jtag-specific stuff to transport/jtag. Signed-off-by: David Brownell <db@helium.(none)>
* openocd: setup_command_handler() must not be staticØyvind Harboe2010-06-231-2/+4
| | | | | | | when OpenOCD is linked with an app this fn can be used from the outside. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* openocd.c: review scope of symbolsAntonio Borneo2010-06-211-1/+1
| | | | | | Add "static" qualifier to private data. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* OPENOCD: review scope of functionsAntonio Borneo2010-04-101-1/+1
| | | | | | Add "static" qualifier to private functions. Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
* SCRIPT: add add_script_search_dir cmdSpencer Oliver2010-03-171-0/+17
| | | | | | | Add a add_script_search_dir cmd so that adding search dir's can be added to cfg scripts. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* rename jtag_interface_{init,quit}()David Brownell2010-03-141-4/+4
| | | | | | | These routines apply to non-JTAG debug adapters too. To reduce confusion, give them better (non-misleading) names. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* split "interface" commands from "jtag" onesDavid Brownell2010-03-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | We'll need to be able to work with debug adapter interfaces (drivers) even when they're not used for JTAG ... for example, while there are multi-transport drivers which support JTAG *and* several other transports (or just one more, like SWD) there are also adapters with more limited goals (and no JTAG support at all). Start decoupling the two concepts ("debug adapter driver", "jtag") by having two command groups, which initialize separately. This will help us support OpenOCD sessions using only non-JTAG transports, in which JTAG commands should not be registered. Update docs to mention that the JTAG, SVF, and XSVF commands won't work without a JTAG transport. Note that at least commands working with SRST are still inappropriately coupled to JTAG ... inappropriate because (a) SRST is not part of the JTAG standard, for all that many platforms (like ARM) expect it; and also (b) because they're used with non-JTAG debug and programming interfaces, too. They should perhaps become generic "interface" operations at some point. (Similarly with the clock rate to be used by a given adapter.) Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* move a constant table to .rodata sectionDavid Brownell2010-03-081-1/+1
| | | | | | | | | The table of command registration functions shouldn't be in writable memory, where stray pointers can clobber it. Also, it shouldn't be initialized at runtime; that just consumes needless code space. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* gpl: fix GPL startup messageØyvind Harboe2010-02-151-1/+2
| | | | Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* server: add server_preinit which is called before config file is parsed.Spencer Oliver2009-12-111-2/+3
| | | | | | | This fixes the issue under native win32 of the socket interface not being enabled (via WSAStartup) before init is called from a script. Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
* rename nand.h to flash//nand/core.hZachary T Welch2009-12-041-1/+1
| | | | | | | | | Rename nand.h as flash/nand/core.h, chase consumers. The public APIs need to be sorted out with imp.h, but this allows other changes to begin improving the separation between policy and mechanism. Moves #include <target/target.h> and #include "driver.h" into the internal headers or source files, removing it from <flash/nand/core.h>.
* remove flash.h from treeZachary T Welch2009-12-041-1/+1
| | | | | Remove the now vestigial <flash/flash.h> header from the tree, replacing a few references with <flash/nor/core.h>
* split NOR and NAND flash headersZachary T Welch2009-12-041-0/+1
| | | | | Moves common flash errors to <flash/common.h> to decouple these two mostly unrelated trees of code.
* check top-level command registrationsZachary T Welch2009-12-041-16/+34
| | | | | | | When calling module_register_commands, the return value needs to be checked for failures. Instead of duplicating code, use an array of function pointers to the identical registration functions to iterate over during startup.
* fix another init regressionDavid Brownell2009-12-031-4/+7
| | | | | | | | | | | | | | | This makes Beagle work again, instead of losing horribly because the JTAG event handlers are no longer able to e.g. "runtest". I get the previous quirky behavior ... comes up OK but "reset halt" somewhat mysteriously makes it all better. (Instead of nothing being able to work at all...) However, I'm still seeing: The 'init' command must be used before 'init'. That seems to come from invoking "jtag init", sometime after it gets mapped to "ocd_jtag init", according to debug message traces. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* fix double 'init' regressionZachary T Welch2009-12-031-1/+1
| | | | | | To prevent regression in the behavior of 'init', we allow it to run in any mode. If provided with -c init and with -c noinit, then the second init at startup caused a spurious mode failure. Let 'init' handle it.
* change #include "xsvf.h" to <xsvf/xsvf.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "xsvf.h" the following form should be used. #include <xsvf/xsvf.h> The exception is from .c files in the same directory.
* change #include "svf.h" to <svf/svf.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "svf.h" the following form should be used. #include <svf/svf.h> The exception is from .c files in the same directory.
* change #include "pld.h" to <pld/pld.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "pld.h" the following form should be used. #include <pld/pld.h> The exception is from .c files in the same directory.
* change #include "server.h" to <server/server.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "server.h" the following form should be used. #include <server/server.h> The exception is from .c files in the same directory.
* change #include "httpd.h" to <server/httpd.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "httpd.h" the following form should be used. #include <server/httpd.h> The exception is from .c files in the same directory.
* change #include "gdb_server.h" to <server/gdb_server.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "gdb_server.h" the following form should be used. #include <server/gdb_server.h> The exception is from .c files in the same directory.
* change #include "nand.h" to <flash/nand.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "nand.h" the following form should be used. #include <flash/nand.h> The exception is from .c files in the same directory.
* change #include "mflash.h" to <flash/mflash.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "mflash.h" the following form should be used. #include <flash/mflash.h> The exception is from .c files in the same directory.
* change #include "jtag.h" to <jtag/jtag.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "jtag.h" the following form should be used. #include <jtag/jtag.h> The exception is from .c files in the same directory.
* change #include "ioutil.h" to <helper/ioutil.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "ioutil.h" the following form should be used. #include <helper/ioutil.h> The exception is from .c files in the same directory.
* change #include "configuration.h" to <helper/configuration.h>Zachary T Welch2009-12-031-1/+1
| | | | | | | | | | | | Changes from the flat namespace to heirarchical one. Instead of writing: #include "configuration.h" the following form should be used. #include <helper/configuration.h> The exception is from .c files in the same directory.
* remove #if BUILD_HTTPDZachary T Welch2009-12-021-4/+0
| | | | | | | | | | | Add httpd_stubs.c to provide no-op implementations of httpd_start() and httpd_stop(). Allows these routines to be called unconditionally and ensures the libocdserver ABI remains unchanged regardless of whether this feature was built-in or not. Prints a DEBUG message when the stub implementation is included.
* remove BUILD_IOUTIL symbolZachary T Welch2009-12-021-6/+1
| | | | | | | | | | Add ioutil_stubs.c to provide an empty ioutil_init() routine. Add ioutil.h to prevent applications from needing to declare it. Allows unconditionally calling that function during startup, and the resulting libocdhelper library API is now more stable. Prints a DEBUG message when the stub implementation is included.
* remove #if logic for openocd_sleep_*ludeZachary T Welch2009-12-021-14/+0
| | | | | Adds server_stubs.c to hold these routines, using automake logic to ensure it gets included under the right conditions.
* target: factor init to 'target init'Zachary T Welch2009-12-021-5/+2
| | | | Adds 'target init' command handler, called as part of 'init'.
* jtag: factor init into 'jtag init'Zachary T Welch2009-12-021-7/+9
| | | | | Adds 'jtag init' command handler, which can be called as part of a fine-grained 'init' process.
* flash: factor init to 'flash init'Zachary T Welch2009-12-021-3/+2
| | | | Split flash initialiation into 'flash init', called from 'init'.
* mflash: factor init to 'mflash init'Zachary T Welch2009-12-021-3/+2
| | | | Splits mflash initialiation to 'mflash init', called from 'init'.
* nand: factor init to 'nand init'Zachary T Welch2009-12-021-3/+2
| | | | | Split NAND initialization into 'nand init', which gets called from the main 'init' command.
* pld: factor init to 'pld init'Zachary T Welch2009-12-021-2/+3
| | | | Split PLD initialization into 'pld init', which gets called from 'init'.
* command: the Jim interpreter can now be provided rather than createdØyvind Harboe2009-12-011-3/+3
| | | | | | | In embedded hosts, the Jim interpreter can come from the existing context rather than be created by OpenOCD. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* main: invoke jtag_interface_quit() explicitlyØyvind Harboe2009-12-011-6/+2
| | | | | | | | There is no particular reason to invoke jtag_interface_quit() on the atexit() handler, it just makes the code more obtuse and stops other legitimate usage of atexit(). Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
* do not extern 'interp' from command.cZachary T Welch2009-11-301-1/+1
| | | | | Adds 'interp' field to command_context, chasing the few remaining references to the global variable outside of the command module.
* allow deferal of initZachary T Welch2009-11-301-4/+23
| | | | | | | 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.
* move server_init() to openocd_main()Zachary T Welch2009-11-301-18/+13
| | | | | | | | | 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'.
* improve gdb_init() sequenceZachary T Welch2009-11-301-1/+1
| | | | | | | | | | | | 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).
* bugfix: 'init' changes state, not main()David Brownell2009-11-281-1/+2
| | | | | | | | Code other than main() may invoke "init". When it does so, customized handlers may need to run ... so make sure the command context state is updated before they do so. Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
* log: improve initializationZachary T Welch2009-11-251-5/+4
| | | | | | Removes redundant assignment of start_ms from log_register_commands(). Eliminates command_context parameter and return value. Adds Doxygen comment block for this API call.
* improve command handling examplesZachary T Welch2009-11-251-4/+0
| | | | | | Removes hello and foo commands from top-level registration. Instead, the dummy interface driver and faux flash driver have been augmented to register these commands as sub-commands.
* httpd: use register_commands()Zachary T Welch2009-11-241-5/+2
| | | | | | | Updates httpd_start() to use register_commands() for 'readform' and 'writeform' commands. Adds server/httpd.h to export the new signatures for this function (and httpd_stop), which allows removing the obsoleted declarations inside openocd.c.
* openocd: use register_commands()Zachary T Welch2009-11-241-6/+18
| | | | Use register_commands() for top-level version and init command.
* use COMMAND_REGISTER macroZachary T Welch2009-11-241-2/+2
| | | | | Replaces direct calls to register_command() with a macro, to allow its parameters to be changed and callers updated in phases.
* refactor command registrationZachary T Welch2009-11-201-1/+1
| | | | | | | | | Refactors the command registration to use helpers to simplify the code. The unregistration routines were made more flexible by allowing them to operate on a single command, such that one can remove all of a commands children in one step (perhaps before adding back a 'config' subcommand that allows getting the others back). Eliminates a bit of duplicated code and adds full API documentation for these routines.