- added a PLD (programmable logic device) subsystem for FPGA, CPLD etc. configuration
[openocd.git] / src / openocd.c
1 /***************************************************************************
2 * Copyright (C) 2005 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
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. *
9 * *
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. *
14 * *
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 ***************************************************************************/
20
21 #define OPENOCD_VERSION "Open On-Chip Debugger (2006-11-22 14:00 CEST)"
22
23 #ifdef HAVE_CONFIG_H
24 #include "config.h"
25 #endif
26
27 #include "log.h"
28 #include "types.h"
29 #include "jtag.h"
30 #include "configuration.h"
31 #include "interpreter.h"
32 #include "xsvf.h"
33 #include "target.h"
34 #include "flash.h"
35 #include "pld.h"
36
37 #include "command.h"
38 #include "server.h"
39 #include "telnet_server.h"
40 #include "gdb_server.h"
41
42 #include <sys/time.h>
43 #include <sys/types.h>
44 #include <strings.h>
45 #include <stdio.h>
46 #include <stdlib.h>
47 #include <string.h>
48 #include <unistd.h>
49 #include <errno.h>
50
51 /* Give TELNET a way to find out what version this is */
52 int handle_version_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
53 {
54 command_print(cmd_ctx, OPENOCD_VERSION);
55
56 return ERROR_OK;
57 }
58
59 int main(int argc, char *argv[])
60 {
61 /* initialize commandline interface */
62 command_context_t *cmd_ctx, *cfg_cmd_ctx;
63 cmd_ctx = command_init();
64
65 register_command(cmd_ctx, NULL, "version", handle_version_command,
66 COMMAND_EXEC, "show OpenOCD version");
67
68 /* register subsystem commands */
69 server_register_commands(cmd_ctx);
70 telnet_register_commands(cmd_ctx);
71 gdb_register_commands(cmd_ctx);
72 log_register_commands(cmd_ctx);
73 jtag_register_commands(cmd_ctx);
74 interpreter_register_commands(cmd_ctx);
75 xsvf_register_commands(cmd_ctx);
76 target_register_commands(cmd_ctx);
77 flash_register_commands(cmd_ctx);
78 pld_register_commands(cmd_ctx);
79
80 if (log_init(cmd_ctx) != ERROR_OK)
81 return EXIT_FAILURE;
82 DEBUG("log init complete");
83
84 INFO( OPENOCD_VERSION );
85
86 cfg_cmd_ctx = copy_command_context(cmd_ctx);
87 cfg_cmd_ctx->mode = COMMAND_CONFIG;
88 command_set_output_handler(cfg_cmd_ctx, configuration_output_handler, NULL);
89
90 if (parse_cmdline_args(cfg_cmd_ctx, argc, argv) != ERROR_OK)
91 return EXIT_FAILURE;
92
93 if (parse_config_file(cfg_cmd_ctx) != ERROR_OK)
94 return EXIT_FAILURE;
95
96 command_done(cfg_cmd_ctx);
97
98 command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
99
100 if (jtag_init(cmd_ctx) != ERROR_OK)
101 return EXIT_FAILURE;
102 DEBUG("jtag init complete");
103
104 if (target_init(cmd_ctx) != ERROR_OK)
105 return EXIT_FAILURE;
106 DEBUG("target init complete");
107
108 if (flash_init(cmd_ctx) != ERROR_OK)
109 return EXIT_FAILURE;
110 DEBUG("flash init complete");
111
112 if (pld_init(cmd_ctx) != ERROR_OK)
113 return EXIT_FAILURE;
114 DEBUG("pld init complete");
115
116 /* initialize tcp server */
117 server_init();
118
119 /* initialize telnet subsystem */
120 telnet_init("Open On-Chip Debugger");
121 gdb_init();
122
123 /* handle network connections */
124 server_loop(cmd_ctx);
125
126 /* shut server down */
127 server_quit();
128
129 /* free commandline interface */
130 command_done(cmd_ctx);
131
132 return EXIT_SUCCESS;
133 }

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)