Dynamic class allocate on External RAM
Posted: Wed May 11, 2022 2:16 pm
HI dear forumers!
Is there some way that i could allocate my classes on external ram?
Curerntly iam doing this:
In this example, iam allocating an array in external ram to hold pointers to dynamically created classes.
Is there a way that i could allocate my new exampleClass(); in external ram instead of the internal heap?
Iam using PlatformIO with Arduino framework.
Thank for your answers.
Is there some way that i could allocate my classes on external ram?
Curerntly iam doing this:
Code: Select all
#define MAX_CLASSES 20
class exampleClass {
public:
void sayHello(){
Serial.println("Hello");
}
};
exampleClass dynamicClass;
exampleClassArr* exampleClasses[MAX_CLASSES] EXT_RAM_ATTR;
void allocateNewClasses(){
for(int i = 0; i < MAX_CLASSES; i++){
exampleClasses[i] = new exampleClass();
exampleClasses[i]->sayHello();
}
}
void setup(){
allocateNewClasses();
}
Is there a way that i could allocate my new exampleClass(); in external ram instead of the internal heap?
Iam using PlatformIO with Arduino framework.
Thank for your answers.