target/cortex_m: inform if an external reset occurs 40/4840/3
authorTomas Vanek <vanekt@fbl.cz>
Wed, 9 Jan 2019 10:59:35 +0000 (11:59 +0100)
committerTomas Vanek <vanekt@fbl.cz>
Sun, 27 Jan 2019 20:59:13 +0000 (20:59 +0000)
Change-Id: I873e73012c44aac7af3b21b633bd096d8e299d07
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4840
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/cortex_m.c

index 06e1c1c..3c97bc3 100644 (file)
@@ -510,7 +510,10 @@ static int cortex_m_poll(struct target *target)
        }
 
        if (cortex_m->dcb_dhcsr & S_RESET_ST) {
-               target->state = TARGET_RESET;
+               if (target->state != TARGET_RESET) {
+                       target->state = TARGET_RESET;
+                       LOG_INFO("%s: external reset detected", target_name(target));
+               }
                return ERROR_OK;
        }