mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
HAL_ChibiOS: allow for delay in bootloader flash
This commit is contained in:
parent
2313970eaf
commit
3b5463f061
@ -230,9 +230,12 @@ bool Util::flash_bootloader()
|
|||||||
uint32_t fw_size;
|
uint32_t fw_size;
|
||||||
const char *fw_name = "bootloader.bin";
|
const char *fw_name = "bootloader.bin";
|
||||||
|
|
||||||
|
hal.scheduler->expect_delay_ms(5000);
|
||||||
|
|
||||||
uint8_t *fw = AP_ROMFS::find_decompress(fw_name, fw_size);
|
uint8_t *fw = AP_ROMFS::find_decompress(fw_name, fw_size);
|
||||||
if (!fw) {
|
if (!fw) {
|
||||||
hal.console->printf("failed to find %s\n", fw_name);
|
hal.console->printf("failed to find %s\n", fw_name);
|
||||||
|
hal.scheduler->expect_delay_ms(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +243,7 @@ bool Util::flash_bootloader()
|
|||||||
if (!memcmp(fw, (const void*)addr, fw_size)) {
|
if (!memcmp(fw, (const void*)addr, fw_size)) {
|
||||||
hal.console->printf("Bootloader up-to-date\n");
|
hal.console->printf("Bootloader up-to-date\n");
|
||||||
free(fw);
|
free(fw);
|
||||||
|
hal.scheduler->expect_delay_ms(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,6 +251,7 @@ bool Util::flash_bootloader()
|
|||||||
if (!hal.flash->erasepage(0)) {
|
if (!hal.flash->erasepage(0)) {
|
||||||
hal.console->printf("Erase failed\n");
|
hal.console->printf("Erase failed\n");
|
||||||
free(fw);
|
free(fw);
|
||||||
|
hal.scheduler->expect_delay_ms(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
hal.console->printf("Flashing %s @%08x\n", fw_name, (unsigned int)addr);
|
hal.console->printf("Flashing %s @%08x\n", fw_name, (unsigned int)addr);
|
||||||
@ -264,11 +269,13 @@ bool Util::flash_bootloader()
|
|||||||
}
|
}
|
||||||
hal.console->printf("Flash OK\n");
|
hal.console->printf("Flash OK\n");
|
||||||
free(fw);
|
free(fw);
|
||||||
|
hal.scheduler->expect_delay_ms(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
hal.console->printf("Flash failed after %u attempts\n", max_attempts);
|
hal.console->printf("Flash failed after %u attempts\n", max_attempts);
|
||||||
free(fw);
|
free(fw);
|
||||||
|
hal.scheduler->expect_delay_ms(0);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif //#ifndef HAL_NO_FLASH_SUPPORT
|
#endif //#ifndef HAL_NO_FLASH_SUPPORT
|
||||||
|
Loading…
Reference in New Issue
Block a user