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.

CCS: CCS: C++ (g++) program crash in mallo_r during startup

Other Parts Discussed in Thread: ENERGIA

Tool/software: Code Composer Studio

Hello!

I am using CCSv7 and a MSP432 launchpad (black) for C++ development. I am using gcc/g++ (4.9.3), which comes along with CCS (and I checked that it is the latest version available from the CCS App Center).
I also tried out newer compilers (g++ 6.2.4) with no success.

I have stripped down my problem to the following simple file:

#include "msp.h"

class A {
public:
    A() {}
    virtual ~A() {}
};

A mya;

int main(void)
{
    return 0;
}

When I run this program on the MSP432 lauchpad, it immediately crashes during the start-up code. I started with a fresh CCS C Project, and renamed main.c to main.cpp. I also added the libstdc++.a library in the linker configuration. The program compiles and uploads without errors.

Some further investigations showed that the crash happens in malloc_r, when accessing an invalid address (something like 0xD000xxxx).

Can someone help me to fix this problem? I guess it has to do with the linker script (heap size?) or some other general issue concerning the gcc startup code in case of global CTORs/DTORs.

Since CCS is not providing a "New C++ Project" functionality, I am also not sure about the general C++ support in CCS.

Energia is heavily using C++, and strangely the program above works without problems in energia (which I can not use, because I don't want/need the multithreading stuff, which is mandatory there...).

Any help is highly welcome!

BR, Andreas