the question about hared memory between two cores

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

the question about hared memory between two cores

1,207 Views
whagiew
Contributor II

I use the volatile keyword to share the same memory between two cores. When DCache is turned on, the memory values between the two cores are different, and they can only be synchronized when the DCache is turned off.
In the NXP compiler, how is the volatile keyword explained? In addition to turning off DCache or refreshing DCache, is there any other way to synchronize memory data between two? Looking forward to expert guidance, thank you

best regard.

yang

7 Replies

989 Views
alexanderfedoto
NXP Employee
NXP Employee

It would be more helpful if you'll tell which target and what cores do you use.

At first glance Dcache works properly but since there is no cache coherent interconnect between cores you dont see updated value on another core. You have to force write back from cache to memory in this case.

0 Kudos

989 Views
whagiew
Contributor II

Hi,

Thanks for your reply.

I am using S32R274. The two cores are  core0(z4) and core2(z7_b).

I want to use key word "volatile" to write through cache, but failed.  

I want to know in the NXP compiler, how is the volatile keyword explained? and how can i  force write back from cache to memory.

Thanks. 

Best regards,

Yang

0 Kudos

989 Views
alexanderfedoto
NXP Employee
NXP Employee

whagiew@126.com

volatile has nothing common with cache. You have to use ppc memory barrier/fence instructions to achieve what you want.

989 Views
whagiew
Contributor II

Thank you for your reply, I misunderstood the volatile keyword, the cache is actually memory.

thank you.

Best regards.

Yang

0 Kudos

989 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Yang,

Could you please tell me what part are you working on?

Also, it would be useful if you give a little more information about the things you are using in this (IDE, SDK).

Regards,

Felipe

0 Kudos

989 Views
whagiew
Contributor II

Hi Felipe,

     I am using s32ds and I am not using the SDK. Under the conditions of turning on and off DCache, use two cores to read and write 0x40000000 of SRAM respectively. And test using "int" type and "volatile int" type respectively. When the DCache is opened, the SRAM is not updated in time in another core.

     Best Regards.

     Yang

0 Kudos

989 Views
FelipeGarcia
NXP Employee
NXP Employee

Hi Yang,

Thanks for your reply.

For a better support I'm going to move this thread to the appropriate community space.

Best regards,

Felipe

0 Kudos