#define CPU_RESTART_ADDR (uint32_t *)0xE000ED0C
#define CPU_RESTART_VAL 0x5FA0004
#define CPU_RESTART (*CPU_RESTART_ADDR = CPU_RESTART_VAL);
if ( 'r' == foo ) CPU_RESTART; // restart CPU
This is what I do on the Teensy 4.0
saveStatus() is my routine to save the machine state in a FRAM.Code:void doReboot() { saveStatus(); // send reboot command ----- SCB_AIRCR = 0x05FA0004; }
This works for me.