From: Tarek BOCHKATI Date: Tue, 7 May 2019 15:16:15 +0000 (+0200) Subject: cortex_m: set the debug reason to DBGRQ when NVIC_DFSR indicates EXTERNAL X-Git-Tag: v0.11.0-rc1~654 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=5b768b0d39e629b71b5d729fb6a6919cda342630 cortex_m: set the debug reason to DBGRQ when NVIC_DFSR indicates EXTERNAL By definition the EXTERNAL bit in Debug Fault Status Register indicates that an external debug request (EDBGRQ) signal was asserted. Usage example: this could be done by CTI in multicore devices in order to halt all the cores together. Change-Id: I7830455ce5da6702b7d08c8fa7bfe80e4d8a5055 Signed-off-by: Tarek BOCHKATI Reviewed-on: http://openocd.zylin.com/5157 Tested-by: jenkins Reviewed-by: Tomas Vanek --- diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index fba832c787..ce3ab09c01 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -392,7 +392,9 @@ static int cortex_m_examine_debug_reason(struct target *target) target->debug_reason = DBG_REASON_WATCHPOINT; else if (cortex_m->nvic_dfsr & DFSR_VCATCH) target->debug_reason = DBG_REASON_BREAKPOINT; - else /* EXTERNAL, HALTED */ + else if (cortex_m->nvic_dfsr & DFSR_EXTERNAL) + target->debug_reason = DBG_REASON_DBGRQ; + else /* HALTED */ target->debug_reason = DBG_REASON_UNDEFINED; } diff --git a/src/target/cortex_m.h b/src/target/cortex_m.h index c33486273f..2f29903c8b 100644 --- a/src/target/cortex_m.h +++ b/src/target/cortex_m.h @@ -127,6 +127,7 @@ #define DFSR_BKPT 2 #define DFSR_DWTTRAP 4 #define DFSR_VCATCH 8 +#define DFSR_EXTERNAL 16 #define FPCR_CODE 0 #define FPCR_LITERAL 1