Locating RAM variables

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Locating RAM variables

Jump to solution
956 Views
Ben
Senior Contributor I

Hello

I built several RAM arias in the project.

Please help me with CW C commands that will enable locating variables in a specific RAM zone.

(like SECTION in CW assembly).

TIA Benny

Labels (1)
0 Kudos
1 Solution
584 Views
tiagomachado
Contributor I

In CW help, search for "@address".

From help menu:

Global Variable Address Modifier (@address)

Use the global variable address modifier to assign global variables to specific addresses.....

int glob @0x0500 = 10; // global variable "glob" is at 0x0500, initialized with 10

There are many other ways to use this modifier. Look there.

Hope it helps.

View solution in original post

0 Kudos
4 Replies
584 Views
loosePointer
Contributor III

Have a look in the Linker Command File documentation.

You can tell the Linker to Place a symbol in a specific section, and address in your ".lcf"

This is how we place our software version at a known location.

___SOFTWARE_REVISION = 1;

  WRITEW(0x05000000 + ___SOFTWARE_REVISION);

You could substitute the symbol for your array.  But be carfull with the size of the array and the section it is in.

584 Views
Ben
Senior Contributor I

Thanks James, I'll have to check the lcf options. Do you have mapping sample in lcf?

0 Kudos
585 Views
tiagomachado
Contributor I

In CW help, search for "@address".

From help menu:

Global Variable Address Modifier (@address)

Use the global variable address modifier to assign global variables to specific addresses.....

int glob @0x0500 = 10; // global variable "glob" is at 0x0500, initialized with 10

There are many other ways to use this modifier. Look there.

Hope it helps.

0 Kudos
584 Views
Ben
Senior Contributor I

Thanks Tiago. I am trying it.

0 Kudos