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,
Then I would advise you to submit a service request through our online web site to get one of our support engineer to look at that.
Here is the URL to submit a service request.
Make sure to attach a reproducible project and installed product information to the service request.
To generate the required information:
- Start CodeWarrior
- Open the project
- Select "Help" -> "Pack and Go" and follow instructions on the screen.
Attach the generated .zip file to the SR.
As a side note the address you indicated in your first message to the memory area GLOBAL_RAM are not valid notation for specifying global addresses in the .prm file.
Please look at the FAQ. It shows also how to specify global addresses in the .prm file.