Platform:
Device: F28379
CCS: Version: 11.1.0.00011
Compiler TI v21.6.0.LTS
I have an issue when using constructors (or any data that is initialized before running to main) that call a function that is set to run from RAM.
Details:
If I have an object that calls a run-from-RAM-function on initialization,the system will crash on startup. Since the init occurs before main is reached, the function has not been moved to ram yet. As such: a _system_post_cinit() error occurs. The code works as expected without having a separate run location.
I would say that this is expected behavior, but certainly unwanted.
- One way to fix this is to not run the function from RAM. This would be a bit of a pain to keep track of if multiple functions are doing this.
- Another way to fix this is to do the initialization after the memcpy function, but this would require pushing to the heap if the data needs to be const. (which it does in my case).
I would like a graceful work around. Any guidance is appreciated!
Example (Psuedo) Code:
class Demo {
private:
int i;
int j;
public:
GetI();
GetJ();
}
Demo::GetI() {return i;}
CODE_SECTION("RunFromRam");
Demo::GetJ() {return j;}
Demo A; // Demo A is instantiated before being used.
const int X= A.GetI(); // Works as expected
const int Y= A.GetJ(); // Crashes on Init