AnsweredAssumed Answered

extern volatile and multicore projects

Question asked by Yaniv.Sapir on Jul 8, 2011
Latest reply on Aug 16, 2011 by StuartS

I am building a dual core app on BF561. Using the project wizard to generate the template for a "Dual Core: One Application Per Core" template, there is an example of how to declare and allocate shared objects in L2. In the sample code, the shared variable is declared as volatile. In the Core B module, the definition of this object appears as extern volatile.

 

In my project, I am linking Core B's code with some library. In the main program, I call the library functions with variables that are from the shared space.

 

For argument that are pointers, which are declared in Core B's module as:

 

extern volatile short *pVar;

 

and used as:

 

void lib_func(short *);

 

lib_func(pVar);

 

 

and in shared.c:

 

#pragma file_attr("sharing=MustShare")
#pragma section("l2_shared")
volatile short  *pVar;

 

I get the following warning:

 

"volatile short *" is incompatible with parameter of type "short *"

 

 

1. Removing the volatile modifier from the extern declaration elimintes this warning. Is there a chance that the optimizer will optimize out this variable?

 

2. Why do I get this warning anyway? Obviously, the short * data type IS compatible with short *, and the fact that it is volatile should not affect this compatibility.

Outcomes