CODECOMPOSER: Adding a data watchpoint in CCS's debugger and changing compilation optimization

Part Number: CODECOMPOSER
Other Parts Discussed in Thread: AWR2944EVM, AWR2944

Tool/software:

Hello TI experts,

I am working with the HECR demo for the AWR2944EVM. Currently I am debugging the trackers code within CCS12. 

I have modified the demo to stream custom debugging TLVs and I have found out that the key problem is that the tracks don't get spawned because the if statement inside of gtrack_moduleAllocate inside gtrack_module.c is never true:

  • if (fabsf(mCurrent.vector.doppler - mCenter.vector.doppler) < inst->params.allocationParams.maxVelThre)

This seems to be because inst->params is populated with incorrect data despite the settings in chirp_design_HECR.h. To investigate this further I have several questions.

So that is why I want to ask you:

  1. How to set a data watchpoint for inst->params.allocationParams , so that I can analyze all reads/writes to this variables address during program execution?
  2. How can I change the compilers optimization settings so that it includes more debugging flags (, i.e. form  -O3to -O0)?

Regards,
Mark

  • Hello,

    How to set a data watchpoint for inst->params.allocationParams , so that I can analyze all reads/writes to this variables address during program execution?

    You can set a data watchpoint on an expression or a direct address: https://software-dl.ti.com/ccs/esd/documents/users_guide_ccs/ccs_debug-main.html#watchpoints. Depending on the cpu you can specify to trigger on a read, write, or both.

    How can I change the compilers optimization settings so that it includes more debugging flags (, i.e. form  -O3to -O0)?

    For the best debug experience you would want optimization off. For the ARM clang compiler, that would be "0". For the C6x compiler, that would be "off". As you turn on optimization, it will start impacting source level debug. Something like -O3 would have high impact, making source debug very difficult:

    https://dev.ti.com/tirex/explore/node?node=A__AA6fEd9YTSwdDSyHdoLE9Q__ccs_devtools__FUz-xrs__LATEST

    Thanks

    ki

  • You can set a data watchpoint on an expression or a direct address: https://software-dl.ti.com/ccs/esd/documents/users_guide_ccs/ccs_debug-main.html#watchpoints. Depending on the cpu you can specify to trigger on a read, write, or both.

    I just realized you are using the older CCS 12.x version. Please refer to this link instead: software-dl.ti.com/ccs/esd/documents/users_guide_12.8.0/ccs_debug-main.html#watchpoints

    Thanks

    ki

  • Hello Ki,

    thank you for your response. As suggested, I did follow the manuals instructions but I am unable to set activate the watchpoint set at my variable of interest. I keep getting a warning: ' "numClusterEvents" does not resolve to an address'. Please take a look: 

    Concerning the optimization, the provided link discusses the overall principle and tradeoffs - that I do know. What I would like to get is guidance how to change the optimization for the whole project in CCS.

    Thank you for your help.
    Best regards,
    Mark

  • Hello,

    I keep getting a warning: ' "numClusterEvents" does not resolve to an address'

    You will need to enter an expression that resolves to an address. Or simply specify the exact address.

    how to change the optimization for the whole project in CCS.

    Check the compiler build properties:

    https://software-dl.ti.com/ccs/esd/documents/users_guide_12.8.0/ccs_project-management.html#build-properties

  • Hello Ki,

    thanks for your swift answer!

    I managed to resolve the optimization level. I have set it to O0.

    Concerning the watchpoint - it would be great if I could get some more assistance with this.

    I know that inst->params.allocationParams.maxVelThre is written to upon initialization within mmw_load_params.c, so to my understanding if I set a watchpoint on it inside gtrack_module.c, which is used on a per frame basis. Then the program should stop when the parameter is initialized within mmw_load_params.c, is that correct? 

    I did do what I described above, but the program did not halt it's execution at all - why is that?

    You also write that I can simple specify the address that I want to watch, how can I do that?

      

    Thanks for your help!
    Best regards,
    Mark

  • You also write that I can simple specify the address that I want to watch, how can I do that?

    In the Breakpoints view:

    https://software-dl.ti.com/ccs/esd/documents/users_guide_12.8.0/ccs_debug-main.html#breakpoints-view

    You can use the option to add a new hardware watchpoint:

    A dialog will appear where you can explicitly specify an absolute address:

    Please set on the absolute address and see if that helps. Open the address in the Memory view to check the contents.

    Thanks

    ki

  • Hi,

    thanks for your answer. Unfortuneatly I still have some issue, here is what I do step by step:

    1.) Set a breakpoint within a function (, in my case gtrack_step.c).


    2.) When the program halts I use the "Expressions" view to see the address of interest, in my case it is a member of a struct:

    inst = (GtrackModuleInstance *)handle;
    inst->wasAllocateCalled = 0;


    3.) I right click on its field in the watchpoint tab and select hardware watchpoint, which creates in the "Breakpoints" tab a new breakpoint. In my case at the address 0x102230D0. This corresponds to the address of the variable of interest as seen in the "Expressions" tab.

    4.) I click step return or resume to continue the programs execution so that the code flows as during normal operations.


    ...But my watchpoint never halts the execution of the program despite me seeing that it's watched value gets toggled.


    So my question is what am I doing wrong?

  • Can you show me the properties of the watchpoint you set? Please expand all the nodes so that they are visible:

    https://software-dl.ti.com/ccs/esd/documents/users_guide_12.8.0/ccs_debug-main.html#breakpoint-properties

  • Hello Ki,

    The action is "Remain Halted", as shown here in the breakpoints properties:

    Moreover to make sure that I am not doing some stupid mistake, please take a look at this short screen capture. Note that gtrack_step.c is called before gtrack_module.c. In gtrack_step.c the value of inst->wasAllocateCalled = 0; is set to 0 and inside of gtrack_module.c it is set to 1, which happens every frame. My current frame rate is 250ms.

  • Thank you for the video. I don't see anything wrong with the watchpoint setup. I was testing watchpoints with various targets I have and it worked. However I did not try with the AWR2944. I will need to request a board and test it on this specific target.

  • Hello Ki,

    However I did not try with the AWR2944. I will need to request a board and test it on this specific target

    please note that the variable that I tested in this video is a variable added by me to the source code files. However, this one inst->params.allocationParams.maxVelThre is used by the original source code. Also note that there is a bug in TIs HECR demo as resolved here:  RE: AWR2944EVM: HECR demo tracker issues (, incl. documentation discrepancy)  

  • Can you get the watchpoint to trigger at all with any variable/address?

    Can you also provide your programs? I have the toolbox and SDK installed but I am having issues building the examples. Instead of troubleshooting the build errors (I am a tools experts but not a device/SDK expert) it may be easier to use the program you are using. You can share privately via private E2E message.

  • Hello Ki,

    I did try setting a breakpoint to other address locations, I cannot get this to work at all. For example I tried to set a watchpoint on numObjOut inside the function MmwDemo_handleObjectDetResult - this will change every frame. Moreover it is in the demo's mms_main.c file by default.

    Concerning the program - yes I can. But I don't think that it changes much when it comes to the debugger. I was also unable to set the watchpoint in a straight out of the SDK HECR demo. 

    For now maybe try it out on the default HECR demo? I am using radar_toolbox_3_20_00_04. As mentioned the tracker is not initialized properly. But this doesn't matter for setting breakpoints/watchpoints within the scope of the mss_main.c file. 

    Best regards,

    Mark

  • For now maybe try it out on the default HECR demo? I am using radar_toolbox_3_20_00_04

    Is that the awr2944_corner_radar projects? These seem to build ok. I will try with these. It is a local holiday today so I will give this a try tomorrow when I am back in the office.

    Thanks

    ki

  • Yes exactly, I am working with this demo: 

    C:\ti\radar_toolbox_3_20_00_04\source\ti\examples\Automotive_ADAS_and_Parking\high_end_corner_radar\src

    They do build out of the box, but the tracker doesn't initialize properly.

    Enjoy your holiday!

    Best,

    Mark

  • Thanks, I did build and run those example and applied your fixes from the other thread. For some reason it doesn't appear to run correctly however. I'll need to investigate this further.

    However I did a basic test of watchpoints on the R5 and it worked for me. Can you try this extremely simple test:

    Create a global integer variable. Then in the source, access it somehow. Then build/load the program and set a watchpoint that will trigger a halt on ANY access. See if it triggers a halt.

    An example of this is:

    When line 3113 is executed, the watchpoint would detect the read access at &gVar and trigger a halt.

  • Hello Ki,

    I did as instructed, the watchpoint worked:

  • Basic watchpoint functionality seems to work. I tried with both Memory for Write and Any and both seemed to work as expected. The question is why it wasn't working for the variables in question for you. Can you try "Any" for memory and see if at least that will trigger for anything?

  • Hello Ki, 

    did you try to do it loc a function scope variable? I tried to do it as in this shown example but it doesn't work.

    Maybe I don't understand something correctly, but to my knowledge as this variable has been initialized it should have the same in memory location.

    Regards,

    Mark 

  • did you try to do it loc a function scope variable?

    No. You would not want to do this with a local variable since the address can change each time the function is called since local variables are typically stored on the stack and the dynamic nature of the stack.

    watchpoints are typically used for global/static variables.