X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/blobdiff_plain/54be5a8c0a5b57f2f74b605ddf71c334f6a7a69b..c99e4b0f4e8dc636060fca152df271298caa8342:/firmware/main.c diff --git a/firmware/main.c b/firmware/main.c index d651ec3..4a94194 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -111,6 +111,8 @@ static uchar currentRequest; static const uchar currentRequest = 0; #endif +static unsigned char wdtstatus; + static const uchar signatureBytes[4] = { #ifdef SIGNATURE_BYTES SIGNATURE_BYTES @@ -143,6 +145,9 @@ static void leaveBootloader() USB_INTR_CFG = 0; /* also reset config bits */ GICR = (1 << IVCE); /* enable change of interrupt vectors */ GICR = (0 << IVSEL); /* move interrupts to application flash section */ + + WDTCR = wdtstatus; + /* We must go through a global function pointer variable instead of writing * ((void (*)(void))0)(); * because the compiler optimizes a constant 0 to "rcall 0" which is not @@ -328,6 +333,7 @@ uchar i = 0; int __attribute__((noreturn)) main(void) { /* initialize */ + wdtstatus = WDTCR; wdt_disable(); /* main app may have enabled watchdog */ bootLoaderInit(); odDebugInit();