I’m trying to get the attached code using retained variables to compile, but it is giving me a “retained variables are not supported on the core” error:
void loop() {
delay(5000);
Serial.println(“I’m awake!”);
Serial.println(value);
value = value + 1;
delay(2000);
Serial.println(“I’m going to sleep!”);
System.sleep(SLEEP_MODE_DEEP, 10);
}
I’m working in the web IDE, and have double checked that the firmware both targeted and on the device is 0.5.3. Here’s the error I’m getting:
…/hal/src/core/platform_headers.h:27:18: error: static assertion failed: retained variables are not supported on the Core #define retained static_assert(1==0, “retained variables are not supported on the Core”);
^
What’s the difference between Spark Core and Electron? This code was working fine earlier yesterday, but now nothing with retained variables compiles (I get the same error for all code fragments with retained variables). Is there a setting telling the compiler to use Core instead of Electron?
The Electron, Photon and P1 are based on an STM32F205RG µC while the Spark Core uses an STM32F103CB which doesn’t sport that feature.
So no compiler switch will be able to alter the hardware.
But the target device setting tells the compiler what hardware (Core, Photon, P1, Electron, RPi, …) to build for and hence what features are available or not.
That’s the confusing thing. I only have Electrons (no Spark Cores), which I’ve confirmed by navigating to the devices tab in the Web IDE and only seeing only Electrons listed.
The code was compiling (and working fine) yesterday on my Electrons, but I’m now receiving compiler errors saying the target hardware isn’t an Electron.