BV: display reset cause when debugging

This commit is contained in:
King Kévin 2018-09-01 00:28:14 +02:00
parent fe84d49ca4
commit fbb6fd18cc
1 changed files with 23 additions and 0 deletions

View File

@ -278,6 +278,29 @@ void main(void)
uart_setup(); // setup USART (for printing)
busvoodoo_setup(); // setup BusVoodoo board
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
#if DEBUG
printf("\nreset cause:");
if (RCC_CSR & RCC_CSR_LPWRRSTF) {
printf(" low-power");
}
if (RCC_CSR & RCC_CSR_WWDGRSTF) {
printf(" window-watchdog");
}
if (RCC_CSR & RCC_CSR_IWDGRSTF) {
printf(" independent-watchdog");
}
if (RCC_CSR & RCC_CSR_SFTRSTF) {
printf(" software");
}
if (RCC_CSR & RCC_CSR_PORRSTF) {
printf(" POR/PDR");
}
if (RCC_CSR & RCC_CSR_PINRSTF) {
printf(" reset-pin");
}
printf("\n");
RCC_CSR |= RCC_CSR_RMVF; // clear reset flags
#endif
printf("\nwelcome to \x1b[32mBus\x1b[35mVoodoo\x1b[0m (%s)\n", busvoodoo_full ? "full" : "light"); // print welcome message
// setup terminal