Switch StaticAnalysisTest build test to use the new build system CPPCHECK module...
[pub/USBasp.git] / Bootloaders / CDC / BootloaderCDC.c
index d057349..ef68e14 100644 (file)
@@ -70,10 +70,17 @@ uint32_t MagicBootKey ATTR_NO_INIT;
  */
 void Application_Jump_Check(void)
 {
  */
 void Application_Jump_Check(void)
 {
-       // If the reset source was the bootloader and the key is correct, clear it and jump to the application
+       /* If the reset source was the bootloader and the key is correct, clear it and jump to the application */
        if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
        {
        if ((MCUSR & (1 << WDRF)) && (MagicBootKey == MAGIC_BOOT_KEY))
        {
+               /* Turn off the watchdog */
+               MCUSR &= ~(1<<WDRF);
+               wdt_disable(); 
+
+               /* Clear the boot key and jump to the user application */
                MagicBootKey = 0;
                MagicBootKey = 0;
+
+               // cppcheck-suppress constStatement
                ((void (*)(void))0x0000)();
        }
 }
                ((void (*)(void))0x0000)();
        }
 }
@@ -445,7 +452,7 @@ static void CDC_Task(void)
        else if (Command == 'e')
        {
                /* Clear the application section of flash */
        else if (Command == 'e')
        {
                /* Clear the application section of flash */
-               for (uint32_t CurrFlashAddress = 0; CurrFlashAddress < BOOT_START_ADDR; CurrFlashAddress += SPM_PAGESIZE)
+               for (uint32_t CurrFlashAddress = 0; CurrFlashAddress < (uint32_t)BOOT_START_ADDR; CurrFlashAddress += SPM_PAGESIZE)
                {
                        boot_page_erase(CurrFlashAddress);
                        boot_spm_busy_wait();
                {
                        boot_page_erase(CurrFlashAddress);
                        boot_spm_busy_wait();