target/cortex_a: add support for watchpoints

The current implementation of OpenOCD does not support watchpoints for
cortex_a architecture. So, I replaced the add_watchpoint and
remove_watchpoint with the specific implementation for the
cortex a and using the breakpoint implementation and the arm
documentation [1] as reference. In particular, I have made the
following changes:

* added the following functions

- cortex_a_add_watchpoint
  This wrapper function check whether there are any watchpoint
  available on the target device by calling cortex_a_set_watchpoint.

- cortex_a_set_watchpoint
  This function is responsible for settings the watchpoint register
  pair. In particular, it sets the WVR and the WCR registers with
  the cortex_a_dap command.

- cortex_a_remove_watchpoint
  This wrapper function the selected watchpoint on the target device
  by calling cortex_a_unset_watchpoint.

- cortex_a_unset_watchpoint
  This function sets both the WVR and the WCR registers to zero, thus
  unsetting the watchpoint.

[1]
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0464f/BCGDHIEJ.html

Change-Id: I86611dab474cb84836662af572b17636dc68e282
Signed-off-by: Chengyu Zheng <chengyu.zheng@polimi.it>
Reviewed-on: http://openocd.zylin.com/3913
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
This commit is contained in:
Chengyu Zheng
2016-12-14 12:18:10 +01:00
committed by Antonio Borneo
parent b40dc09dd9
commit 1fb736f6c5
4 changed files with 201 additions and 9 deletions

View File

@@ -71,6 +71,13 @@ struct cortex_a_brp {
uint8_t BRPn;
};
struct cortex_a_wrp {
int used;
uint32_t value;
uint32_t control;
uint8_t WRPn;
};
struct cortex_a_common {
int common_magic;
@@ -92,6 +99,9 @@ struct cortex_a_common {
int brp_num;
int brp_num_available;
struct cortex_a_brp *brp_list;
int wrp_num;
int wrp_num_available;
struct cortex_a_wrp *wrp_list;
uint32_t cpuid;
uint32_t didr;