This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Startup failed when using RM48, HalCoGen with FreeRTOS and global C++ vaiables with destructors

Other Parts Discussed in Thread: HALCOGEN

Dear all,

I am using following enviroment: RM48 HDK, CCS 5.5 and HALCoGen 3.08 with FreeRTOS.

Now, if I'm using global/static C++ variables with destructors in my application, the startup fails during execution of  __TI_auto_init().

I analysed this problem and got following result:

  • "__TI_auto_init()" calls "atexit()" to register the destructors of the global C++ objects.
  • "atexit()" uses the system heap (malloc) for this registration.
  • The generated "sys_link.cmd" does not define the memory for the heap section (.sysmem), so the linker placed the memory into ROM and not into RAM -> malloc() fails during startup.
  • If I add ".sysmem  : {} > RAM" into the sys_link.cmd the startup works.
  • HalCoGen without FreeRTOS defines ".sysmem  : {} > RAM".

My Questions:

  1. Is this a bug of the HalCoGen+FreeRTOS or is this because FreeRTOS defines it own heap?
  2. My application doesn't  need any heap memory. How can I avoid that the run-time support for global C++ variables is using the heap? I am expecting that the memory of global variables is allocated during compiling/linking and not during runtime on the heap.
  3. If I can not avoid this, how much memory must be defined for the heap when using global C++ variables?

Best regards,

Markus P.