Passing a pointer to an array is not a problem, although how to safely do it is a big headache. I’ve made a structure with different pointers to the required arrays and also few flags to avoid double access but even in that case, some array may be accessed by two tasks at the same time.
The point is that my SDCard task should not have large array but only access by pointers to arrays given by other tasks.
I cannot access directly the SD cards from task due to memory limitation, that’s why i have a separated task to avoid having big depth of stack calls. The card is already protected against double access by semaphore.
The problem I’m facing is not the sd card access but the handling of large array inter task without having to recopy the arrays (what queue does).
So far the solution I consider might be a queue with a pointer to a structure that contain a pointer to the array also as a mutex flag and checking this struct through critical code execution to check and set the mutex flag of the struct…
The way to avoid copying large buffers is to pass the address of the buffer in the queue rather than the buffer itself. When the receiving task is done with it, it needs to return the buffer to where it came from so the originating task can use it again.