From: Stephan Baerwolf Date: Tue, 10 Sep 2013 13:49:29 +0000 (+0200) Subject: BUGfix: Only clear MCUCSR register when bootLoaderCondition() X-Git-Tag: testing-head~26 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/4c35c3b6d7988c8f7ff5d33c4df608cfd7b85442?ds=inline BUGfix: Only clear MCUCSR register when bootLoaderCondition() If bootLoaderCondition() is false, the users firmware must be started transparently - so leave the register for it to read! Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/bootloaderconfig.h b/firmware/bootloaderconfig.h index 9ca2cd1..e3520b4 100644 --- a/firmware/bootloaderconfig.h +++ b/firmware/bootloaderconfig.h @@ -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) diff --git a/firmware/main.c b/firmware/main.c index 99bbb20..fe7d049 100644 --- a/firmware/main.c +++ b/firmware/main.c @@ -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();