Locating RAM variables

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Locating RAM variables

跳至解决方案
1,840 次查看
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,468 次查看
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,468 次查看
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,468 次查看
Ben
Senior Contributor I

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

0 项奖励
回复
1,469 次查看
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,468 次查看
Ben
Senior Contributor I

Thanks Tiago. I am trying it.

0 项奖励
回复