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?
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.
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.