/* Try to initialize & examine the JTAG chain at this point, but
* continue startup regardless */
- if (jtag_init(CMD_CTX) == ERROR_OK)
+ command_context_mode(CMD_CTX, COMMAND_CONFIG);
+ if (command_run_line(CMD_CTX, "jtag init") == ERROR_OK)
{
- LOG_DEBUG("jtag init complete");
- if (target_examine() == ERROR_OK)
- {
- LOG_DEBUG("jtag examine complete");
- }
+ command_context_mode(CMD_CTX, COMMAND_EXEC);
+ LOG_DEBUG("Examining targets...");
+ if (target_examine() != ERROR_OK)
+ LOG_DEBUG("target examination failed");
+ command_context_mode(CMD_CTX, COMMAND_CONFIG);
}
+ else
+ LOG_WARNING("jtag initialization failed; try 'jtag init' again.");
- if (flash_init_drivers(CMD_CTX) != ERROR_OK)
+ if (command_run_line(CMD_CTX, "flash init") != ERROR_OK)
return ERROR_FAIL;
- LOG_DEBUG("flash init complete");
- if (mflash_init_drivers(CMD_CTX) != ERROR_OK)
+ if (command_run_line(CMD_CTX, "mflash init") != ERROR_OK)
return ERROR_FAIL;
- LOG_DEBUG("mflash init complete");
- if (nand_init(CMD_CTX) != ERROR_OK)
+ if (command_run_line(CMD_CTX, "nand init") != ERROR_OK)
return ERROR_FAIL;
- LOG_DEBUG("NAND init complete");
- if (pld_init(CMD_CTX) != ERROR_OK)
+ if (command_run_line(CMD_CTX, "pld init") != ERROR_OK)
return ERROR_FAIL;
- LOG_DEBUG("pld init complete");
+ command_context_mode(CMD_CTX, COMMAND_EXEC);
/* initialize telnet subsystem */
gdb_target_add_all(all_targets);
struct command_context *global_cmd_ctx;
/* NB! this fn can be invoked outside this file for non PC hosted builds */
-struct command_context *setup_command_handler(void)
+struct command_context *setup_command_handler(Jim_Interp *interp)
{
log_init();
LOG_DEBUG("log_init: complete");
struct command_context *cmd_ctx;
- global_cmd_ctx = cmd_ctx = command_init(openocd_startup_tcl);
+ global_cmd_ctx = cmd_ctx = command_init(openocd_startup_tcl, interp);
register_commands(cmd_ctx, NULL, openocd_command_handlers);
/* register subsystem commands */
/* initialize commandline interface */
struct command_context *cmd_ctx;
- cmd_ctx = setup_command_handler();
+ cmd_ctx = setup_command_handler(NULL);
#if BUILD_IOUTIL
if (ioutil_init(cmd_ctx) != ERROR_OK)