Flash red when ending in unknown stat

Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
Daniel Lublin 2022-11-25 09:32:28 +01:00 committed by Michael Cardell Widerkrantz
parent 687ee4f8b1
commit a2bc95f49a
No known key found for this signature in database
GPG Key ID: D3DB3DDF57E704E5

View File

@ -91,6 +91,17 @@ static void compute_cdi(uint8_t digest[32], uint8_t use_uss, uint8_t uss[32])
wordcpy((void *)cdi, (void *)local_cdi, 8); wordcpy((void *)cdi, (void *)local_cdi, 8);
} }
void forever_redflash()
{
int led_on = 0;
for (;;) {
*led = led_on ? LED_RED : 0;
for (volatile int i = 0; i < 800000; i++) {
}
led_on = !led_on;
}
}
enum state { enum state {
FW_STATE_INITIAL, FW_STATE_INITIAL,
FW_STATE_INIT_LOADING, FW_STATE_INIT_LOADING,
@ -163,13 +174,10 @@ int main()
break; // This is never reached! break; // This is never reached!
default: default:
// Unknown state!?
puts("Unknown firmware state 0x"); puts("Unknown firmware state 0x");
puthex(state); puthex(state);
lf(); lf();
forever_redflash();
asm volatile("forever:;"
"j forever;");
break; // Not reached break; // Not reached
} }