I am running freertos on both the cores of zynq 7000 cortex a9. I needed to share data between both cores very frequently. I Used DDR for the purpose. In the lscript of core0 i adjusted the ddr size to 300MB and in core1 lscript i allocated another 300 . I have 1 GB DDR. remaining 400 i need to use as shared memory between both cores.
I have to implement a buffer like functionality. Every time core 0 has to write 1000byes of data to ddr and core 1 read it from the DDR. Core 1 writes the data to the address in the DDR and the 1st byte of the data is used as a flag. If the flag is set core1 reads the data else it waits. According to the program structure reading will be slightly delayed. So a buffer like format is implimented. core0 will incriment the prt value to ptr+1000 and write the next data to the next 1000 bytes. After a 100 writing process is ring back the ptr to the initial value. So it acts like a ring buffer.
The problem i am facing is when core0 is writing to the DDR core1 couldn't read it immediately. Core1 was able to read the data only after core0 writing to the same memory location the second time(ie, after finishing 100 write operation and coming back t initial address and writing 101th data).
I flushed the data after writing process from core0 and continuesly invalidating from core1.
Can anyone help me in resolving the problem. I want core1 to be able to read immediatly after core0 write on the memory location.