read reset reason

This commit is contained in:
Harald Welte 2012-01-08 15:12:21 +01:00
parent f2be0ee6d8
commit 114072c587
1 changed files with 10 additions and 0 deletions

View File

@ -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 */