HW data watchpoints

vvb333007
Posts: 8
Joined: Wed Jul 31, 2024 5:53 am

HW data watchpoints

Postby vvb333007 » Thu Feb 06, 2025 11:33 am

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.

ESP_Sprite
Posts: 9985
Joined: Thu Nov 26, 2015 4:08 am

Re: HW data watchpoints

Postby ESP_Sprite » Fri Feb 07, 2025 2:29 am

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.

Who is online

Users browsing this forum: No registered users and 157 guests