I am using mc9s12xep100 and my development IDE is freescale code warrior 4.7 versions. My application has much functionality so I need more heap size for dynamic allocation. I am facing the problem while executing malloc function in my application. Initially I have selected Banked memory model and HEAP size is 2000. In my application continuously allocated the memory after certain time malloc get failed [means it returns NULL]. So I did the below patches libdefs.h and I rebuild the library.
libdefs.h file changes
HEAP size 2000 to 16000 in alloc.c file
#define LIBDEF_FAR_HEAP_DATA 0
#define LIBDEF_FAR_HEAP_DATA 1
And also I added the this two lines into prm files
GLOBAL_RAM = NO_INIT 0xFC1000 TO 0xFC8FFF ALIGN 2[1:1];
HEAP_SEGMENT into GLOBAL_RAM
After that malloc is working fine (means It didn’t return NULL) but initially allocated memory will became NULL or corrupted with out calling the free function. This will happen after allocating some amount of memory. Please guide on this issue.
Thanks & regards,