Dynamic memory Allocation in HCS12X

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic memory Allocation in HCS12X

1,358 Views
Thanga
Contributor I

Hi,

 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
to
#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,

Thangavadivel.K

Labels (1)
0 Kudos
3 Replies

78 Views
Thanga
Contributor I
Hi,

  Thanks for your reply. But already I have done those changes as per FAQ-27635 but still I am facing above problem.

 

Thanks & Regards,

Thangavadivel K

0 Kudos

78 Views
CrasyCat
Specialist III

Hello

 

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.

https://www.freescale.com/webapp/servicerequest.create_SR.framework?regFlag=fromOpenSR

 


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.

 

CrasyCat

0 Kudos

78 Views
CrasyCat
Specialist III

Hello

 

If you want to allocate your heap in GLOBAL memory, please look for FAQ-27635 on www.freescale.com.

 

 

CrasyCat

0 Kudos