OpenOCD
openocd.c File Reference
Include dependency graph for openocd.c:

Go to the source code of this file.

Data Structures

struct  jim_scriptobj
 

Macros

#define OPENOCD_VERSION    "Open On-Chip Debugger " VERSION RELSTR
 

Functions

 COMMAND_HANDLER (handle_add_script_search_dir_command)
 
 COMMAND_HANDLER (handle_init_command)
 
 COMMAND_HANDLER (handle_noinit_command)
 
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 log_target_callback_event_handler (struct target *target, enum target_event event, void *priv)
 
int openocd_main (int argc, char *argv[])
 Different applications can define this entry point to override the default openocd main function. More...
 
static int openocd_register_commands (struct command_context *cmd_ctx)
 
static int openocd_thread (int argc, char *argv[], struct command_context *cmd_ctx)
 OpenOCD runtime meat that can become single-thread in future. More...
 
static struct command_contextsetup_command_handler (Jim_Interp *interp)
 
static int workaround_for_jimtcl_expr (struct command_context *cmd_ctx)
 

Variables

static const struct command_registration expr_handler []
 
struct command_contextglobal_cmd_ctx
 
static bool init_at_startup = true
 
static const struct command_registration openocd_command_handlers []
 
static const char openocd_startup_tcl []
 

Macro Definition Documentation

◆ OPENOCD_VERSION

#define OPENOCD_VERSION    "Open On-Chip Debugger " VERSION RELSTR

Definition at line 44 of file openocd.c.

Function Documentation

◆ COMMAND_HANDLER() [1/3]

COMMAND_HANDLER ( handle_add_script_search_dir_command  )

◆ COMMAND_HANDLER() [2/3]

◆ COMMAND_HANDLER() [3/3]

COMMAND_HANDLER ( handle_noinit_command  )

Definition at line 100 of file openocd.c.

References CMD_ARGC, ERROR_COMMAND_SYNTAX_ERROR, ERROR_OK, and init_at_startup.

◆ jim_expr_command()

static int jim_expr_command ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 249 of file openocd.c.

◆ jim_version_command()

static int jim_version_command ( Jim_Interp *  interp,
int  argc,
Jim_Obj *const *  argv 
)
static

Definition at line 54 of file openocd.c.

References NULL, and OPENOCD_VERSION.

◆ log_target_callback_event_handler()

static int log_target_callback_event_handler ( struct target target,
enum target_event  event,
void *  priv 
)
static

◆ openocd_main()

int openocd_main ( int  argc,
char *  argv[] 
)

◆ openocd_register_commands()

static int openocd_register_commands ( struct command_context cmd_ctx)
static

Definition at line 228 of file openocd.c.

References NULL, openocd_command_handlers, and register_commands().

Referenced by setup_command_handler().

◆ openocd_thread()

static int openocd_thread ( int  argc,
char *  argv[],
struct command_context cmd_ctx 
)
static

OpenOCD runtime meat that can become single-thread in future.

It parse commandline, reads configuration, sets up the target and starts server loop. Commandline arguments are passed into this function from openocd_main().

Definition at line 342 of file openocd.c.

References command_run_line(), ERROR_COMMAND_CLOSE_CONNECTION, ERROR_FAIL, ERROR_OK, init_at_startup, last_signal, parse_cmdline_args(), parse_config_file(), server_init(), server_loop(), server_preinit(), and server_quit().

Referenced by openocd_main().

◆ setup_command_handler()

◆ workaround_for_jimtcl_expr()

static int workaround_for_jimtcl_expr ( struct command_context cmd_ctx)
static

Definition at line 287 of file openocd.c.

References expr_handler, NULL, and register_commands().

Referenced by setup_command_handler().

Variable Documentation

◆ expr_handler

const struct command_registration expr_handler[]
static
Initial value:
= {
{
.name = "expr",
.jim_handler = jim_expr_command,
.mode = COMMAND_ANY,
.help = "",
.usage = "",
},
}
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:247
@ COMMAND_ANY
Definition: command.h:42
static int jim_expr_command(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
Definition: openocd.c:249

Definition at line 249 of file openocd.c.

Referenced by workaround_for_jimtcl_expr().

◆ global_cmd_ctx

◆ init_at_startup

bool init_at_startup = true
static

Definition at line 98 of file openocd.c.

Referenced by COMMAND_HANDLER(), and openocd_thread().

◆ openocd_command_handlers

const struct command_registration openocd_command_handlers[]
static

Definition at line 184 of file openocd.c.

Referenced by openocd_register_commands().

◆ openocd_startup_tcl

const char openocd_startup_tcl[]
static
Initial value:
= {
0
}

Definition at line 48 of file openocd.c.

Referenced by setup_command_handler().