This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[TDA4VM] Shared memory A72 <-> C71



Hello,

currently I am exploring shared memory between the cores.

(I should mention that using OpenVx and stuff from vision apps is not an option for me.)

So on the C71 have a code similar to this:

volatile uint32_t* testPtr = (uint32_t*)0xBC000000;
uint32_t counter = 0U;
while(true)
{
  *testPtr = counter++;
sleep(s); // 1sec }

Now on the A72 Linux I can use a tool like "devmem" from busybox or a smiliar implementation and read the value at this address.
When I do something like this:

while true; do sudo ./devmem 0xBC000000; done

It works fine and the counter is incrementing every second.
But when I implement a program which uses /dev/mem and mmap() (like devmem dose) and which reads the value in a loop it does not work.
Suddenly the numbers jump every few seconds. So it only works when closing and recreating the mapping in between.

I think it is a caching problem in Linux. How can I make use of the shared memory in Linux userspace?
How can I prevent caching or sync the memory?

Best regards

Jan

  • hi Jan,

    See this post on using cache APIs on C7x side

    https://e2e.ti.com/support/j721e/f/1026/p/857682/3197364#3197364

    On Linux side, cache ops from user space is a bit tricky, here what one needs to do is alloc memory in Linux using ION allocator.

    Then on this ION allocate memory one can do cache ops on Linux side.

    There is no direct cache op API in user space in Linux.

    I will point you to vision_apps/utils for reference. You can choose not to use this but look at this as reference code and put a similar logic into your application.

    Note, ION allocator is a kernel API and not TI specific.

    vision_apps/utils/mem/src/app_mem_linux_ion.c

    This shows how to use ION APIs to alloc and do cache ops.

    Hope this helps !

    regards
    Kedar