BUGfix: Only clear MCUCSR register when bootLoaderCondition()
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 10 Sep 2013 13:49:29 +0000 (15:49 +0200)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Tue, 10 Sep 2013 13:57:01 +0000 (13:57 +0000)
If bootLoaderCondition() is false, the users firmware must
be started transparently - so leave the register for it to read!

Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/bootloaderconfig.h
firmware/main.c

index 9ca2cd1..e3520b4 100644 (file)
@@ -358,8 +358,6 @@ static inline void  bootLoaderInit(void)
 //     deactivated by Stephan - reset after each avrdude op is annoing!
 //     if(!(MCUCSR & (1 << EXTRF)))    /* If this was not an external reset, ignore */
 //         leaveBootloader();
-
-    MCUCSR = 0;                     /* clear all reset flags for next time */
 }
 
 static inline void  bootLoaderExit(void)
index 99bbb20..fe7d049 100644 (file)
@@ -707,6 +707,7 @@ int __attribute__((__noreturn__)) main(void)
 #      endif
        wdt_disable();    /* main app may have enabled watchdog */
 #endif
+       MCUCSR = 0;       /* clear all reset flags for next time */
         initForUsbConnectivity();
         do{
             usbPoll();