请问全志XR806芯片 如何使用watchpoint功能呢?
本回答来源全志XR806芯片 如何使用watchpoint功能?
以下是代码使用示例:
#include <debug/watchpoint.h>
static int watchpoint_test_value;
static struct watchpoint wp;
static enum cmd_status cmd_watchpoint_value_init(char *cmd)
{
int ret;
watchpoint_test_value = 1;
wp.address = (unsigned int)&watchpoint_test_value;
wp.length = sizeof(watchpoint_test_value);
wp.rw = DWT_WRITE;
ret = watchpoint_add(&wp);
if (ret) {
printf("watchpoint_add fail.\n");
}
return CMD_STATUS_OK;
}
static enum cmd_status cmd_watchpoint_value_change(char *cmd)
{
watchpoint_test_value = 0;
return CMD_STATUS_OK;
}