PSoC Creator Debugger Watch Memory Location

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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: 

   

*((char*)0x01yyy)

   

   

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:

   

*((int*)0x01YYYY)

   

*((long*)0x01YYYY)

   

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


(int)(*((char*)0x014690)+(*((char*)0x014691)<<8))

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

0 Likes
0 Replies