return ERROR_OK;
}
+int add_default_dirs(void)
+{
+#ifdef _WIN32
+ /* Add the parent of the directory where openocd.exe resides to the
+ * config script search path.
+ * Directory layout:
+ * bin\openocd.exe
+ * lib\openocd
+ * event\at91eb40a_reset.cfg
+ * target\at91eb40a.cfg
+ */
+ {
+ char strExePath [MAX_PATH];
+ GetModuleFileName (NULL, strExePath, MAX_PATH);
+ /* Either this code will *always* work or it will SEGFAULT giving
+ * excellent information on the culprit.
+ */
+ *strrchr(strExePath, '\\')=0;
+ strcat(strExePath, "\\..");
+ add_script_search_dir(strExePath);
+ }
+#else
+ /* Add dir for openocd supplied scripts last so that user can over
+ ride those scripts if desired. */
+ add_script_search_dir(PKGDATADIR);
+ add_script_search_dir(PKGLIBDIR);
+#endif
+ return ERROR_OK;
+}
+
int parse_cmdline_args(struct command_context_s *cmd_ctx, int argc, char *argv[])
{
int c;
exit(-1);
}
-#ifdef _WIN32
- /* Add the parent of the directory where openocd.exe resides to the
- * config script search path.
- * Directory layout:
- * bin\openocd.exe
- * lib\openocd
- * event\at91eb40a_reset.cfg
- * target\at91eb40a.cfg
- */
- {
- char strExePath [MAX_PATH];
- GetModuleFileName (NULL, strExePath, MAX_PATH);
- /* Either this code will *always* work or it will SEGFAULT giving
- * excellent information on the culprit.
- */
- *strrchr(strExePath, '\\')=0;
- strcat(strExePath, "\\..");
- add_script_search_dir(strExePath);
- }
-#else
- /* Add dir for openocd supplied scripts last so that user can over
- ride those scripts if desired. */
- add_script_search_dir(PKGDATADIR);
- add_script_search_dir(PKGLIBDIR);
-#endif
return ERROR_OK;
}
/* after command line parsing */
void initJim2(void)
{
- Jim_Eval(interp, "source [find tcl/commands.tcl]");
+ if (Jim_Eval(interp, "source [find tcl/commands.tcl]")==JIM_ERR)
+ {
+ LOG_ERROR("Can not find tcl/commands.tcl - check installation");
+ exit(-1);
+ }
}
command_context_t *setup_command_handler(void)
active_cmd_ctx=cfg_cmd_ctx;
- if (parse_cmdline_args(cfg_cmd_ctx, argc, argv) != ERROR_OK)
- return EXIT_FAILURE;
+ add_default_dirs();
initJim2();
-
+
+ if (parse_cmdline_args(cfg_cmd_ctx, argc, argv) != ERROR_OK)
+ return EXIT_FAILURE;
+
if (parse_config_file(cfg_cmd_ctx) != ERROR_OK)
return EXIT_FAILURE;