I am trying to solve an issue and I need to remove a huge chunk of data over to the heap.
The pvPortMalloc() returns 0, when trying to do allocate the memory, although the configTOTAL_HEAP_SIZE macro is set to 180120 .
I am using heap4.c . What could be the issue here?
(the task itself has a stack set to 1024, however changing it even to 33792 doesn’t help)
My code follows.
The function:
uint32_t* copyBlockIntoRAM(uint32_t* source_addr, uint32_t size)
{
uint32_t* malloc_rtr;
malloc_rtr = (uint32_t*) pvPortMalloc(size);
configASSERT(malloc_rtr);
memcpy( malloc_rtr, source_addr, size);
return malloc_rtr;
}
(...)
block_in_RAM = copyBlockIntoRAM((uint32_t*)BLOCK_START_ADDRS, 32768);
(...)
The task, that runs the function:
xTaskCreate(vfileSystemTask, "vfileSystemTask", 1024U, NULL, 3, NULL); /
The freeRTOSConfig.h
#define configTOTAL_HEAP_SIZE ( ( size_t ) 180120
(I know this operation isn’t optimal for a RTOS, however I need to check one thing, and I will remove this code once I figure out what is going on)