Other Parts Discussed in Thread: OMAPL138
I use code segments like this:
class MyClass
{
public:
MyClass();
private:
int m_value;
};
MyClass::MyClass():
m_value(1)
{
}
void main()
{
static MyClass s_instance; //constructor call is random depending on the memory content in ram_model!!!
}
When I check the assembler code, the compiler generates a flag bit which is checked to guaranty that the constructor of the static
instance is just called once.
Unfortunately this flag bit is not initialized by the "C runtime environment" (c_int00) at startup in ram_model. Therefore if
this flag bit is already set (randomly or after a device reset) the constructor is not called anymore.
In linker rom_model everything works fine (bit is initialized in "C runtime environment").
Is this a known problem?
Are there any other workarounds beside not using of this kind of construct or using rom_model?