target/adi_v5_swd, cortex_m: properly handle more cases requiring reconnect
commit492bab62abe6e94a302899ed19af7e1b23365e78
authorPaul Fertser <fercerpav@gmail.com>
Wed, 11 Mar 2015 08:33:55 +0000 (11 11:33 +0300)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 25 Mar 2015 21:32:06 +0000 (25 21:32 +0000)
tree7ff29fdc43fb0a831bd22a962095396060bfe928
parentef02b69b14d133b061217a91add5a028a77e86bc
target/adi_v5_swd, cortex_m: properly handle more cases requiring reconnect

This brings SWD reconnection procedure in line with the ARM
documentation and changes cortex_m reset procedure to make use of it.

The motivation behind this patch is to make SAM4L "reset" and "reset
halt" properly without SRST. The complication here is that EDBG issues
an additional read of DP_RDBUFF automatically right after writing
SYSRESETREQ, that leads to a FAULT which needs to be dealt with
properly. With this patch the very first ahbap_debugport_init DAP
access will make SWD layer properly reinitialise the link before
continuing.

Runtime tested with mbed CMIS-DAP + KL25 only.

Change-Id: Ic506f9db30931dfa60860036b83f73b897975909
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2596
Tested-by: jenkins
Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
src/target/adi_v5_swd.c
src/target/cortex_m.c