S32DS - How share variables between projects including unused data?

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

S32DS - How share variables between projects including unused data?

1,218件の閲覧回数
demian91
Contributor III

Hi, im  trying to share variables between projects.

My problem is that I have multiple structures declared in a shared memory sector. In the file 57xx_flash.ld I declare the sector:

.sharedRAM : ALIGN(8)
{
KEEP(SORT_BY_NAME(*)(.sharedRAM))
} > shared

And I have variables like:

 

__attribute__((section(".sharedRAM"))) DATAONLINE DataOnline;
__attribute__((section(".sharedRAM"))) EM Em;
...

 

For example DataOnline is used in one project and not in another, so it happens that the position of the rest of the variables are different and you would need to force them all to exist regardless of whether they are referenced.Try using the used attribute:

 

__attribute__((used, section(".sharedRAM"))) DATAONLINE DataOnline;

 

But it didn't work, is there a way to force the variable to exist in the S32DS IDE without having to write code that reads or writes the structure?

 

 

 

0 件の賞賛
返信
2 返答(返信)

1,178件の閲覧回数
jiri_kral
NXP Employee
NXP Employee

Hi, 

if I understand it correctly - you like to have all shared variables in multiple projects with the same source code and the variable should occupy memory even if it is not used? 

If So, you can simply define the variable as a volatile.

 

 

0 件の賞賛
返信

1,156件の閲覧回数
demian91
Contributor III

Is possible that resolves the problem if it is compiled with -O0 optimization but with -O1 not works. The only that i found is using all the structs always in any project.

0 件の賞賛
返信