optimize: this changes logik from commit c99e4b0f4e8dc636060fca152df271298caa8342...
authorStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Wed, 1 Aug 2012 23:11:54 +0000 (01:11 +0200)
committerStephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
Wed, 1 Aug 2012 23:20:39 +0000 (23:20 +0000)
Signed-off-by: Stephan Baerwolf <stephan.baerwolf@tu-ilmenau.de>
firmware/main.c

index 4a94194..b7b3f58 100644 (file)
@@ -111,8 +111,6 @@ static uchar                currentRequest;
 static const uchar             currentRequest = 0;
 #endif
 
 static const uchar             currentRequest = 0;
 #endif
 
-static unsigned char           wdtstatus;
-
 static const uchar  signatureBytes[4] = {
 #ifdef SIGNATURE_BYTES
     SIGNATURE_BYTES
 static const uchar  signatureBytes[4] = {
 #ifdef SIGNATURE_BYTES
     SIGNATURE_BYTES
@@ -146,8 +144,6 @@ static void leaveBootloader()
     GICR = (1 << IVCE);     /* enable change of interrupt vectors */
     GICR = (0 << IVSEL);    /* move interrupts to application flash section */
     
     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
 /* 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
@@ -333,8 +329,6 @@ uchar   i = 0;
 int __attribute__((noreturn)) main(void)
 {
     /* initialize  */
 int __attribute__((noreturn)) main(void)
 {
     /* initialize  */
-    wdtstatus = WDTCR;
-    wdt_disable();      /* main app may have enabled watchdog */
     bootLoaderInit();
     odDebugInit();
     DBG1(0x00, 0, 0);
     bootLoaderInit();
     odDebugInit();
     DBG1(0x00, 0, 0);
@@ -343,6 +337,7 @@ int __attribute__((noreturn)) main(void)
     GICR = (1 << IVSEL); /* move interrupts to boot flash section */
 #endif
     if(bootLoaderCondition()){
     GICR = (1 << IVSEL); /* move interrupts to boot flash section */
 #endif
     if(bootLoaderCondition()){
+       wdt_disable();    /* main app may have enabled watchdog */
 #if BOOTLOADER_CAN_EXIT
         uchar i = 0, j = 0;
 #endif
 #if BOOTLOADER_CAN_EXIT
         uchar i = 0, j = 0;
 #endif