AnsweredAssumed Answered

Problems forcing C++ class instances (data) to ddr2 external memory

Question asked by craigh on May 4, 2010
Latest reply on May 5, 2010 by kenb3

I have a C++ class partially defined like so in "MyClass.h":


class MyClass






     uint32_t m_bigArray[1000];



In another file that uses my class ("Client.cpp") I have the following globals:


#include "MyClass.h"


#pragma default_section(DATA, "seg_ddr2_data", DM)

MyClass instance1;

MyClass instance2:

MyClass instance3;


I need all the instances to be either static or global (no dynamic memory in this particular embedded system). The default_section pragma should in theory place the instances (and the associated m_bigArray[] for each instance) in ddr2 rather than the default data section (dmda). It does not - the data is all getting assigned to dmda.


Things I've tried:


(1) Put #pragma default_section(DATA, "seg_ddr2_data", DM) at the start of MyClass.h. Bad move - all other files that include MyClass.h then see the pragma and attempt to put their data into ddr2.


(2) Declare m_bigArray[] as static and put uint32_t MyClass::m_bigArray[] over in MyClass.cpp (along with the pragma). Wrong - declaring a member variable static makes it a class variable (i.e. shared between all instances). I need each instance to have their own copy of m_bigArray.


(3) Put #pragma section directive right before declaration of m_bigArray[]. Had no effect.


Any ideas?