S32DS - How share variables between projects including unused data?

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

S32DS - How share variables between projects including unused data?

1,210 次查看
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,170 次查看
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,148 次查看
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 项奖励
回复