aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cortexm3.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cortexm3.c b/src/cortexm3.c
index 2ba10a3..9353c89 100644
--- a/src/cortexm3.c
+++ b/src/cortexm3.c
@@ -660,7 +660,9 @@ cm3_set_hw_wp(struct target_s *target, uint8_t type, uint32_t addr, uint8_t len)
}
for(i = 0; i < hw_watchpoint_max; i++)
- if((hw_watchpoint[i].type) == 0) break;
+ if((hw_watchpoint[i].type == 0) &&
+ ((adiv5_ap_mem_read(t->ap, CM3_DWT_FUNC(i)) & 0xF) == 0))
+ break;
if(i == hw_watchpoint_max) return -2;