X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fopenocd.c;h=83c35458b9ae89a1ad962f25ded32731a3b00de1;hb=310c9800c72f37dd50e855513badc908fcfbafcf;hp=f084dd4522d6294e027578982f803d9c9b86927b;hpb=09076d10dd553dc63f08e74aedb1b6aa030857f9;p=fw%2Fopenocd diff --git a/src/openocd.c b/src/openocd.c index f084dd452..83c35458b 100644 --- a/src/openocd.c +++ b/src/openocd.c @@ -36,12 +36,13 @@ #include #include #include -#include #include #include +#include #include #include +#include #ifdef HAVE_STRINGS_H #include @@ -165,9 +166,6 @@ COMMAND_HANDLER(handle_init_command) if (command_run_line(CMD_CTX, "flash init") != ERROR_OK) return ERROR_FAIL; - if (command_run_line(CMD_CTX, "mflash init") != ERROR_OK) - return ERROR_FAIL; - if (command_run_line(CMD_CTX, "nand init") != ERROR_OK) return ERROR_FAIL; @@ -234,10 +232,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"); @@ -251,13 +246,13 @@ struct command_context *setup_command_handler(Jim_Interp *interp) &server_register_commands, &gdb_register_commands, &log_register_commands, + &rtt_server_register_commands, &transport_register_commands, &interface_register_commands, &target_register_commands, &flash_register_commands, &nand_register_commands, &pld_register_commands, - &mflash_register_commands, &cti_register_commands, &dap_register_commands, NULL @@ -343,6 +338,9 @@ int openocd_main(int argc, char *argv[]) if (ioutil_init(cmd_ctx) != ERROR_OK) return EXIT_FAILURE; + if (rtt_init() != ERROR_OK) + return EXIT_FAILURE; + LOG_OUTPUT("For bug reports, read\n\t" "http://openocd.org/doc/doxygen/bugs.html" "\n"); @@ -350,6 +348,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); @@ -365,9 +365,12 @@ int openocd_main(int argc, char *argv[]) adapter_quit(); + server_host_os_close(); + /* Shutdown commandline interface */ command_exit(cmd_ctx); + rtt_exit(); free_config(); if (ERROR_FAIL == ret)