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.

Static initialisers

Hello,

I have been trying to run a DSP/BIOS program (C++) in which there is a static variable whose initialiser calls MEM_alloc and essentially I'm wondering whether this could cause problems. Let me give an example:

Suppose I have a static variable in a class "Class":

class Class { static Foo m_foo; };

which is initialised as follows:

Foo Class::m_foo();

and the Foo constructor uses C++'s new operator:

Foo::Foo() { m_barPtr = new Bar(); }

The new operator in turn calls DSP/BIOS's MEM_alloc.

I am wondering whether the above could be problematic. I see in section 2.5 of the TMS320C6000 DSP/BIOS User's Guide (spru303b) that .cinit is initialised _before_ DSP/BIOS. Does this mean I am calling MEM_alloc before MEM is initialised? If so, can this cause a problem?

I am asking because recently I've seen weird behaviour in our firmware and I am wondering whether this explains it.

Kind regards,

Mark