config_file_names[num_config_files] = NULL;
}
-FILE *open_file_from_path (command_context_t *cmd_ctx, char *file, char *mode)
+FILE *open_file_from_path (char *file, char *mode)
{
+ if (mode[0]!='r')
+ {
+ return fopen(file, mode);
+ } else
+ {
+
FILE *fp = NULL;
char **search_dirs = script_search_dirs;
char *dir;
}
if (fp)
- command_print(cmd_ctx, "opened %s", full_path);
+ DEBUG("opened %s", full_path);
return fp;
+ }
}
int parse_config_file(struct command_context_s *cmd_ctx)
{
target_unregister_event_callback(target_init_handler, priv);
- script = open_file_from_path(cmd_ctx, target->reset_script, "r");
+ script = open_file_from_path(target->reset_script, "r");
if (!script)
{
ERROR("couldn't open script file %s", target->reset_script);
switch (target->reset_mode)
{
case RESET_HALT:
- command_print(cmd_ctx, "nSRST pulls nTRST, falling back to RESET_RUN_AND_HALT");
+ command_print(cmd_ctx, "nSRST pulls nTRST, falling back to \"reset run_and_halt\"");
target->reset_mode = RESET_RUN_AND_HALT;
break;
case RESET_INIT:
- command_print(cmd_ctx, "nSRST pulls nTRST, falling back to RESET_RUN_AND_INIT");
+ command_print(cmd_ctx, "nSRST pulls nTRST, falling back to \"reset run_and_init\"");
target->reset_mode = RESET_RUN_AND_INIT;
break;
default:
{
int retval;
struct timeval timeout, now;
-
+ int once=1;
gettimeofday(&timeout, NULL);
timeval_add_time(&timeout, 0, ms * 1000);
{
break;
}
- command_print(cmd_ctx, "waiting for target %s...", target_state_strings[state]);
+ if (once)
+ {
+ once=0;
+ command_print(cmd_ctx, "waiting for target %s...", target_state_strings[state]);
+ }
gettimeofday(&now, NULL);
if ((now.tv_sec > timeout.tv_sec) || ((now.tv_sec == timeout.tv_sec) && (now.tv_usec >= timeout.tv_usec)))
{
- command_print(cmd_ctx, "timed out while waiting for target %s", target_state_strings[state]);
ERROR("timed out while waiting for target %s", target_state_strings[state]);
break;
}
if (image_open(&image, args[0], (argc >= 3) ? args[2] : NULL) != ERROR_OK)
{
- command_print(cmd_ctx, "load_image error: %s", image.error_str);
return ERROR_OK;
}
if (fileio_open(&fileio, args[0], FILEIO_WRITE, FILEIO_BINARY) != ERROR_OK)
{
- command_print(cmd_ctx, "dump_image error: %s", fileio.error_str);
return ERROR_OK;
}
if (image_open(&image, args[0], (argc == 3) ? args[2] : NULL) != ERROR_OK)
{
- command_print(cmd_ctx, "verify_image error: %s", image.error_str);
return ERROR_OK;
}