1 Reply Latest reply on Nov 20, 2011 9:42 AM by userc_41579

    PSoC Creator Debugger Watch Memory Location

      This blog post tells you how to observe memory locations in the debugger watch window. This is useful if you want to group together and view separate memory locations that are linked by functionality such as DAC configuration, DAC routing and DAC trim.


      To observe memory in the XDATA space, use the following in the watch window: 





      Where YYYY is a 2 byte address. This limits the addressable range for XDATA to 64KB. The char designator restricts it to a single byte, which for most debugging purposes is sufficient.


      *Note: There are no spaces in the name.


      Other observable memory locations:


      The address spaces are limited based on address type through the watch window (Keil limit), and everything must be addressed via the 24 bit address.


      XDATA: 0x01YYYY    64k limit


      DATA:  0x0000YY    128 byte limit


      CODE:  0xFFYYYY    64k limit


      PDATA: 0xFE00YY    256 byte limit


      Other types: Char is not the only allowable type. For larger values (16 and 32 bit) you can also use int and long:






      Be aware though, Keil is a big endian compiler, so it will interpret memory differently than if you read it out of the memory window. For example:


      In the memory map:


      0x7000   0x7001   0x7002    0x7003


      FE           00            00             1F


      The result of the watch window:



      Watch window expressions:

      You can also create interesting expressions in the watch window:

      In the memory map:
      0x4690    0x4691
      77        02


      This generates the following value -> 0x0277

      For PSoC 5 (GCC), there are no memory restrictions for PSoC 5 so the entire register space can be accessed in the debugger.

      The same techniques apply for PSoC 5 when setting up watch variables for memory locations, although the compiler is little endian oriented, so the int and long values will look different from PSoC 3 to PSoC 5 for the same value:

      In the memory map:
      0x7000    0x7001    0x7002     0x7003
      FE        00        00         07

      The result of the watch window:



       Quick Reference (PSoC 3):

      XDATA: *((char*)0x01YYYY)



      *Limited to 64 KB, no spaces in name

      CODE: *((char*)0xFFYYYY)



      *Limited to 64 KB, no spaces in name

      DATA: *((char*)0x0000YY)



      *Limited to 128 B, no spaces in name

      Quick Reference (PSoC 5):

      ALL MEMORY: *((char*)0xYYYYYYYY)

      * no spaces in name

        • 1. Re: PSoC Creator Debugger Watch Memory Location

          This information is really good. I had been wondering how i could do that, for a while. Very helpful detecting those case when you make mistakes with stray pointers or when you pass references through function parameters.


          Infact PSoC3 also has anotehr feature called Watch point. These are similar to break points. While break points break based on Instruction pointer, wath point can break based on a specific watch variable. Now with the information provided in the last post, I am confident there would be a way to initiate a watch point for a discrete memory location.


          This feature would be immensly helpful to understand those logical errors we make dealing with pointers and data structures

          1 of 1 people found this helpful