void doReboot() {
SCB_AIRCR = 0x05FA0004;
}
Excellent, is there an equivalent for resetting or restarting?
That's what the write to SCB_AIRCR does.
Trying to catch the ball in the air ... does it work for teensy 4?
Along similar lines... is there a way to detect whether the reset was caused by software (ie. SCB_AIRCR reboot, firmware update, cold boot/power on)?
I'd like to perform a task *only* if when cold booted vs. using SCB_AIRCR to reset.
bool isWarmBoot()
{
static DMAMEM unsigned bootCheck; // DMAMEM is not zeroed during bootup
if (bootCheck != 0xAAAA'AAAA)
{
bootCheck = 0xAAAA'AAAA; // some number
arm_dcache_flush(&bootCheck, sizeof(bootCheck)); // dmamem is cached, force a write to memory
return false;
}
return true;
}
void setup()
{
while (!Serial) {}
Serial.printf("%s \n", isWarmBoot() ? "Warm Boot" : "ColdBoot");
}
void loop()
{
}
Along similar lines... is there a way to detect whether the reset was caused by software (ie. SCB_AIRCR reboot, firmware update, cold boot/power on)?
I'd like to perform a task *only* if when cold booted vs. using SCB_AIRCR to reset.