AnsweredAssumed Answered

Armclang MQX C++ runtime initalization

Question asked by Nicholas Hadley on Jan 12, 2019
Latest reply on Mar 5, 2019 by Daniel Chen

Hi all,


Have a quick question regarding C++ runtime heap initialization and MQX 4.2 using armclang 6.9.


So __main in armclang runtime standard library is called to initialize the library which calls __rt_lib_init.  


I have r0 and r2 in __user_setup_stackheap set to zero as the memory is managed by MQX.


The problem is the runtime library seems to be making calls to _init_alloc to initialize the heap in __rt_lib_init call which is faulting out.


If I just skip over _init_alloc call using the debugger everything works as expected.  MQX/task runs, new C++ object creation/malloc all uses MQX malloc.


Is there any way to tell the compiler/linker to not call _init_alloc as part of __rt_lib_init?


I haven't found a way to wrap the call using armclang like we can with g++ as a hack.


Thanks in advance.