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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

942件の閲覧回数
josephxavier
Contributor III

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

ラベル(1)
0 件の賞賛
返信
1 返信

833件の閲覧回数
Carlos_Mendoza
NXP Employee
NXP Employee

Hi Joseph,

It would be helpful to know what are you trying to achieve, could you give us more information? do you want to use the malloc() function in your MQX project?

Best Regards,

Carlos Mendoza

Technical Support Engineer

0 件の賞賛
返信