diff options
Diffstat (limited to 'usb-dfu-experiment')
-rw-r--r-- | usb-dfu-experiment/main.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usb-dfu-experiment/main.c b/usb-dfu-experiment/main.c index 81f7e89..31c2c4f 100644 --- a/usb-dfu-experiment/main.c +++ b/usb-dfu-experiment/main.c @@ -54,6 +54,8 @@ #include <memories/flash/flashd.h> +#include <peripherals/rstc/rstc.h> + #include <usb/device/core/USBD.h> #include <usb/device/core/USBDDriver.h> #include <usb/device/dfu/dfu.h> @@ -395,9 +397,14 @@ void dfu_drv_updstatus(void) extern void USBD_IrqHandler(void); +static const char *rst_type_strs[8] = { + "General", "Backup", "Watchdog", "Softare", "User", "5", "6", "7" +}; + int main(void) { volatile uint8_t usbConn = 0; + unsigned long rst_type; TRACE_CONFIGURE(DBGU_STANDARD, 115200, BOARD_MCK); @@ -405,6 +412,9 @@ int main(void) printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); + rst_type = (RSTC_GetStatus() >> 8) & 0x7; + printf("-- Reset type: %s --\n\r", rst_type_strs[rst_type]); + chipid_to_usbserial(); /* If they are present, configure Vbus & Wake-up pins */ |