cancel
Showing results for 
Search instead for 
Did you mean: 

Malloc always returns null with STM32F439ZI, STM32Cube IDE, CMSIS RTOS

AJ_EE
Associate II

Hi,

I am having an issue whenever I call malloc, it returns null. The total number of bytes I need for this part of the application is 161. My work around was to declare an usigned char str[161]. But I just want to figure out what's causing malloc to return null. I'm using the Nucleo-F439ZI and STM32Cube IDE. I am also using LWIP and CMSIS_OSv2. My RTOS heap is set to 50000. And with all my RTOS objects considered, I have remaining 10000 bytes of heap. The project management tab has minimum heap set to 0x200 and minimum stack to 0x400. I don't know what I am missing or where I should look. I even tried malloc with just 5 characters. And even with that, it still returns null. I got everything else (LWIP, RTOS) working the way I want to. Any thoughts as to where I should look? I also tried using pvPortMalloc instead but that just caused a hard fault failure.

Thanks.

AJ

1 REPLY 1