vos_memInit() does not currently work when provided a pointer to a memory area via the pMemoryArea parameter. The reason for this is that it only does parameter checks for two out of three possible conditions: 1) use standard malloc calls and 2) allocate from the heap once. These two conditions are currently handled by the following parameter checks in the code:
if (pMemoryArea == NULL && size == 0) / This means we will use standard malloc calls /
{
...
}
and
if (pMemoryArea == NULL && size != 0) / We must allocate memory from the heap once /
{
...
}
The following code needs to be added to handled the third condition of a provided memory area:
if (pMemoryArea != NULL && size != 0) / Use the provided memory area /
{
gMem.pArea = pMemoryArea;
}
Additionally the forth possibility returns VOS_PARAM_ERR.