target: reset examine after assert_reset

For some target, the API assert_reset() checks if the target has
been examined, with target_was_examined(), to perform conditional
operations like:
- assert adapter's srst;
- write some register to catch the reset vector;
- invalidate the register cache.

Targets created with -defer-examine gets the examine flag reset
right before entering in their assert_reset(), disrupting the
actions above.

For targets created with -defer-examine, move the reset examine
after the assert_reset().

Change-Id: If96e7876dcace8905165115292deb93a3e45cb36
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8293
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
Antonio Borneo 2024-04-08 17:42:52 +02:00
parent b5e7118048
commit 72b39088ee
1 changed files with 7 additions and 5 deletions

View File

@ -5365,17 +5365,19 @@ COMMAND_HANDLER(handle_target_reset)
return ERROR_FAIL;
}
if (target->defer_examine)
target_reset_examined(target);
/* determine if we should halt or not. */
target->reset_halt = (a != 0);
/* When this happens - all workareas are invalid. */
target_free_all_working_areas_restore(target, 0);
/* do the assert */
if (n->value == NVP_ASSERT)
return target->type->assert_reset(target);
if (n->value == NVP_ASSERT) {
int retval = target->type->assert_reset(target);
if (target->defer_examine)
target_reset_examined(target);
return retval;
}
return target->type->deassert_reset(target);
}