adi_v5_swd: wait for readable DPIDR, ABORT if stalled
[fw/openocd] / src / openocd.c
index 2a9a0b3d4a37ae7c764d4cf5968fd0887c1df61a..604b36d212a28d01ae2240a6d8c74220c47fbb69 100644 (file)
@@ -230,10 +230,7 @@ static int openocd_register_commands(struct command_context *cmd_ctx)
 
 struct command_context *global_cmd_ctx;
 
-/* NB! this fn can be invoked outside this file for non PC hosted builds
- * NB! do not change to 'static'!!!!
- */
-struct command_context *setup_command_handler(Jim_Interp *interp)
+static struct command_context *setup_command_handler(Jim_Interp *interp)
 {
        log_init();
        LOG_DEBUG("log_init: complete");
@@ -345,6 +342,8 @@ int openocd_main(int argc, char *argv[])
        command_context_mode(cmd_ctx, COMMAND_CONFIG);
        command_set_output_handler(cmd_ctx, configuration_output_handler, NULL);
 
+       server_host_os_entry();
+
        /* Start the executable meat that can evolve into thread in future. */
        ret = openocd_thread(argc, argv, cmd_ctx);
 
@@ -360,6 +359,8 @@ int openocd_main(int argc, char *argv[])
 
        adapter_quit();
 
+       server_host_os_close();
+
        /* Shutdown commandline interface */
        command_exit(cmd_ctx);