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"
65 version_str = GITVERSION;
115 static int initialized;
133 LOG_DEBUG(
"Debug Adapter init complete");
196 .handler = handler_version_command,
198 .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>"
243 typedef int (*command_registrant_t)(
struct command_context *cmd_ctx_value);
244 static const command_registrant_t command_registrants[] = {
261 for (
unsigned int i = 0; command_registrants[i]; i++) {
262 int retval = (*command_registrants[i])(cmd_ctx);
268 LOG_DEBUG(
"command registration: complete");
271 "Licensed under GNU GPL v2\n");
343 "http://openocd.org/doc/doxygen/bugs.html"
381 void __gcov_dump(
void);
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_print(struct command_invocation *cmd, const char *format,...)
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
Use this macro to access the command being handled, rather than accessing the variable directly.
#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.
#define ERROR_COMMAND_ARGUMENT_INVALID
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_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[]
COMMAND_HANDLER(handler_version_command)
struct command_context * global_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.
static int log_target_callback_event_handler(struct target *target, enum target_event event, void *priv)
static bool init_at_startup
static struct command_context * setup_command_handler(Jim_Interp *interp)
static int openocd_register_commands(struct command_context *cmd_ctx)
static const char openocd_startup_tcl[]
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)