target/cortex_m: fix debug reason after reset halt

[1] removed target_halt() from cortex_m_assert_reset()
It broke debug_reason tracking and the previous reason
was shown after reset halt.

Set debug_reason to DBG_REASON_DBGRQ during reset halt
preparation.

Fixes: [1] commit 226085065b ("target/cortex_m: drop useless target_halt() call")
Reported-by: Marc Schink <dev@zapb.de>
Change-Id: I685618ed158abde11f6e00eeeee1dfa8ed90952d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8945
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
This commit is contained in:
Tomas Vanek
2025-06-14 12:18:53 +02:00
committed by Antonio Borneo
parent 9e4b6b90c9
commit 82dc399e5e
+1
View File
@@ -1779,6 +1779,7 @@ static int cortex_m_assert_reset(struct target *target)
int retval2;
retval2 = mem_ap_write_atomic_u32(armv7m->debug_ap, DCB_DEMCR,
TRCENA | VC_HARDERR | VC_BUSERR | VC_CORERESET);
target->debug_reason = DBG_REASON_DBGRQ;
if (retval != ERROR_OK || retval2 != ERROR_OK)
LOG_TARGET_INFO(target, "AP write error, reset will not halt");
}