aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2017-11-04 09:47:02 +0100
committerAntonio Borneo <borneo.antonio@gmail.com>2020-03-12 09:43:55 +0000
commit9f4659ae6b246bcab77d915cee288b2307a926b3 (patch)
tree90fe7ca0767abdb1998586bbeb575d944641bbc8 /src
parent69f0105324f2fdcd0499ae07ada15d340762d061 (diff)
downloadriscv-openocd-9f4659ae6b246bcab77d915cee288b2307a926b3.zip
riscv-openocd-9f4659ae6b246bcab77d915cee288b2307a926b3.tar.gz
riscv-openocd-9f4659ae6b246bcab77d915cee288b2307a926b3.tar.bz2
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>
Diffstat (limited to 'src')
-rw-r--r--src/target/startup.tcl4
-rw-r--r--src/target/target.c7
-rw-r--r--src/target/target.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/src/target/startup.tcl b/src/target/startup.tcl
index cf844e1..976cd2a 100644
--- a/src/target/startup.tcl
+++ b/src/target/startup.tcl
@@ -66,7 +66,9 @@ proc ocd_process_reset_inner { MODE } {
if {![using_jtag] || [jtag tapisenabled [$t cget -chain-position]]} {
$t invoke-event examine-start
set err [catch "$t arp_examine allow-defer"]
- if { $err == 0 } {
+ if { $err } {
+ $t invoke-event examine-fail
+ } else {
$t invoke-event examine-end
}
}
diff --git a/src/target/target.c b/src/target/target.c
index 1ba4e09..61ed966 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -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);
diff --git a/src/target/target.h b/src/target/target.h
index 81fd9d2..b954ec2 100644
--- a/src/target/target.h
+++ b/src/target/target.h
@@ -275,6 +275,7 @@ enum target_event {
TARGET_EVENT_DEBUG_RESUMED, /* target resumed to execute on behalf of the debugger */
TARGET_EVENT_EXAMINE_START,
+ TARGET_EVENT_EXAMINE_FAIL,
TARGET_EVENT_EXAMINE_END,
TARGET_EVENT_GDB_ATTACH,