jim tests: use installed
[openocd.git] / src / ecosboard.c
index 2e73585d0bedfb7f591118961ef80fd5df767182..0805e6fcb93c2c88c5db1d606750cef2dc39021e 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2007-2009 by Øyvind Harboe                              *
+ *   Copyright (C) 2007-2010 by Øyvind Harboe                              *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
@@ -24,6 +24,7 @@
 #include <helper/types.h>
 #include <jtag/jtag.h>
 #include <helper/ioutil.h>
+#include <helper/util.h>
 #include <helper/configuration.h>
 
 #include <server/server.h>
@@ -99,10 +100,6 @@ static bool writeLog = true;
 
 char hwaddr[512];
 
-
-extern struct flash_driver *flash_drivers[];
-extern struct target_type *target_types[];
-
 #ifdef CYGPKG_PROFILE_GPROF
 #include <cyg/profile/profile.h>
 
@@ -503,6 +500,10 @@ static void zylinjtag_startNetwork(void)
 
        cyg_httpd_init_tcl_interpreter();
 
+       // Kludge! Why can't I do this from httpd.c??? I get linker errors...
+       // some of that --start/end-group stuff?
+    Jim_InitStaticExtensions(httpstate.jim_interp);
+
        Jim_CreateCommand(httpstate.jim_interp, "log", zylinjtag_Jim_Command_log,
                        NULL, NULL);
        Jim_CreateCommand(httpstate.jim_interp, "zy1000_reboot",
@@ -847,7 +848,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
        static int current_baud = 38400;
        if (argc == 1)
        {
-               command_print(cmd_ctx, "%d", current_baud);
+               Jim_SetResult(interp, Jim_NewIntObj(interp, current_baud));
                return JIM_OK;
        }
        else if (argc != 2)
@@ -883,8 +884,8 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                baud = CYGNUM_SERIAL_BAUD_230400;
                break;
        default:
-               command_print(cmd_ctx, "unsupported baudrate");
-               return ERROR_INVALID_ARGUMENTS;
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "unsupported baudrate", -1));
+               return JIM_ERR;
        }
 
        cyg_serial_info_t buf;
@@ -897,7 +898,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
        err = cyg_io_lookup(ZY1000_SER_DEV, &serial_handle);
        if (err != ENOERR)
        {
-               LOG_ERROR("Could not open serial port\n");
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Could not open serial port", -1));
                return JIM_ERR;
        }
 
@@ -907,7 +908,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                        &len);
        if (err != ENOERR)
        {
-               LOG_ERROR("Failed to get serial port settings %d", err);
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Failed to get serial port settings", -1));
                return JIM_ERR;
        }
        buf.baud = baud;
@@ -916,7 +917,7 @@ static int zylinjtag_Jim_Command_uart(Jim_Interp *interp, int argc,
                        &len);
        if (err != ENOERR)
        {
-               LOG_ERROR("Failed to set serial port settings %d", err);
+               Jim_SetResult(interp, Jim_NewStringObj(interp, "Failed to set serial port settings", -1));
                return JIM_ERR;
        }
 
@@ -1093,6 +1094,9 @@ int main(int argc, char *argv[])
        command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
        command_context_mode(cmd_ctx, COMMAND_CONFIG);
 
+       if (util_init(cmd_ctx) != ERROR_OK)
+               return EXIT_FAILURE;
+
        if (ioutil_init(cmd_ctx) != ERROR_OK)
                return EXIT_FAILURE;
 
@@ -1277,6 +1281,7 @@ struct Tftp
        cyg_uint8 *mem;
        int actual;
        char *server;
+       int port;
        char *file;
 };
 
@@ -1333,6 +1338,15 @@ static int tftpfs_open(cyg_mtab_entry *mte, cyg_dir dir, const char *name,
        strncpy(tftp->server, name, server - name);
        tftp->server[server - name] = 0;
 
+       tftp->port = 0; /* default port 69 */
+       char *port;
+       port = strchr(tftp->server, ':');
+       if (port != NULL)
+       {
+               tftp->port = atoi(port + 1);
+               *port = 0;
+       }
+
        tftp->file = strdup(server + 1);
        if (tftp->file == NULL)
        {
@@ -1350,7 +1364,7 @@ static int fetchTftp(struct Tftp *tftp)
        if (!tftp->readFile)
        {
                int err;
-               tftp->actual = tftp_client_get(tftp->file, tftp->server, 0, tftp->mem,
+               tftp->actual = tftp_client_get(tftp->file, tftp->server, tftp->port, tftp->mem,
                                tftpMaxSize, TFTP_OCTET, &err);
 
                if (tftp->actual < 0)

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)