Part Number: MSP430FR2433
Tool/software: TI C/C++ Compiler
I want two instances of a class A to persist, in FRAM.
The class owns (has-a) an instance of another class B, which also should persist.
I want persistence because I am using LPM4.5.
When I try to init the persistent class instance, one of my assertion fails.
class B {
private:
int value;
public:
void init() {
value = 0;
assert(value == 0); // <<<<< assertion fails
}
void increment() {value++;}
int get() {return value;}
};
class A {
private:
B b;
public:
// just delegate to owned instance of B
void init() {b.init(); }
void increment() {b.increment();}
int get() {return b.get();}
};
// Not initialized, and linker.cmd puts TI.noinit segment in FRAM
#pragma NOINIT
A a;
#pragma NOINIT
A another;
#pragma PERSISTENT
static int myCounter = 0;
main() ...omitted
My main() repeatedly sleeps LPM4.5 and wakes.
On coldstart, I call a.init(), which delegates to B.init.
The assertion in B.init() fails.
(On wake that is not a coldstart, I increment both myCounter and the instance a.
Then compares their values.
To make sure they both are persistent.
But I never get that far.)
I am using CCS 8.1.2 (I tried upgrade, but upgrade in Eclipse fails, I will need to reinstall?).
On Linux.
EXP430FR2433 Launchpad