From: OpenOCD-Gerrit <ope...@us...> - 2020-03-12 09:44:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 9f4659ae6b246bcab77d915cee288b2307a926b3 (commit) from 69f0105324f2fdcd0499ae07ada15d340762d061 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9f4659ae6b246bcab77d915cee288b2307a926b3 Author: Tomas Vanek <va...@fb...> Date: Sat Nov 4 09:47:02 2017 +0100 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 <va...@fb...> Reviewed-on: http://openocd.zylin.com/4289 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 454ae0675..711171a34 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -4820,6 +4820,8 @@ The following target events are defined: @* Before target examine is called. @item @b{examine-end} @* After target examine is called with no errors. +@item @b{examine-fail} +@* After target examine fails. @item @b{gdb-attach} @* When GDB connects. Issued before any GDB communication with the target starts. GDB expects the target is halted during attachment. @@ -5991,7 +5993,8 @@ Used in kinetis 'fcf_source protection' mode only. @end deffn @deffn Command {kinetis mdm check_security} -Checks status of device security lock. Used internally in examine-end event. +Checks status of device security lock. Used internally in examine-end +and examine-fail event. @end deffn @deffn Command {kinetis mdm halt} diff --git a/src/target/startup.tcl b/src/target/startup.tcl index cf844e1f6..976cd2af5 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 1ba4e0987..61ed9662d 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 81fd9d23d..b954ec22d 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, diff --git a/tcl/target/klx.cfg b/tcl/target/klx.cfg index 36b6ed596..84f6535e3 100644 --- a/tcl/target/klx.cfg +++ b/tcl/target/klx.cfg @@ -56,9 +56,9 @@ if {[using_hla]} { echo " it without mass erase. Don't set write protection on the first block." echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!" echo "" -} { - # Detect secured MCU or boot lock-up in RESET/WDOG loop - $_CHIPNAME.cpu configure -event examine-start { +} else { + # Detect secured MCU + $_TARGETNAME configure -event examine-fail { kinetis mdm check_security } diff --git a/tcl/target/kx.cfg b/tcl/target/kx.cfg index 0ff5b0c53..1dd5d316c 100644 --- a/tcl/target/kx.cfg +++ b/tcl/target/kx.cfg @@ -58,9 +58,13 @@ if {[using_hla]} { echo " it without mass erase. Don't set write protection on the first block." echo "!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!" echo "" -} { +} else { # Detect secured MCU or boot lock-up in RESET/WDOG loop - $_CHIPNAME.cpu configure -event examine-start { + $_TARGETNAME configure -event examine-fail { + kinetis mdm check_security + } + # During RESET/WDOG loop the target is sometimes falsely examined + $_TARGETNAME configure -event examine-end { kinetis mdm check_security } ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 5 ++++- src/target/startup.tcl | 4 +++- src/target/target.c | 7 ++++++- src/target/target.h | 1 + tcl/target/klx.cfg | 6 +++--- tcl/target/kx.cfg | 8 ++++++-- 6 files changed, 23 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |