configASSERT hit in heap_4.c while opening a TLS connection

I’m in the process of porting OTA including the Cellular Interface to my platform. The cellular interface is up and running. When the OTA demo tries to open a TLS connection however, a configASSERT is hit in heap_4.c

Inside of void *pvPortMalloc( size_t xWantedSize )

configASSERT( ( ( ( size_t ) pxNewBlockLink ) & portBYTE_ALIGNMENT_MASK ) == 0 );

The function that calls pvPortMalloc when this happens is _Cellular_CreateSocketData, it wants to Malloc 200 bytes.

I find this really hard to debug, any help is greatly appreciated.

What is the value of pxNewBlockLink at the time of assert? Possible case of memory corruption? Do you have stackoverflow check enabled?

I forgot to add a while(1){} to my vApplicationStackOverflowHook so I did not see it get triggered, which it does.

Now the question is why. I have already switched to a different processor which has a lot of RAM, I picked my heap size 300000 bytes and the only thing I’m running is the OTA demo and the Cellular interface, which should fit easily inside of my defined heap size.

I also doubled the default stack sizes in the demo of the OTA Agent and MQTT Agent, still getting overflows.

How can I investigate this?

Solved, it was the demo task itself, the default stack size that works well for the windows demo, was for some reason not sufficient for my port. I increased it from 128 to 1024.

Now I’m running into another non related problem, hopefully I will figure that out or else I’ll come back to the forum in a new thread.

Thank you for taking time to report back.