41 #define OPENOCD_VERSION \
42 "Open On-Chip Debugger " VERSION RELSTR " (" PKGBLDDATE ")"
44 #define OPENOCD_VERSION \
45 "Open On-Chip Debugger " VERSION RELSTR
49 #include "startup_tcl.inc"
55 Jim_Obj *
const *argv)
64 str = Jim_GetString(argv[1],
NULL);
66 if (strcmp(
"git", str) == 0)
67 version_str = GITVERSION;
69 Jim_SetResult(interp, Jim_NewStringObj(interp, version_str, -1));
116 static int initialized;
134 LOG_DEBUG(
"Debug Adapter init complete");
199 .help =
"show program version",
203 .handler = &handle_noinit_command,
205 .help =
"Prevent 'init' from being called at startup.",
210 .handler = &handle_init_command,
212 .help =
"Initializes configured targets and servers. "
213 "Changes command mode from CONFIG to EXEC. "
214 "Unless 'noinit' is called, this command is "
215 "called automatically at the end of startup.",
219 .name =
"add_script_search_dir",
220 .handler = &handle_add_script_search_dir_command,
222 .help =
"dir to search for config files and scripts",
223 .usage =
"<directory>"
252 return Jim_EvalExpression(interp, argv[1]);
255 Jim_Obj *obj = Jim_ConcatObj(interp, argc - 1, argv + 1);
256 Jim_IncrRefCount(obj);
257 const char *s = Jim_String(obj);
258 struct jim_scriptobj *script = Jim_GetIntRepPtr(interp->currentScriptObj);
259 if (interp->currentScriptObj == interp->emptyObj ||
260 strcmp(interp->currentScriptObj->typePtr->name,
"script") ||
263 LOG_WARNING(
"DEPRECATED! use 'expr { %s }' not 'expr %s'", s, s);
265 LOG_WARNING(
"DEPRECATED! (%s:%d) use 'expr { %s }' not 'expr %s'",
267 int retcode = Jim_EvalExpression(interp, obj);
268 Jim_DecrRefCount(interp, obj);
272 Jim_WrongNumArgs(interp, 1, argv,
"expression ?...?");
302 typedef int (*command_registrant_t)(
struct command_context *cmd_ctx_value);
303 static const command_registrant_t command_registrants[] = {
321 for (
unsigned i = 0; command_registrants[i]; i++) {
322 int retval = (*command_registrants[i])(cmd_ctx);
328 LOG_DEBUG(
"command registration: complete");
331 "Licensed under GNU GPL v2\n");
403 "http://openocd.org/doc/doxygen/bugs.html"
int adapter_quit(void)
Shutdown the debug adapter upon program exit.
int adapter_register_commands(struct command_context *ctx)
Register the commands which deal with arbitrary debug adapter drivers.
int adapter_init(struct command_context *cmd_ctx)
Do low-level setup like initializing registers, output signals, and clocking.
This defines formats and data structures used to talk to ADIv5 entities.
int dap_cleanup_all(void)
int dap_register_commands(struct command_context *cmd_ctx)
int cti_register_commands(struct command_context *cmd_ctx)
int arm_cti_cleanup_all(void)
int arm_tpiu_swo_register_commands(struct command_context *cmd_ctx)
int arm_tpiu_swo_cleanup_all(void)
int help_del_all_commands(struct command_context *cmd_ctx)
Unregisters the help for all commands.
void command_done(struct command_context *cmd_ctx)
Frees the resources associated with a command context.
void command_exit(struct command_context *context)
Shutdown a command context.
struct command_context * command_init(const char *startup_tcl, Jim_Interp *interp)
Creates a new command context using the startup TCL provided and the existing Jim interpreter,...
int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode)
void command_set_output_handler(struct command_context *context, command_output_handler_t output_handler, void *priv)
int unregister_all_commands(struct command_context *context, const char *cmd_prefix)
Unregisters all commands from the specified context.
int command_run_line(struct command_context *context, char *line)
#define CMD_ARGV
Use this macro to access the arguments for the command being handled, rather than accessing the varia...
#define ERROR_COMMAND_SYNTAX_ERROR
#define ERROR_COMMAND_CLOSE_CONNECTION
#define CMD_ARGC
Use this macro to access the number of arguments for the command being handled, rather than accessing...
#define CMD_CTX
Use this macro to access the context of the command being handled, rather than accessing the variable...
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
static int register_commands(struct command_context *cmd_ctx, const char *cmd_prefix, const struct command_registration *cmds)
Register one or more commands in the specified context, as children of parent (or top-level commends,...
int parse_config_file(struct command_context *cmd_ctx)
void add_script_search_dir(const char *dir)
int parse_cmdline_args(struct command_context *cmd_ctx, int argc, char *argv[])
int configuration_output_handler(struct command_context *cmd_ctx, const char *line)
static struct esp_usb_jtag * priv
void flash_free_all_banks(void)
Deallocates all flash banks.
int gdb_register_commands(struct command_context *cmd_ctx)
int gdb_target_add_all(struct target *target)
void gdb_service_free(void)
void jtag_poll_unmask(bool saved)
Restore saved mask for polling.
bool jtag_poll_mask(void)
Mask (disable) polling and return the current mask status that should be feed to jtag_poll_unmask() t...
The JTAG interface can be implemented with a software or hardware fifo.
int log_register_commands(struct command_context *cmd_ctx)
void log_init(void)
Initialize logging module.
#define LOG_OUTPUT(expr ...)
#define LOG_WARNING(expr ...)
#define LOG_DEBUG(expr ...)
int nand_register_commands(struct command_context *cmd_ctx)
Upper level NOR flash interfaces.
int flash_register_commands(struct command_context *cmd_ctx)
Registers the 'flash' subsystem commands.
static const struct command_registration openocd_command_handlers[]
struct command_context * global_cmd_ctx
COMMAND_HANDLER(handle_noinit_command)
static int openocd_thread(int argc, char *argv[], struct command_context *cmd_ctx)
OpenOCD runtime meat that can become single-thread in future.
static int log_target_callback_event_handler(struct target *target, enum target_event event, void *priv)
static bool init_at_startup
static int workaround_for_jimtcl_expr(struct command_context *cmd_ctx)
static struct command_context * setup_command_handler(Jim_Interp *interp)
static int jim_expr_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int jim_version_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
static int openocd_register_commands(struct command_context *cmd_ctx)
static const char openocd_startup_tcl[]
static const struct command_registration expr_handler[]
int openocd_main(int argc, char *argv[])
Different applications can define this entry point to override the default openocd main function.
int pld_register_commands(struct command_context *cmd_ctx)
int rtt_init(void)
Initialize Real-Time Transfer (RTT).
int rtt_exit(void)
Shutdown Real-Time Transfer (RTT).
int rtt_server_register_commands(struct command_context *ctx)
void exit_on_signal(int sig)
int server_host_os_close(void)
int server_host_os_entry(void)
int server_loop(struct command_context *command_context)
int server_register_commands(struct command_context *cmd_ctx)
int server_init(struct command_context *cmd_ctx)
struct target * all_targets
int target_register_event_callback(int(*callback)(struct target *target, enum target_event event, void *priv), void *priv)
int target_arch_state(struct target *target)
int target_register_commands(struct command_context *cmd_ctx)
int transport_register_commands(struct command_context *ctx)
int util_init(struct command_context *cmd_ctx)