Locating RAM variables

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Locating RAM variables

ソリューションへジャンプ
1,852件の閲覧回数
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

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 解決策
1,480件の閲覧回数
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 件の賞賛
返信
4 返答(返信)
1,480件の閲覧回数
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.

1,480件の閲覧回数
Ben
Senior Contributor I

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

0 件の賞賛
返信
1,481件の閲覧回数
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 件の賞賛
返信
1,480件の閲覧回数
Ben
Senior Contributor I

Thanks Tiago. I am trying it.

0 件の賞賛
返信