read reset reason
This commit is contained in:
parent
f2be0ee6d8
commit
114072c587
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue