AnsweredAssumed Answered

Sharing data between XGATE and main core

Question asked by Bahadir Selcuk on Feb 9, 2008
Latest reply on Feb 10, 2008 by CompilerGuru
Hello,
I want to use shared datas in both cores (XGate and main core). But there is a problem for data structures.
 
For an int variable I insert following lines into main.c file
Code:
#pragma DATA_SEG SHARED_DATAvolatile int shared_counter; /* volatile because both cores are accessing it. */#pragma DATA_SEG DEFAULT

 
 And for this variable inserted the followings into xgate.h file
Code:
#pragma DATA_SEG SHARED_DATA /* allocate the following variables in the segment SHARED_DATA */volatile extern int shared_counter; /* volatile because both cores are accessing it. */#pragma pop

 

after above insertings there is no problem for using sharing_counter in xgate core or main core. But when I want to use a data structure like below failed the compile operation:

 

For example, Inserted the followings into main.c

Code:
#pragma DATA_SEG SHARED_DATAvolatile int shared_counter; /* volatile because both cores are accessing it. */typedef struct {  unsigned char Member1;  unsigned char Member2;} MyStr;volatile MyStr Str1;#pragma DATA_SEG DEFAULT

 

And inserted into xgate.h:

Code:
#pragma DATA_SEG SHARED_DATA /* allocate the following variables in the segment SHARED_DATA */volatile extern int shared_counter; /* volatile because both cores are accessing it. */volatile extern MyStr Str1;#pragma pop

 

When I compiled there is "Error : C2450 Expected:   ;=,"  error message. I think that I make a mistake for about syntax but don't know what. May anybody explain me how to use same data structure in both cores.
 

 

 

 


 

Outcomes