esp_cpu_set_watchpoint() function
Set and enable a hardware watchpoint on the current CPU Set and enable a hardware watchpoint on the current CPU, specifying the memory range and trigger operation. Watchpoints will break/panic the CPU when the CPU accesses (according to the trigger type) on a certain memory range.
Arguments
wp_num
Hardware watchpoint number [0..SOC_CPU_WATCHPOINTS_NUM - 1]
wp_addr
Watchpoint's base address, must be naturally aligned to the size of the region
size
Size of the region to watch. Must be one of 2^n and in the range of [1 ... SOC_CPU_WATCHPOINT_MAX_REGION_SIZE]
Return value
ESP_ERR_INVALID_ARG on invalid arg, ESP_OK otherwise
Notes
Overwrites previously set watchpoint with same watchpoint number. On RISC-V chips, this API uses method0(Exact matching) and method1(NAPOT matching) according to the riscv-debug-spec-0.13 specification for address matching. If the watch region size is 1byte, it uses exact matching (method 0). If the watch region size is larger than 1byte, it uses NAPOT matching (method 1). This mode requires the watching region start address to be aligned to the watching region size.
![]()
esp_cpu_set_watchpoint(i, (void *)wp_list[i], wp_size[i], wp_access[i]);
esp_cpu_set_watchpoint() is called by 2 functions and calls 1 function:
![]()
esp_cpu_set_watchpoint()
esp_cpu_set_watchpoint() reads 3 variables:
![]()
esp_cpu_set_watchpoint()