Skip to main content
kr_rahul
Associate
August 15, 2009
Question

Data Watchpoint on Cortex M3

  • August 15, 2009
  • 12 replies
  • 3291 views
Posted on August 15, 2009 at 11:59

Data Watchpoint on Cortex M3

    This topic has been closed for replies.

    12 replies

    st3
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Quote:

    I was wondering whether anyone has tried using the data-watch-point feature of Cortex M3 on STM32.

    Yes, I have had this working with Keil; so it must be down to the tools and/or your usage of them - it's not a limitation of the chip itself

    kr_rahul
    kr_rahulAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Hi,

    I am trying to place a data (access) watch-point on a global variable using OpenOCD which I have connected to STM32 through Amontec JTAG. However the watch-point is never hit (i.e. the program execution doesn't halt even when the variable is read/written or loaded/stored).

    Hence, I was wondering whether anyone has tried using the data-watch-point feature of Cortex M3 on STM32.

    Thanks and regards,

    Rahul

    sjo
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    It can be done in openocd:

    # break when variable @ adr 0x20000000 is 5

    mon wp 0x20000000 4 a 5 0

    if you are not using gdb then remove the mon (monitor) cmd

    Cheers

    sjo

    kr_rahul
    kr_rahulAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Dear st7,

    Thanks for your reply. Could you please elaborate as to which Menu-option in Keil, should I use for setting hardware data watch-points (read, write OR access).

    My intention is to set an access watchpoint data watchpoint on a global variable. Through the watch-window I can verify that the global variable (which is a loop_count) is changing with every iteration of the loop. Further I can get the memory location of the global variable (as 0x200000e8) from the map file. I can also see that in the memory window that this memory location is getting updated regularly.

    However I haven't been able to place a h/w watch-point for read/write/access on this variable.

    I have got ver-3.72 of Keil-uVision which I can connect to STM32 using ST-LINK JTAG debugger, through the DLLs provided by Keil.

    Thanks again,

    Best Regards,

    Rahul

    kr_rahul
    kr_rahulAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Dear st7,

    Thanks again for your quick response.

    I can get the breakpoint-window (for entering watch-points) through the debug menu in the simulator mode. However when I am debugging on the actual hardware (with code in flash and data in RAM) this window doesn't appear. I have tried clicking on the ''Breakpoints'' icon as well as pressing ''Cntrl+B''.

    Hence could you please clarify which JTAG debugger you were using for testing watchpoints.

    I am using ST-LINK JTAG debugger. The associated dll files supplied by keil are:

    a) ST-LINKIII-KEIL.dll

    b) STLinkIIIUSBDriver.dll

    Thanks again for your help

    Regards,

    Rahul

    st3
    Associate III
    May 17, 2011
    sjo
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Just had a quick look through the code, looks like it has not been implemented for cortex_m3 yet.

    I will look into adding it.

    Cheers

    sjo

    kr_rahul
    kr_rahulAuthor
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    Dear sjo,

    Thanks for your suggestion regarding the monitor command. I did try the your suggestion with regards to openOCD (connected to stm32 through amontec JTAG).

    I am using gdb client (yagarto) for driving openOCD.

    The global variable which I need to track is located at 0x200000e8 (in RAM).

    I was able to send monitor command at this address:

     

    (gdb) mon wp 0x200000e8 4 a 5 0

     

     

    (gdb) c

     

    Continuing.

     

    Cannot watch data values

     

    From the console output, I felt that there were some issues in handling this command.

    I tried the above command on GDB client without mon, but that gave the following error:

     

    (gdb) wp 0x200000e8 4 a 5 0

     

    Undefined command: ''wp''. Try ''help''.

     

    Previously, I tried placing a data watch-point using awatch command, However that too didn't cause the program to halt (in the case below I had to stop the program by a Ctrl-C

     

    (gdb) awatch loop_count

     

    Hardware access (read/write) watchpoint 1: loop_count

     

    (gdb) c

     

    Continuing.

     

     

    Program received signal SIGINT, Interrupt.

     

    From the transaction-logs, the RSP packet sent for the above command was:

     

    z4,200000e8,4

     

    My open-ocd version is the following:

    Open On-Chip Debugger 0.1.0 (2009-01-21-21:15) Release

    Do you think the watchpoint feature would work with the version or should I shift to a newer version

    -thanks and regards,

    Rahul

    sjo
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    My reply we in relation to openocd, as this was your original question?

    Cheers

    sjo

    sjo
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:19

    The watchpoint on a address does work - last time i tried it - you just use a mask of 0xffffffff, eg. to break on write.

    mon wp 0x20000000 4 w 0 0xffffffff

    we have made quite a few changes over the last few months to openocd, so we may have upset a few things. This was mainly for cortex_a8 support.

    Cheers

    sjo

    PS. incase you are wondering i am an admin/dev on openocd.