AnsweredAssumed Answered

how to use new in a constructor then create a global object of class

Question asked by josephxavier on May 12, 2015
Latest reply on May 21, 2015 by Carlos_Mendoza

I am using codewarrior MCU 10.4 , mqx4.0, k20d72m board ,EWL

 

I am attaching my program(cplus.cpp) , I need to use new in constructor then create a global object of class , when I do this my code crashes

 

 

I tried to edit the startup but my changes doesn't come to effect (when debugging the debugger goes into the commented function )

what are the steps to edit startup.c ?

(I tried to comment " bl __call_static_initializers " )

 

 

then I tried to give static heap by adding

"

__SP_INIT = . + 0x00004000;

 

__heap_addr = __SP_INIT;

 

__heap_size = 0x00004000;   "

 

 

to my linker file but it didn't work  I am attaching my linker file (un edited one ).

 

 

how can I add static heap to this linker file  what are the changes to be made ?

Original Attachment has been moved to: cplus.cpp.zip

Original Attachment has been moved to: intflash.lcf.zip

Outcomes