support for scripts in $HOME/.openocd
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>
Mon, 23 Nov 2009 23:32:54 +0000 (00:32 +0100)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Tue, 24 Nov 2009 07:57:02 +0000 (08:57 +0100)
Add $HOME/.openocd as the first default script search directory, allowing
the user to override the standard scripts.

Update the user guide with information on where OpenOCD expects to find
configuration files and scripts. Also fixed some minor formatting issues.

Add entry to NEWS as well.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
NEWS
doc/openocd.texi
src/helper/options.c

diff --git a/NEWS b/NEWS
index 1a024e45427e31e489908cd6c813141dccf28466..0dcc4bc42fcba7642ad2acc8792068b099e01819 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -19,6 +19,7 @@ Flash Layer:
 Board, Target, and Interface Configuration Scripts:
        ARM9
                - ETM and ETB hookup for iMX2* targets
 Board, Target, and Interface Configuration Scripts:
        ARM9
                - ETM and ETB hookup for iMX2* targets
+       Add $HOME/.openocd to the search path.
 
 Documentation:
 Build and Release:
 
 Documentation:
 Build and Release:
index cff7fc5e6cdf689dd9164faa9ed53d2d76d449e2..e94c9d02bfef6afe80f226273deb1f967bf98529 100644 (file)
@@ -483,14 +483,24 @@ bash$ openocd --help
 --pipe       | -p       use pipes when talking to gdb
 @end verbatim
 
 --pipe       | -p       use pipes when talking to gdb
 @end verbatim
 
-By default OpenOCD reads the file configuration file @file{openocd.cfg}
-in the current directory.  To specify a different (or multiple)
-configuration file, you can use the ``-f'' option. For example:
+By default OpenOCD reads the configuration file @file{openocd.cfg}.
+To specify a different (or multiple)
+configuration file, you can use the @option{-f} option. For example:
 
 @example
 openocd -f config1.cfg -f config2.cfg -f config3.cfg
 @end example
 
 
 @example
 openocd -f config1.cfg -f config2.cfg -f config3.cfg
 @end example
 
+Configuration files and scripts are searched for in
+@enumerate
+@item the current directory,
+@item any search dir specified on the command line using the @option{-s} option,
+@item @file{$HOME/.openocd} (not on Windows),
+@item the site wide script library @file{$pkgdatadir/site} and
+@item the OpenOCD-supplied script library @file{$pkgdatadir/scripts}.
+@end enumerate
+The first found file with a matching file name will be used.
+
 OpenOCD starts by processing the configuration commands provided
 on the command line or in @file{openocd.cfg}.
 @xref{Configuration Stage}.
 OpenOCD starts by processing the configuration commands provided
 on the command line or in @file{openocd.cfg}.
 @xref{Configuration Stage}.
@@ -507,7 +517,7 @@ clients (Telnet, GDB, Other) and processes the commands issued through
 those channels.
 
 If you are having problems, you can enable internal debug messages via
 those channels.
 
 If you are having problems, you can enable internal debug messages via
-the ``-d'' option.
+the @option{-d} option.
 
 Also it is possible to interleave JIM-Tcl commands w/config scripts using the
 @option{-c} command line switch.
 
 Also it is possible to interleave JIM-Tcl commands w/config scripts using the
 @option{-c} command line switch.
@@ -523,10 +533,6 @@ setting from within a telnet or gdb session using @command{debug_level
 You can redirect all output from the daemon to a file using the
 @option{-l <logfile>} switch.
 
 You can redirect all output from the daemon to a file using the
 @option{-l <logfile>} switch.
 
-Search paths for config/script files can be added to OpenOCD by using
-the @option{-s <search>} switch. The current directory and the OpenOCD
-target library is in the search path by default.
-
 For details on the @option{-p} option. @xref{Connecting to GDB}.
 
 Note! OpenOCD will launch the GDB & telnet server even if it can not
 For details on the @option{-p} option. @xref{Connecting to GDB}.
 
 Note! OpenOCD will launch the GDB & telnet server even if it can not
index 874196eabc5b82384a7c7c4caf7004617ca99cae..3db96fd713b5850bb70f8618ef2ba126a3cd6e65 100644 (file)
@@ -101,7 +101,22 @@ static void add_default_dirs(void)
         * listed last in the built-in search order, so the user can
         * override these scripts with site-specific customizations.
         */
         * listed last in the built-in search order, so the user can
         * override these scripts with site-specific customizations.
         */
-       /// @todo Implement @c add_script_search_dir("${HOME}/.openocd").
+
+       const char *home = getenv("HOME");
+
+       if (home) 
+       {
+               char *path;
+
+               path = alloc_printf("%s/.openocd", home);
+
+               if (path) 
+               {
+                       add_script_search_dir(path);
+                       free(path);
+               }
+       }
+
        add_script_search_dir(PKGDATADIR "/site");
        add_script_search_dir(PKGDATADIR "/scripts");
 #endif
        add_script_search_dir(PKGDATADIR "/site");
        add_script_search_dir(PKGDATADIR "/scripts");
 #endif

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)