target: add examine-fail event

A configuration script may want to check the reason why examine fails
e.g. device has security lock engaged.

tcl/target/kx.cfg and klx.cfg is modified to use the new event
for testing of the security lock of Kinetis MCU

Change-Id: Id1d3a79d24e84b513f4ea35586cd2ab0437ff9b3
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4289
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Tomas Vanek
2017-11-04 09:47:02 +01:00
committed by Antonio Borneo
parent 69f0105324
commit 9f4659ae6b
6 changed files with 23 additions and 8 deletions

View File

@@ -219,6 +219,7 @@ static const Jim_Nvp nvp_target_event[] = {
{ .value = TARGET_EVENT_RESET_END, .name = "reset-end" },
{ .value = TARGET_EVENT_EXAMINE_START, .name = "examine-start" },
{ .value = TARGET_EVENT_EXAMINE_FAIL, .name = "examine-fail" },
{ .value = TARGET_EVENT_EXAMINE_END, .name = "examine-end" },
{ .value = TARGET_EVENT_DEBUG_HALTED, .name = "debug-halted" },
@@ -708,13 +709,17 @@ static int default_check_reset(struct target *target)
return ERROR_OK;
}
/* Equvivalent Tcl code arp_examine_one is in src/target/startup.tcl
* Keep in sync */
int target_examine_one(struct target *target)
{
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_START);
int retval = target->type->examine(target);
if (retval != ERROR_OK)
if (retval != ERROR_OK) {
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_FAIL);
return retval;
}
target_call_event_callbacks(target, TARGET_EVENT_EXAMINE_END);