1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #define OPENOCD_VERSION "Open On-Chip Debugger " VERSION " (" PKGBLDDATE ") svn:" PKGBLDREV
30 #include "configuration.h"
39 #include "telnet_server.h"
40 #include "gdb_server.h"
41 #include "tcl_server.h"
44 #include <sys/types.h>
58 #include "replacements.h"
61 /* Give TELNET a way to find out what version this is */
62 int handle_version_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
)
64 command_print(cmd_ctx
, OPENOCD_VERSION
);
69 static int daemon_startup
= 0;
71 int handle_daemon_startup_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
)
76 return ERROR_COMMAND_SYNTAX_ERROR
;
78 daemon_startup
= strcmp("reset", args
[0])==0;
80 command_print(cmd_ctx
, OPENOCD_VERSION
);
85 void exit_handler(void)
87 /* close JTAG interface */
88 if (jtag
&& jtag
->quit
)
92 /* OpenOCD can't really handle failure of this command. Patches welcome! :-) */
93 int handle_init_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
)
96 static int initialized
=0;
102 atexit(exit_handler
);
104 if (target_init(cmd_ctx
) != ERROR_OK
)
106 LOG_DEBUG("target init complete");
108 if ((retval
=jtag_interface_init(cmd_ctx
)) != ERROR_OK
)
110 /* we must be able to set up the jtag interface */
113 LOG_DEBUG("jtag interface init complete");
115 /* Try to initialize & examine the JTAG chain at this point, but
116 * continue startup regardless */
117 if (jtag_init(cmd_ctx
) == ERROR_OK
)
119 LOG_DEBUG("jtag init complete");
120 if (target_examine(cmd_ctx
) == ERROR_OK
)
122 LOG_DEBUG("jtag examine complete");
126 if (flash_init_drivers(cmd_ctx
) != ERROR_OK
)
128 LOG_DEBUG("flash init complete");
130 if (nand_init(cmd_ctx
) != ERROR_OK
)
132 LOG_DEBUG("NAND init complete");
134 if (pld_init(cmd_ctx
) != ERROR_OK
)
136 LOG_DEBUG("pld init complete");
138 /* initialize tcp server */
141 /* initialize telnet subsystem */
142 telnet_init("Open On-Chip Debugger");
144 tcl_init(); /* allows tcl to just connect without going thru telnet */
149 command_context_t
*setup_command_handler(void)
151 command_context_t
*cmd_ctx
;
153 cmd_ctx
= command_init();
155 register_command(cmd_ctx
, NULL
, "version", handle_version_command
,
156 COMMAND_EXEC
, "show OpenOCD version");
157 register_command(cmd_ctx
, NULL
, "daemon_startup", handle_daemon_startup_command
, COMMAND_CONFIG
,
158 "deprecated - use \"init\" and \"reset\" at end of startup script instead");
160 /* register subsystem commands */
161 server_register_commands(cmd_ctx
);
162 telnet_register_commands(cmd_ctx
);
163 gdb_register_commands(cmd_ctx
);
164 tcl_register_commands(cmd_ctx
); /* tcl server commands */
165 log_register_commands(cmd_ctx
);
166 jtag_register_commands(cmd_ctx
);
167 xsvf_register_commands(cmd_ctx
);
168 target_register_commands(cmd_ctx
);
169 flash_register_commands(cmd_ctx
);
170 nand_register_commands(cmd_ctx
);
171 pld_register_commands(cmd_ctx
);
173 if (log_init(cmd_ctx
) != ERROR_OK
)
177 LOG_DEBUG("log init complete");
179 LOG_OUTPUT( OPENOCD_VERSION
"\n" );
181 register_command(cmd_ctx
, NULL
, "init", handle_init_command
,
182 COMMAND_ANY
, "initializes target and servers - nop on subsequent invocations");
187 /* normally this is the main() function entry, but if OpenOCD is linked
188 * into application, then this fn will not be invoked, but rather that
189 * application will have it's own implementation of main(). */
190 int openocd_main(int argc
, char *argv
[])
192 /* initialize commandline interface */
193 command_context_t
*cmd_ctx
;
195 cmd_ctx
= setup_command_handler();
197 /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
198 /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
199 /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
200 /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
201 /* DANGER!!! make sure that the line below does not appear in a patch, do not remove */
202 LOG_OUTPUT( "$URL$\n");
203 /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
204 /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
205 /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
206 /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
207 /* DANGER!!! make sure that the line above does not appear in a patch, do not remove */
209 command_context_mode(cmd_ctx
, COMMAND_CONFIG
);
210 command_set_output_handler(cmd_ctx
, configuration_output_handler
, NULL
);
212 if (parse_cmdline_args(cmd_ctx
, argc
, argv
) != ERROR_OK
)
215 if (parse_config_file(cmd_ctx
) != ERROR_OK
)
218 command_context_mode(cmd_ctx
, COMMAND_EXEC
);
219 if (command_run_line(cmd_ctx
, "init")!=ERROR_OK
)
223 command_run_line(cmd_ctx
, "reset");
225 /* handle network connections */
226 server_loop(cmd_ctx
);
228 /* shut server down */
231 unregister_all_commands(cmd_ctx
);
233 /* free commandline interface */
234 command_done(cmd_ctx
);
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)