S32DS - How share variables between projects including unused data?

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

S32DS - How share variables between projects including unused data?

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)
} > 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 Kudos
2 Replies

NXP Employee
NXP Employee


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 Kudos

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 Kudos