cancel
Showing results for 
Search instead for 
Did you mean: 

Conditional data watchpoint with debugger or DWT

frackers
Senior

I've tried both Eclipse and the VSCode Cortex debug plugin to set a conditional watchpoint but both fail (break every access irrespective of value). This I guess is due to OpenOCD not supporting the multiple compare registers in the DWT that are required for a conditional.

Is there a way I can code a watchpoint into the DWT directly so I can find what is causing my memory corruption?

I found the following snippet on StackOverflow but not idea what the magic number is about for FUNCTION1 and whether a conditional can only check for equality ?

DWT->COMP2 = <address to compare>;
DWT->FUNCTION2 = 0;
DWT->COMP1 = <word to compare>;
DWT->FUNCTION1 = 0x20B06;

Can someone enlighten me with perhaps a worked example that includes a breakpoint or other trap so I can stop execution and find the culprit ?

Cheers

1 REPLY 1
Frank4
Associate II

Hi frackers, did you end up figuring it out? I'm trying to do the same as you, and using by pyOCD the watchpoint condition gets ignored, so I'm guessing it isn't properly set up by the debugger like you said.

 

I found some doc from TI on the DWT registers. Not easy to decipher so before I did in, I wanted to know whether you succeeded.

 

Ref: http://downloads.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/tirtos/2_14_03_28/exports/tirtos_full_2_14_03_28/products/cc13xxware_2_01_00_16101/doc/register_descriptions/CPU_MMAP/CPU_DWT.html#FUNCTION0