Dynamic memory allocation - BlueNRG LP 345
Hi,
I am trying to use malloc() in BlueNRG LP as I want to dynamically allocate some memory during runtime (not frequent, only when a set of commands are received via BLE).
However, I am not able to allocate memory. The pointer always is returning NULL. I have set the Heap scheme to "Advanced" under project options in IAR Workbench, but am not able to allocate.
char * ptr = (char*)malloc(5 * sizeof(char));
if (ptr == NULL) return;
The above is a code sample. I tried printing the size of character, it returns a huge garbage value for some reason.
Any help would be appreciated, thanks!
