target/cortex_m: drop useless target_halt() call
commit226085065bdfdfd44bfadbfb2973971ff154eb22
authorTomas Vanek <vanekt@fbl.cz>
Sun, 21 Jan 2024 11:05:35 +0000 (21 12:05 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Sun, 11 Feb 2024 23:02:29 +0000 (11 23:02 +0000)
tree59d28bf14c15493e00db9237851d83a88eca904d
parent38616990744b2bac7026f0d41da9247b42494379
target/cortex_m: drop useless target_halt() call

In 2008 the commit 182936125371 ("define resetting
the target into the halted or running state as an atomic operation.")
introduced the target_halt() call to the end of cortex_m3_assert_reset(),

Checkpatch-ignore: GIT_COMMIT_ID

A year later the commit ed36a8d15dfd
("... Updated halt handling for cortex_m3")
prevented cortex_m3_halt() take any action in case of TARGET_RESET state.
This narrowed the target_halt() called from cortex_m3_assert_reset()
to setting target->halt_issued and storing a time stamp.

Introducing ocd_process_reset(_inner) made the setting of halt_issued
and halt_issued_time useless. The Tcl function waits for halt
of all targets if applicable.

cortex_m_halt() and also target_halt() does not work as expected
if the cached target state is TARGET_RESET (although the core could
be out of reset and ready to be halted, just have not been polled).
Explicit Tcl arp_poll must be issued in many scenarios.

Remove the useless hack.

Also remove the explicit error return from cortex_m_halt_one()
in case of RESET_SRST_PULLS_TRST and asserted srst. If the communication
with the target is gated by any reset, cortex_m_write_debug_halt_mask()
fails. Propagate the error return of this call instead.

Change-Id: I0da05b87f43c3d0facb78e54d8f00c1728fe7c46
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8098
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
src/target/cortex_m.c