X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Ftarget%2Ftarget.c;h=8c6d97dfc6cbeec0259fe543e2c2cdb429127d93;hp=531d632e698384ddec9dd321be8e12c84a0afe1d;hb=4fc97d3f2726efa147cfdb0c456eace51550e1e3;hpb=a582e9a8d183c56d1aa8ae18afc1c11e2cbd6d2d diff --git a/src/target/target.c b/src/target/target.c index 531d632e69..8c6d97dfc6 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -209,6 +209,8 @@ int target_init_handler(struct target_s *target, enum target_event event, void * if ((event == TARGET_EVENT_HALTED) && (target->reset_script)) { + target_unregister_event_callback(target_init_handler, priv); + script = fopen(target->reset_script, "r"); if (!script) { @@ -221,8 +223,6 @@ int target_init_handler(struct target_s *target, enum target_event event, void * fclose(script); jtag_execute_queue(); - - target_unregister_event_callback(target_init_handler, priv); } return ERROR_OK; @@ -904,7 +904,6 @@ int handle_target_command(struct command_context_s *cmd_ctx, char *cmd, char **a (*last_target_p)->working_areas = NULL; (*last_target_p)->backup_working_area = 0; - (*last_target_p)->endianness = TARGET_LITTLE_ENDIAN; (*last_target_p)->state = TARGET_UNKNOWN; (*last_target_p)->reg_cache = NULL; (*last_target_p)->breakpoints = NULL;