HAL_ChibiOS: ensure bootloader flash is multiple of 32 bytes

This commit is contained in:
Andrew Tridgell 2019-12-23 17:31:15 +11:00
parent e22170628d
commit 4561ebf0e2
1 changed files with 3 additions and 0 deletions

View File

@ -239,6 +239,9 @@ bool Util::flash_bootloader()
return false; return false;
} }
// make sure size is multiple of 32
fw_size = (fw_size + 31U) & ~31U;
const uint32_t addr = hal.flash->getpageaddr(0); const uint32_t addr = hal.flash->getpageaddr(0);
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");