riscv-openocd/src
Tomas Vanek 4553abf906 arm_adi_v5: fix wrong addressing after change of CSW_ADDRINC
Problem: If the same memory location is accessed alternatively
by MEM-AP banked data registers without autoincrement and by standard
autoincremented read/write, TAR register is not updated correctly.

How to replicate: On a Cortex-M issue
    mdw 0xe000edf0
multiple times. When poll is on (poll reads the same memory location)
only the first read is correct.
0xe000edf0: 01000000
0xe000edf0: 00000000
0xe000edf0: 20002640
0xe000edf0: 01000000
0xe000edf0: 00000000
0xe000edf0: 00000000

No problems with poll off.
0xe000edf0: 01000000
0xe000edf0: 01000000
0xe000edf0: 01000000

mem_ap_setup_tar() writes to MEM_AP_REG_TAR if requested TAR value
changed or CSW_ADDRINC_... is currently active.
However if an autoincremented access has been issued and autoinc
switched off in CSW afterwards, TAR does not get updated.

The change introduces mem_ap_update_tar_cache() which is called
after queuing of any access to MEM_AP_REG_DRW. It simulates
TAR increment to keep tar_value in sync with MEM_AP.
Crossing tar autoincrement block boundary invalidates cached value.

mem_ap_write() and mem_ap_read() do not check tar autoincrement
block boundary, mem_ap_setup_tar() is called before each transfer instead.

dap_invalidate_cache() is introduced to ensure invalidation
of all cached values during dap_dp_init() and swd_connect()

Change-Id: I815c2283d2989cffd6ea9a4100ce2f29dc3fb7b4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4162
Tested-by: jenkins
Reviewed-by: Christopher Head <chead@zaber.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2018-01-05 10:06:30 +00:00
..
flash flash/nor/stm32f2x: fix erase on STM32F413/423 2017-12-12 21:16:24 +00:00
helper Fix GCC7 warnings about switch-case fallthroughs 2017-10-23 10:54:16 +01:00
jtag jtag/drivers/cmsis-dap: fix connect under reset 2018-01-03 10:56:32 +00:00
pld Convert to non-recursive make 2016-12-08 16:23:10 +00:00
rtos rtos: Use 'bool' as return type for detect_rtos() 2017-12-06 21:01:12 +00:00
server server/gdb: Use 'bool' instead of 'int' for boolean values 2017-12-06 21:01:39 +00:00
svf Fix GCC7 warnings about switch-case fallthroughs 2017-10-23 10:54:16 +01:00
target arm_adi_v5: fix wrong addressing after change of CSW_ADDRINC 2018-01-05 10:06:30 +00:00
transport Convert to non-recursive make 2016-12-08 16:23:10 +00:00
xsvf Convert to non-recursive make 2016-12-08 16:23:10 +00:00
Makefile.am Convert to non-recursive make 2016-12-08 16:23:10 +00:00
hello.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
hello.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00
main.c Remove FSF address from GPL notices 2016-05-24 22:30:01 +01:00
openocd.c server/server: Remove all exit() calls 2017-04-25 16:56:35 +01:00
openocd.h Make #include guard naming consistent 2016-05-24 22:30:55 +01:00