aboutsummaryrefslogtreecommitdiff
path: root/src/target/adi_v5_swd.c
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2020-06-29 13:34:07 +0200
committerTomas Vanek <vanekt@fbl.cz>2020-12-02 23:15:08 +0000
commit646c3c99020f8fdf7ee0adf821582238aac4a80c (patch)
tree58647f4f4ef0b211e69203a980d47aa4d08d4f00 /src/target/adi_v5_swd.c
parenta8edbd0200560bfd412c5c563908d860ed2c96a6 (diff)
downloadriscv-openocd-646c3c99020f8fdf7ee0adf821582238aac4a80c.zip
riscv-openocd-646c3c99020f8fdf7ee0adf821582238aac4a80c.tar.gz
riscv-openocd-646c3c99020f8fdf7ee0adf821582238aac4a80c.tar.bz2
arm_adi_v5: prevent possibly endless recursion in dap_dp_init()
If dap_dp_read_atomic() in 30 trials loop fails, dap->do_reconnect is set. Following dap_dp_read_atomic() calls dap_queue_dp_read() which in case of SWD transport calls swd_queue_dp_read(). It starts with swd_check_reconnect() and it calls swd_connect() because dap->do_reconnect is set. swd_connect() does some initialization, reads DPIDR and calls dap_dp_init() again! Moreover if dap_dp_init() is called from cortex_m_reset_(de)assert() one level of recursion is necessary to reconnect the target. Introduce dap_dp_init_or_reconnect() for use in cortex_m reset and similar. Remove loop of 30 atomic reads of DP_STAT to prevent unwanted recursion. Change-Id: I54052fdefe50bf5f7c7b59fe751fe2063d5710c9 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5729 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Diffstat (limited to 'src/target/adi_v5_swd.c')
0 files changed, 0 insertions, 0 deletions