cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
7,202 Views
Registered: ‎03-29-2015

2016.1 openamp - missing memory barrier ?

Jump to solution

SDK 2016.1, openamp_v1_0 component of BSP, default linaro toolchain.

 

I think MEM_BARRIER() macro turns out to be defined as blank in openamp source code

 

From;

workspacename\bspname\ps7_cortexa9_1\libsrc\openamp_v1_0\src\open-amp\lib\include\openamp\system\freertos\machine\zynq7\machine_system.h

 

 

/* Memory barrier */
#if (defined(__CC_ARM))
#define MEM_BARRIER() __schedule_barrier()
#elif (defined(__GNUC__))
#define MEM_BARRIER() asm volatile("dsb" : : : "memory")
#else
#define MEM_BARRIER()
#endif

 

It is used in bm_env.c functions [env_mb(), env_rmb(), env_wmb() ], which are in turn used in the vring buffer access code.

 

Is this a bug ? There should be a barrier to prevent re-ordering (either in compiler, or in CPU or DDR controller) on the order of accesses to the DDR for the vrings ?

 

I am having a problem with PS0/linux and PS1/FreeRTOS, where the Zynq(A9) chip hangs if I use -O2 compiler optimisation for the PS1 side (which is the default optimisation level for BSP) if I am moving data between PL<=>DDR while at the same time doing PS0<=>PS1 openamp communications (with vrings in DDR)  ... if I use -O0 on the PS1 side (for both BSP and my application), the chip no longer hangs.

 

Thanks.

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Observer
Observer
13,471 Views
Registered: ‎03-29-2015

Sorry; my mistake; I thought __GNUC__ is not defined based on viewing code in SDK editor... but it is defined automatically during the build by the compiler (which SDK editor doesn't know); so, the barriers are used, which is good.

View solution in original post

0 Kudos
1 Reply
Highlighted
Observer
Observer
13,472 Views
Registered: ‎03-29-2015

Sorry; my mistake; I thought __GNUC__ is not defined based on viewing code in SDK editor... but it is defined automatically during the build by the compiler (which SDK editor doesn't know); so, the barriers are used, which is good.

View solution in original post

0 Kudos