Page 1 of 1

HW data watchpoints

Posted: Thu Feb 06, 2025 11:33 am
by vvb333007
Hello!

Xtensa ISA reference mention data breakpoint registers, and ESP-IDF even has the code (xt_utils, set_watchpoint).

But how can these be used?

I mean, after I write the data address/length in a corresponding DBREAKA, DBREAKC registers, what would happen on data access?

An interrupt? Which on? How to hook on it?

I went with the gdbstub code, but quickly get lost. Is there any documentation on xtensa arch component of esp-idf? I mean, examples, docs, with these xt_... functions.

Thanks!

PS: Oh I forgot to mention what it is all about. I would like to get a control, wwhen one of FreeRTOS tasks accesses memory region of interest. After taking control and performing some job, control must be returned to the task which triggered the watchpoint.

Re: HW data watchpoints

Posted: Fri Feb 07, 2025 2:29 am
by ESP_Sprite
The breakpoints trigger a debug interrupt, which by default triggers the panic handler.

The most compatible way to insert code in here may be to wrap the panic handler to do your own thing. Example code is e.g. here. To wrap the panic handler, you need to put these lines into your projects CMakeLists.txt. Note that you need to have gdbstub disabled, otherwise that takes precedence.