I'm using openocd to do both programming the flash and a separate debugging instance afterwards. The program script needs to tell openocd to shutdown at the end if programming has been successful, otherwise the debugging session can't start, however the exit status is always 1 whether or not it worked.
This patch continues through to server_quit bypassing the 'init' command if 'shutdown' comand is executed. Richard M. Index: src/openocd.c =================================================================== --- src/openocd.c (revision 1022) +++ src/openocd.c (working copy) @@ -191,6 +191,8 @@ * application will have it's own implementation of main(). */ int openocd_main(int argc, char *argv[]) { + int ret; + /* initialize commandline interface */ command_context_t *cmd_ctx; @@ -216,15 +218,19 @@ if (parse_cmdline_args(cmd_ctx, argc, argv) != ERROR_OK) return EXIT_FAILURE; - if (parse_config_file(cmd_ctx) != ERROR_OK) + ret = parse_config_file(cmd_ctx); + if ( (ret != ERROR_OK) && (ret != ERROR_COMMAND_CLOSE_CONNECTION) ) return EXIT_FAILURE; - command_context_mode(cmd_ctx, COMMAND_EXEC); - if (command_run_line(cmd_ctx, "init")!=ERROR_OK) - return EXIT_FAILURE; + if (ret != ERROR_COMMAND_CLOSE_CONNECTION) + { + command_context_mode(cmd_ctx, COMMAND_EXEC); + if (command_run_line(cmd_ctx, "init")!=ERROR_OK) + return EXIT_FAILURE; - /* handle network connections */ - server_loop(cmd_ctx); + /* handle network connections */ + server_loop(cmd_ctx); + } /* shut server down */ server_quit(); _______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development